-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (57 loc) · 1.97 KB
/
Copy pathMakefile
File metadata and controls
67 lines (57 loc) · 1.97 KB
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
# Change default shell from `sh` to `bash` so we have `source` command available
SHELL:=/bin/bash
ROS_ENV:=source scripts/ros-env.sh
# Find system python3 for CMake
PYTHON3:=$(shell env -i which python3)
# Build time environment variables
# For debug build, use `CMAKE_ARGS=-DCMAKE_BUILD_TYPE=Debug make`
CMAKE_ARGS?=
# Ask CMake to generate compile_commands.json for each package
CMAKE_ARGS+=-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
CMAKE_ARGS+=-DPython3_EXECUTABLE=$(PYTHON3)
BUILD?=colcon build
all: build/deps
$(eval CMD=$(BUILD) --cmake-args $(CMAKE_ARGS))
@ NONLOCAL=1 BANNER="$(CMD)" $(ROS_ENV) && \
$(CMD); scripts/compiledb.py
all/symlink: BUILD += --symlink-install
all/symlink: all
build/deps:
@ mkdir -p build
@ NONLOCAL=1 $(ROS_ENV) && \
rosdep update && \
rosdep install -i \
--from-path src \
--rosdistro $${ROS_DISTRO} \
-y
@ echo $$(date) > build/deps
PACKAGES:=$(shell scripts/package_name.py)
PACKAGES:=$(addprefix package/, $(PACKAGES))
$(PACKAGES): build/deps
$(eval PACKAGE=$(shell basename $@))
$(eval CMD=$(BUILD) --cmake-args $(CMAKE_ARGS) --packages-select $(PACKAGE))
$(info $(CMD))
@ $(CLR_ENV) \
&& NONLOCAL=1 BANNER="Building $(PACKAGE)" $(ROS_ENV) && \
$(CMD); scripts/compile_commands.py
PACKAGES_LN:=$(addsuffix /symlink, $(PACKAGES))
$(PACKAGES_LN): BUILD += --symlink-install
$(PACKAGES_LN): build/deps
$(eval PACKAGE=$(shell basename $(shell dirname $@)))
$(eval CMD=$(BUILD) --cmake-args $(CMAKE_ARGS) --packages-select $(PACKAGE))
$(info $(CMD))
@ NONLOCAL=1 BANNER="Building $(PACKAGE)" $(ROS_ENV) && \
$(CMD); scripts/compile_commands.py
# enumurate available launch files (for auto completion)
LAUNCH_FILES:=$(wildcard launch/*)
$(LAUNCH_FILES):
@ BANNER="Launching $@" $(ROS_ENV) && \
ros2 launch $@
sh shell bash:
@ clear && bash --rcfile scripts/shell.sh || true
create:
@ NONLOCAL=1 $(ROS_ENV) && \
scripts/create.sh
clean:
rm -rf build install .cache
.PHONY: build run clean $(LAUNCH_FILES) $(PACKAGES) sh shell bash