MYNT-EYE-S-SDK/Makefile

217 lines
4.4 KiB
Makefile
Raw Permalink Normal View History

2018-05-10 09:46:34 +03:00
# Copyright 2018 Slightech Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2018-03-08 09:54:14 +02:00
include CommonDefs.mk
.DEFAULT_GOAL := help
help:
@echo "Usage:"
2018-03-09 04:51:09 +02:00
@echo " make help show help message"
@echo " make apidoc make api doc"
@echo " make opendoc open api doc (html)"
@echo " make init init project"
2018-03-11 18:15:30 +02:00
@echo " make build build project"
2018-03-09 04:51:09 +02:00
@echo " make test build test and run"
2018-03-22 06:57:35 +02:00
@echo " make install install project"
2018-03-22 07:03:08 +02:00
@echo " make samples build samples"
2018-04-15 09:59:51 +03:00
@echo " make tools build tools"
2018-04-14 05:33:08 +03:00
@echo " make ros build ros wrapper"
2018-03-09 04:51:09 +02:00
@echo " make clean|cleanall clean generated or useless things"
.PHONY: help
2018-05-11 11:15:26 +03:00
all: test tools samples
.PHONY: all
2018-03-09 04:51:09 +02:00
# doc
2018-03-08 09:54:14 +02:00
apidoc:
@$(call echo,Make $@)
2018-04-03 18:39:09 +03:00
@[ -e ./_install/include ] || $(MAKE) install
2018-03-09 05:42:45 +02:00
@$(SH) ./doc/build.sh
2018-03-08 09:54:14 +02:00
opendoc: apidoc
@$(call echo,Make $@)
2018-03-09 05:42:45 +02:00
@$(shell $(SH) ./doc/langs.sh 1); \
2018-03-08 09:54:14 +02:00
for lang in "$${LANGS[@]}"; do \
2018-03-26 08:50:13 +03:00
html=./doc/_output/$$lang/html/index.html; \
2018-03-09 05:42:45 +02:00
[ -f "$$html" ] && $(SH) ./scripts/open.sh $$html; \
2018-03-08 09:54:14 +02:00
done
2018-03-08 11:33:41 +02:00
2018-03-09 04:51:09 +02:00
.PHONY: apidoc opendoc
# deps
submodules:
@git submodule update --init
third_party: submodules
@$(call echo,Make $@)
@$(call echo,Make glog,33)
@$(call cmake_build,./third_party/glog/_build)
.PHONY: submodules third_party
2018-03-22 06:57:35 +02:00
# init
init: submodules
@$(call echo,Make $@)
@$(SH) ./scripts/init.sh
.PHONY: init
2018-03-11 18:15:30 +02:00
# build
build: third_party
@$(call echo,Make $@)
@$(call cmake_build,./_build)
.PHONY: build
2018-03-09 04:51:09 +02:00
# test
2018-04-03 05:27:28 +03:00
test: install
2018-03-09 04:51:09 +02:00
@$(call echo,Make $@)
@$(call echo,Make gtest,33)
2018-04-25 06:32:54 +03:00
ifeq ($(HOST_OS),Win)
@$(call cmake_build,./test/gtest/_build,..,-Dgtest_force_shared_crt=ON)
else
2018-04-03 05:27:28 +03:00
@$(call cmake_build,./test/gtest/_build)
2018-04-25 06:32:54 +03:00
endif
2018-04-03 05:27:28 +03:00
@$(call echo,Make test,33)
@$(call cmake_build,./test/_build)
2018-04-25 06:32:54 +03:00
ifeq ($(HOST_OS),Win)
@.\\\test\\\_output\\\bin\\\mynteye_test.bat
else
2018-04-03 05:27:28 +03:00
@./test/_output/bin/mynteye_test
2018-04-25 06:32:54 +03:00
endif
2018-03-09 04:51:09 +02:00
.PHONY: test
2018-03-22 06:57:35 +02:00
# install
install: build
@$(call echo,Make $@)
2018-04-23 18:11:11 +03:00
ifeq ($(HOST_OS),Win)
ifneq ($(HOST_NAME),MinGW)
@cd ./_build; msbuild.exe INSTALL.vcxproj /property:Configuration=Release
else
2018-03-22 06:57:35 +02:00
@cd ./_build; make install
2018-04-23 18:11:11 +03:00
endif
else
@cd ./_build; make install
endif
2018-03-22 06:57:35 +02:00
.PHONY: install
2018-03-22 07:03:08 +02:00
# samples
samples: install
@$(call echo,Make $@)
@$(call cmake_build,./samples/_build)
.PHONY: samples
2018-04-15 09:59:51 +03:00
# tools
tools: install
@$(call echo,Make $@)
@$(call cmake_build,./tools/_build)
.PHONY: tools
2018-04-14 05:33:08 +03:00
# ros
ros: install
@$(call echo,Make $@)
2018-04-23 18:11:11 +03:00
ifeq ($(HOST_OS),Win)
$(error "Can't make ros on win")
else
2018-04-14 05:33:08 +03:00
@cd ./wrappers/ros && catkin_make
2018-04-23 18:11:11 +03:00
endif
2018-04-14 05:33:08 +03:00
.PHONY: ros
cleanros:
@$(call echo,Make $@)
@$(call rm,./wrappers/ros/build/)
@$(call rm,./wrappers/ros/devel/)
@$(call rm,./wrappers/ros/install/)
@$(call rm,./wrappers/ros/.catkin_workspace)
@$(call rm,./wrappers/ros/src/CMakeLists.txt)
2018-04-14 16:27:40 +03:00
@$(call rm_f,*INFO*,$(HOME)/.ros/)
@$(call rm_f,*WARNING*,$(HOME)/.ros/)
@$(call rm_f,*ERROR*,$(HOME)/.ros/)
@$(call rm_f,*FATAL*,$(HOME)/.ros/)
2018-04-14 05:33:08 +03:00
.PHONY: cleanros
2018-03-09 04:51:09 +02:00
# clean
2018-04-14 16:27:40 +03:00
clean:
2018-03-09 04:51:09 +02:00
@$(call echo,Make $@)
2018-03-11 18:15:30 +02:00
@$(call rm,./_build/)
@$(call rm,./_output/)
2018-03-22 06:57:35 +02:00
@$(call rm,./_install/)
2018-03-23 07:05:17 +03:00
@$(call rm,./samples/_build/)
@$(call rm,./samples/_output/)
2018-04-15 09:59:51 +03:00
@$(call rm,./tools/_build/)
@$(call rm,./tools/_output/)
2018-04-03 05:27:28 +03:00
@$(call rm,./test/_build/)
@$(call rm,./test/_output/)
2018-03-11 18:15:30 +02:00
@$(MAKE) cleanlog
2018-04-14 16:27:40 +03:00
ifeq ($(HOST_OS),Linux)
@$(MAKE) cleanros
endif
2018-03-09 04:51:09 +02:00
2018-03-11 18:15:30 +02:00
cleanlog:
@$(call rm_f,*INFO*)
@$(call rm_f,*WARNING*)
@$(call rm_f,*ERROR*)
2018-03-22 07:03:08 +02:00
@$(call rm_f,*FATAL*)
2018-03-11 18:15:30 +02:00
2018-04-14 16:27:40 +03:00
cleanall: clean
2018-04-14 05:33:08 +03:00
@$(call rm,./doc/_output/)
@$(call rm,./test/gtest/_build/)
@$(call rm,./third_party/glog/_build/)
@$(FIND) . -type f -name ".DS_Store" -print0 | xargs -0 rm -f
.PHONY: clean cleanlog cleanall
2018-03-09 04:51:09 +02:00
# others
2018-03-08 11:33:41 +02:00
host:
@$(call echo,Make $@)
@echo HOST_OS: $(HOST_OS)
@echo HOST_ARCH: $(HOST_ARCH)
2018-03-09 08:10:42 +02:00
@echo HOST_NAME: $(HOST_NAME)
2018-03-09 05:42:45 +02:00
@echo SH: $(SH)
2018-03-08 11:33:41 +02:00
@echo ECHO: $(ECHO)
2018-03-09 05:42:45 +02:00
@echo FIND: $(FIND)
2018-03-08 11:33:41 +02:00
@echo CC: $(CC)
@echo CXX: $(CXX)
@echo MAKE: $(MAKE)
@echo BUILD: $(BUILD)
@echo LDD: $(LDD)
@echo CMAKE: $(CMAKE)
2018-03-09 04:51:09 +02:00
.PHONY: host
2018-03-11 18:15:30 +02:00
2018-03-22 06:57:35 +02:00
cpplint: submodules
2018-03-11 18:15:30 +02:00
@$(call echo,Make $@)
@$(SH) ./scripts/$@.sh
.PHONY: cpplint