forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (77 loc) · 2.73 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
BUILD_SYSTEM:=$(OS)
ifeq ($(BUILD_SYSTEM),Windows_NT)
BUILD_SYSTEM:=$(shell uname -o 2> uname.err || echo Windows_NT) # set to Cygwin if appropriate
else
BUILD_SYSTEM:=$(shell uname -s)
endif
BUILD_SYSTEM:=$(strip $(BUILD_SYSTEM))
# Figure out where to build the software.
# Use BUILD_PREFIX if it was passed in.
# If not, search up to four parent directories for a 'build' directory.
# Otherwise, use ./build.
ifeq ($(BUILD_SYSTEM), Windows_NT)
ifeq "$(BUILD_PREFIX)" ""
BUILD_PREFIX:=$(shell (for %%x in (. .. ..\.. ..\..\.. ..\..\..\..) do ( if exist %cd%\%%x\build ( echo %cd%\%%x\build & exit ) )) & echo %cd%\build )
endif
# don't clean up and create build dir as I do in linux. instead create it during configure.
else
ifeq "$(BUILD_PREFIX)" ""
BUILD_PREFIX:=$(shell for pfx in ./ .. ../.. ../../.. ../../../..; do d=`pwd`/$$pfx/build;\
if [ -d $$d ]; then echo $$d; exit 0; fi; done; echo `pwd`/build)
endif
# create the build directory if needed, and normalize its path name
BUILD_PREFIX:=$(shell mkdir -p $(BUILD_PREFIX) && cd $(BUILD_PREFIX) && echo `pwd`)
endif
ifeq "$(BUILD_SYSTEM)" "Cygwin"
BUILD_PREFIX:=$(shell cygpath -m $(BUILD_PREFIX))
endif
# Default to a release build. If you want to enable debugging flags, run
# "make BUILD_TYPE=Debug"
ifeq "$(BUILD_TYPE)" ""
BUILD_TYPE="Release"
endif
.PHONY: all
all: pod-build/Makefile
cmake --build pod-build --config $(BUILD_TYPE)
pod-build/Makefile:
$(MAKE) configure
.PHONY: options
options: configure
ifeq ($(OS),Windows_NT)
cmake-gui pod-build
else
ccmake pod-build
endif
.PHONY: configure
configure:
# @echo "BUILD_SYSTEM: '$(BUILD_SYSTEM)'"
@echo "BUILD_PREFIX: $(BUILD_PREFIX)"
# create the temporary build directory if needed
# create the lib directory if needed, so the pkgconfig gets installed to the right place
ifeq ($(BUILD_SYSTEM), Windows_NT)
@if not exist pod-build ( mkdir pod-build )
else
@mkdir -p pod-build
endif
# run CMake to generate and configure the build scripts
@cd pod-build && cmake $(CMAKE_FLAGS) -DCMAKE_INSTALL_PREFIX=$(BUILD_PREFIX) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ..
.PHONY: download-all
download-all: configure
cmake --build pod-build --config $(BUILD_TYPE) --target $@
.PHONY: clean
clean:
ifeq ($(BUILD_SYSTEM),Windows_NT)
rd /s pod-build
rd /s build
else
-if [ -e pod-build/install_manifest.txt ]; then rm -f `cat pod-build/install_manifest.txt`; fi
-if [ -d pod-build ]; then cmake --build pod-build --target clean-all; fi #rm -rf pod-build; fi
-rm -rf build
endif
# other (custom) targets are passed through to the cmake-generated Makefile
%::
cmake --build pod-build --config $(BUILD_TYPE) --target $@
# Default to a less-verbose build. If you want all the gory compiler output,
# run "make VERBOSE=1"
$(VERBOSE).SILENT: