-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
98 lines (80 loc) · 2.79 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
sifs = trifinger_base.sif trifinger_base_pylon.sif trifinger_user.sif trifinger_robot.sif solo_bolt_user.sif solo_bolt_robot.sif
USE_SUDO = 0
.PHONY: all
all: $(sifs)
build/cache:
@echo "Create cache directories in './build/cache'"
mkdir -p "$@"
mkdir "$@/apt"
build/trifinger:
@echo "Clone workspace to './build/trifinger'"
mkdir -p build/trifinger
cd build/trifinger; \
git clone https://github.com/machines-in-motion/treep_machines_in_motion.git; \
treep --clone-https ROBOT_FINGERS
build/solo_bolt:
@echo "Clone workspace to './build/solo_bolt'"
mkdir -p build/solo_bolt
cd build/solo_bolt; \
git clone https://github.com/machines-in-motion/treep_machines_in_motion.git; \
treep --clone-https ROBOT_INTERFACES_SOLO; \
treep --clone-https ROBOT_INTERFACES_BOLT;
.PHONY: clean
clean:
rm -rf build
.PHONY: clean_sif
clean-sif:
rm -f $(sifs)
# Regarding the structure of this Makefile:
# There is a generic "make *.sif" target which simply builds the *.def file of
# the same name. Images that have dependencies should resolve them in a target
# for the specific def file.
trifinger_base.sif: trifinger_base.def | build/cache
@echo "Build $@..."
apptainer build \
--bind "${PWD}/build/cache/apt:/var/cache/apt" \
--bind "${PWD}/build/cache:/_cache" \
$@ $<
trifinger_base_pylon.sif: trifinger_base_pylon.def trifinger_base.sif | build/cache
@echo "Build $@..."
apptainer build \
--bind "${PWD}/build/cache:/_cache" \
$@ $<
trifinger_base_dev.sif: trifinger_base_dev.def trifinger_base_pylon.sif | build/cache
@echo "Build $@..."
apptainer build \
--bind "${PWD}/build/cache/apt:/var/cache/apt" \
--bind "${PWD}/build/cache:/_cache" \
$@ $<
# Images using the "trifinger.def" file are different as build-args need to be
# passed to them
trifinger_user.sif: trifinger.def trifinger_base.sif build/trifinger
@echo "Build $@..."
apptainer build \
--build-arg BASE_IMAGE=trifinger_base.sif \
--build-arg WS_DIR=build/trifinger/workspace \
$@ trifinger.def
trifinger_robot.sif: trifinger.def trifinger_base_pylon.sif build/trifinger
@echo "Build $@..."
apptainer build \
--build-arg BASE_IMAGE=trifinger_base_pylon.sif \
--build-arg WS_DIR=build/trifinger/workspace \
--build-arg REALTIME_BUILD=true \
$@ trifinger.def
solo_bolt_user.sif: trifinger.def trifinger_base.sif build/solo_bolt
@echo "Build $@..."
apptainer build \
--build-arg BASE_IMAGE=trifinger_base.sif \
--build-arg WS_DIR=build/solo_bolt/workspace \
$@ trifinger.def
solo_bolt_robot.sif: trifinger.def trifinger_base.sif build/solo_bolt
@echo "Build $@..."
apptainer build \
--build-arg BASE_IMAGE=trifinger_base.sif \
--build-arg WS_DIR=build/solo_bolt/workspace \
--build-arg REALTIME_BUILD=true \
$@ trifinger.def
# build arbitrary def file
%.sif: %.def
@echo "Build $@..."
apptainer build $@ $<