Makefile 3.6 KB
Newer Older
1
.PHONY: clean all rel_mktemp_dir console controller help
2
3
4

CONTROLLER_REL_TAR:=$(CURDIR)/controller_$(shell date +%Y%m%d%H%M).tar.gz
CONSOLE_REL_TAR:=$(CURDIR)/console_$(shell date +%Y%m%d%H%M).tar.gz
Jeroen Vreeken's avatar
Jeroen Vreeken committed
5
6
7
8

all:
	$(MAKE) -C common/utils
	$(MAKE) -C common/trace
Jeroen Vreeken's avatar
Jeroen Vreeken committed
9
	$(MAKE) -C common/log
Jeroen Vreeken's avatar
Jeroen Vreeken committed
10
	$(MAKE) -C controller
Jeroen Vreeken's avatar
Jeroen Vreeken committed
11
	cd libnova-0.13.0 ; ./configure -enable-static -disable-shared --prefix=${CURDIR} ; make; make install
Jeroen Vreeken's avatar
Jeroen Vreeken committed
12
13
	$(MAKE) -C console

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
help:
	@echo "Available build rules"; \
	echo  "---------------------"; \
	echo "   console             Build all executables for the console"; \
	echo "   controller          Build the controller executables"; \
	echo "   all                 Build both controller and console"; \
	echo "   release_console     Build a release tar file for the console"; \
	echo "   release_controller  Build a release tar file for the controller"; \
	echo "   release             Build both controller and console release"; \
	echo "   clean               Clean for both controller and console"; \
	echo ""; \
	echo "Building a release"; \
	echo "------------------"; \
	echo "Simply running \"make release\" will build both the console and"; \
	echo "controller. They are stored in individual tar files, in the root"; \
	echo "of the dt_ctrl directory."; \
	echo "The releases are built in a temporary work directory from a clean"; \
	echo "git checkout. A release to be used for production must always"; \
	echo "be built from a version which is already committed to the"; \
	echo "golden repository (on eris.camras.nl)."


36
controller:
37
	$(MAKE) -C common/log
38
39
40
41
42
	$(MAKE) -C common/utils
	$(MAKE) -C common/trace
	$(MAKE) -C controller

console:
43
	$(MAKE) -C common/log
44
45
46
47
48
	$(MAKE) -C common/utils
	$(MAKE) -C common/trace
	cd libnova-0.13.0 ; ./configure -enable-static -disable-shared --prefix=${CURDIR} ; make; make install
	$(MAKE) -C console

Jeroen Vreeken's avatar
Jeroen Vreeken committed
49
clean:
50
	$(MAKE) -C common/log clean
Jeroen Vreeken's avatar
Jeroen Vreeken committed
51
52
53
54
55
56
	$(MAKE) -C common/utils clean
	$(MAKE) -C common/trace clean
	$(MAKE) -C controller clean
	cd libnova-0.13.0 ; make clean || true
	$(MAKE) -C console clean

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Rules for building a release

rel_mktemp_dir:
	$(eval REL_BUILD_DIR:=$(shell mktemp -d /tmp/dt_ctrl_XXXXXX))
	@echo "****** Building code in dir: $(REL_BUILD_DIR)"

rel_clone_dir: rel_mktemp_dir
	@echo "****** Creating clean checkout of source"; \
	git clone . $(REL_BUILD_DIR) >/dev/null; \
	echo "       Done"

rel_utils: rel_clone_dir
	@echo "****** Building common/utils"; \
	$(MAKE) -C $(REL_BUILD_DIR)/common/utils >/dev/null; \
	echo "       Done"

rel_trace: rel_utils
	@echo "****** Building common/trace"; \
	$(MAKE) -C $(REL_BUILD_DIR)/common/trace >/dev/null; \
	echo "       Done"

78
79
80
81
rel_log:
	@echo "****** Building common/log"; \
	$(MAKE) -C $(REL_BUILD_DIR)/common/log >/dev/null; \
	echo "       Done"
82

83
rel_ctrl: rel_trace rel_log
84
85
86
87
88
89
90
91
92
93
94
	@echo "****** Building controller"; \
	$(MAKE) -C $(REL_BUILD_DIR)/controller >/dev/null; \
	echo "       Done"


rel_libnova: rel_clone_dir
	@echo "****** Building libnova"; \
	(cd $(REL_BUILD_DIR)/libnova-0.13.0 ; ./configure -enable-static -disable-shared --prefix=$(REL_BUILD_DIR); make; make install) >/dev/null; \
	echo "       Done"


95
rel_cons: rel_trace rel_libnova rel_log
96
97
98
99
100
101
102
103
104
105
106
107
108
	@echo "****** Building console"; \
	$(MAKE) -C $(REL_BUILD_DIR)/console >/dev/null; \
	echo "       Done"


$(CONSOLE_REL_TAR): rel_cons
	@tar -C $(REL_BUILD_DIR)/release -zhcf $@ console
	@echo "****** Created console release file $@"


$(CONTROLLER_REL_TAR): rel_ctrl
	@tar -C $(REL_BUILD_DIR)/release -zhcf $@ controller
	@echo "****** Created controller release file $@"
Jeroen Vreeken's avatar
Jeroen Vreeken committed
109

110
111
112
release: $(CONSOLE_REL_TAR) $(CONTROLLER_REL_TAR)
release_console: $(CONSOLE_REL_TAR)
release_controller: $(CONTROLLER_REL_TAR)