MYNT-EYE-S-SDK/Makefile

222 lines
4.7 KiB
Makefile
Raw 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
2018-05-20 04:25:30 +03:00
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
2018-08-14 05:45:13 +03:00
# CMAKE_INSTALL_PREFIX:
# https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
#
# UNIX: /usr/local
# Windows: c:/Program Files/${PROJECT_NAME}
2019-01-03 11:14:36 +02:00
# Options
#
# SUDO: sudo command
#
2019-01-16 14:04:33 +02:00
# e.g. make [TARGET] SUDO=
2019-01-03 11:14:36 +02:00
2018-10-24 06:06:31 +03:00
SUDO ?= sudo
CMAKE_BUILD_EXTRA_OPTIONS ?=
2019-01-03 11:14:36 +02:00
2018-11-18 16:17:54 +02:00
.DEFAULT_GOAL := all
2018-03-08 09:54:14 +02:00
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-22 06:57:35 +02:00
@echo " make install install project"
2018-03-22 07:03:08 +02:00
@echo " make samples build samples"
2019-09-19 12:11:43 +03:00
@echo " make pkg package sdk(windows)"
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
2019-08-30 12:06:34 +03:00
all: init samples ros
2018-05-11 11:15:26 +03:00
.PHONY: all
2018-03-09 04:51:09 +02:00
# doc
2018-03-08 09:54:14 +02:00
2019-03-11 07:52:33 +02:00
doc: apidoc
2019-03-11 07:27:49 +02:00
apidoc: cleandoc
2018-03-08 09:54:14 +02:00
@$(call echo,Make $@)
2019-03-11 07:27:49 +02:00
@cd docs; make html
2018-03-08 09:54:14 +02:00
opendoc: apidoc
@$(call echo,Make $@)
2019-03-11 07:27:49 +02:00
@$(SH) ./scripts/open.sh docs/_build/html/index.html
2018-03-08 11:33:41 +02:00
2018-07-08 08:04:41 +03:00
cleandoc:
2019-03-11 07:27:49 +02:00
@$(call rm,./docs/_build/)
@$(call rm,./docs/_doxygen/)
2018-07-08 08:04:41 +03:00
2019-03-11 07:52:33 +02:00
.PHONY: doc apidoc opendoc cleandoc
2018-03-09 04:51:09 +02:00
2018-03-22 06:57:35 +02:00
# init
2018-11-18 16:17:54 +02:00
init:
2018-03-22 06:57:35 +02:00
@$(call echo,Make $@)
2018-10-24 06:06:31 +03:00
@$(SH) ./scripts/init.sh $(INIT_OPTIONS)
2018-03-22 06:57:35 +02:00
.PHONY: init
2018-03-11 18:15:30 +02:00
# build
2018-11-19 08:15:47 +02:00
build:
2018-03-11 18:15:30 +02:00
@$(call echo,Make $@)
2018-08-14 08:46:18 +03:00
ifeq ($(HOST_OS),Win)
2019-02-15 12:25:58 +02:00
@$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install $(CMAKE_BUILD_EXTRA_OPTIONS))
2018-08-14 08:46:18 +03:00
else
2019-01-03 11:14:36 +02:00
@$(call cmake_build,./_build,..,$(CMAKE_BUILD_EXTRA_OPTIONS))
2018-08-14 08:46:18 +03:00
endif
2018-03-11 18:15:30 +02:00
.PHONY: build
2018-03-22 06:57:35 +02:00
# install
install: uninstall build
2018-03-22 06:57:35 +02:00
@$(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-08-14 08:46:18 +03:00
@cd ./_build; make install
2018-04-23 18:11:11 +03:00
endif
else
2018-09-11 05:58:42 +03:00
ifeq ($(HOST_OS),Linux)
2018-10-24 06:06:31 +03:00
@cd ./_build; $(SUDO) make install
2018-09-11 05:58:42 +03:00
else
@cd ./_build; make install
endif
2018-04-23 18:11:11 +03:00
endif
2018-03-22 06:57:35 +02:00
.PHONY: install
2018-10-26 10:39:34 +03:00
uninstall:
@$(call echo,Make $@)
ifeq ($(HOST_OS),Linux)
$(SUDO) rm -rf /usr/local/include/mynteye/
2018-12-04 09:46:54 +02:00
$(SUDO) rm -rf /usr/local/lib/libmynteye.so*
2018-10-26 10:39:34 +03:00
$(SUDO) rm -rf /usr/local/lib/cmake/mynteye/
$(SUDO) rm -rf /usr/local/share/mynteye/
endif
.PHONY: uninstall
2018-03-22 07:03:08 +02:00
# samples
samples: install
@$(call echo,Make $@)
@$(call cmake_build,./samples/_build)
.PHONY: samples
2018-11-01 14:03:23 +02:00
# pkg
2018-04-14 05:33:08 +03:00
2018-11-01 14:03:23 +02:00
pkg: clean
2018-04-14 05:33:08 +03:00
@$(call echo,Make $@)
2018-04-23 18:11:11 +03:00
ifeq ($(HOST_OS),Win)
2018-11-01 17:12:36 +02:00
@$(SH) ./scripts/win/winpack.sh "$(PKGNAME)"
2018-04-23 18:11:11 +03:00
else
2018-11-01 14:03:23 +02:00
$(error "Can't make pkg on $(HOST_OS)")
endif
cleanpkg:
@$(call echo,Make $@)
@$(call rm_f,$(PKGNAME)*)
.PHONY: pkg cleanpkg
# ros
ros: install
@$(call echo,Make $@)
ifeq ($(HOST_OS),Linux)
2018-11-07 08:37:03 +02:00
@cd ./wrappers/ros && catkin_make -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
2018-11-01 14:03:23 +02:00
else
$(error "Can't make ros on $(HOST_OS)")
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-05-17 12:28:43 +03:00
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-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-07-08 08:04:41 +03:00
cleanall: clean cleandoc
2018-04-14 05:33:08 +03:00
@$(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 $@)
2018-05-20 04:25:30 +03:00
@echo MKFILE_PATH: $(MKFILE_PATH)
@echo MKFILE_DIR: $(MKFILE_DIR)
2018-03-08 11:33:41 +02:00
@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-11-01 14:03:23 +02:00
@echo PKGNAME: $(PKGNAME)
2019-01-03 11:14:36 +02:00
@echo CMAKE_BUILD_EXTRA_OPTIONS: $(CMAKE_BUILD_EXTRA_OPTIONS)
2018-03-09 04:51:09 +02:00
.PHONY: host