-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
121 lines (84 loc) · 2.48 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Makefile for building and launching docker images
### Variables
# Arguments to be passed to roslaunch
ARGS ?=
# Set to '' to prevent interactive shell
DOCKER_IT ?= -it
# Catkin workspace on the local machine where build artifacts will be stored
CATKIN_WS ?= "${HOME}/catkin_ws"
# Location of the git repository on the local machine (mounted for source)
GIT ?= "${HOME}/ros_repos/"
DOCKER_IMAGE ?= dmce
DOCKER_FILE ?= "${GIT}/dmce/docker/${DOCKER_IMAGE}.Dockerfile"
DOCKER_VOLUMES = \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="${GIT}":"/catkin_ws/src/ros_repos":rw \
--volume="${CATKIN_WS}/build":"/catkin_ws/build":rw \
--volume="${CATKIN_WS}/devel":"/catkin_ws/devel":rw \
--volume="${CATKIN_WS}/logs":"/catkin_ws/logs":rw
DOCKER_ENV = \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1"
DOCKER_ARGS = ${DOCKER_IT} --net=host ${DOCKER_VOLUMES} ${DOCKER_ENV}
DOCKER_RUN = docker run ${DOCKER_ARGS} ${DOCKER_IMAGE}
CATKIN_MAKE = catkin_make -DCMAKE_EXPORT_COMPILE_COMMANDS=1
### Builders
.PHONY: docker-build
docker-build:
docker build -f ${DOCKER_FILE} -t ${DOCKER_IMAGE} .
.PHONY: build-pkg
build-pkg:
${DOCKER_RUN} ${CATKIN_MAKE} dmce
.PHONY: build-pkg-local
build-pkg-local:
${CATKIN_MAKE} all
### Launchers
.PHONY: bash
bash: xhost-open
${DOCKER_RUN} bash
# Run simulation with RViz display
.PHONY: demo
demo: build-pkg # xhost-open
# ${DOCKER_RUN} roslaunch dmce_sim demo.launch
roslaunch dmce_sim demo.launch ${ARGS}
# Run the headless simulation
.PHONY: sim
sim: build-pkg
${DOCKER_RUN} roslaunch dmce_sim sim.launch ${ARGS}
.PHONY: rviz
rviz: xhost-open
${DOCKER_RUN} rosrun rviz rviz
.PHONY: roscore
roscore:
${DOCKER_RUN} roscore
.PHONY: test
test:
${DOCKER_RUN} ${CATKIN_MAKE} run_tests_dmce_tests
#${DOCKER_RUN} catkin_test_results
.PHONY: utest
utest: # gTest-based unit tests
${DOCKER_RUN} ${CATKIN_MAKE} run_tests_dmce_tests_gtest
.PHONY: ntest
ntest: # rostest-based node-level tests
${DOCKER_RUN} ${CATKIN_MAKE} run_tests_dmce_tests_rostest_launch_node.test
.PHONY: itest
itest: # rostest-based integration tests
${DOCKER_RUN} ${CATKIN_MAKE} run_tests_dmce_tests_rostest_launch_integration.test
### Other
.PHONY: perms-logs
perms-logs:
${DOCKER_RUN} chmod -R 777 src/ros_repos/dmce/dmce_sim/logs/
.PHONY: xhost-open
xhost-open:
xhost +
.PHONY: xhost-close
xhost-close:
xhost -
.PHONY: clean
clean:
sudo rm -rf ${CATKIN_WS}/build
sudo rm -rf ${CATKIN_WS}/devel
sudo rm -rf ${CATKIN_WS}/logs
.PHONY: logclean
logclean: perms-logs
rm -rf dmce_sim/logs/*