-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
136 lines (119 loc) · 3.23 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# To build in production mode, do "make LIBRARY_TYPE=static BUILD_MODE=prod".
# To build in development mode, do "make LIBRARY_TYPE=static BUILD_MODE=dev".
BUILD_MODE ?= dev
LIBRARY_TYPE ?= static
LALTOOLS_SET ?= all
PROCESSORS ?= 0
BUILD_ROOT ?=
ALL_LIBRARY_TYPES = static static-pic relocatable
ALL_BUILD_MODES = dev prod AddressSanitizer
LIB_PROJECTS = \
src/lal_tools.gpr
BIN_PROJECTS = \
src/build.gpr
TESTSUITE_PROJECTS ?= \
testsuite/ada_drivers/gen_marshalling_lib/tgen_marshalling.gpr \
testsuite/ada_drivers/indent/indent.gpr \
testsuite/ada_drivers/outgoing_calls/outgoing_calls.gpr \
testsuite/ada_drivers/partial_gnatpp/partial_gnatpp.gpr
ALL_PROJECTS = \
$(BIN_PROJECTS) $(LIB_PROJECTS) $(TESTSUITE_PROJECTS)
ifeq ($(BUILD_ROOT),)
RELOCATE_BUILD=
BIN=bin
else
# build artifacts are relocated to $(BUILD_ROOT)
RELOCATE_BUILD=--relocate-build-tree="$(BUILD_ROOT)" --root-dir=.
BIN=$(BUILD_ROOT)/bin
endif
GPRBUILD = gprbuild -v -k -p -j$(PROCESSORS) $(RELOCATE_BUILD)
.PHONY: all
all:
which gprbuild
which gcc
for proj in $(ALL_PROJECTS) ; do \
$(GPRBUILD) \
-XLIBRARY_TYPE=$(LIBRARY_TYPE) \
-XXMLADA_BUILD=$(LIBRARY_TYPE) \
-XLALTOOLS_BUILD_MODE=$(BUILD_MODE) \
-XLALTOOLS_SET=$(LALTOOLS_SET) \
-P $$proj ; \
done
.PHONY: lib
lib:
which gprbuild
which gcc
for proj in $(LIB_PROJECTS) ; do \
for kind in $(ALL_LIBRARY_TYPES) ; do \
rm -f obj/lib/$$kind/*.lexch; \
$(GPRBUILD) \
-XLIBRARY_TYPE=$$kind \
-XLALTOOLS_BUILD_MODE=$(BUILD_MODE) \
-P $$proj ; \
done ; \
done
.PHONY: bin
bin:
which gprbuild
which gcc
for proj in $(BIN_PROJECTS) ; do \
$(GPRBUILD) \
-XLIBRARY_TYPE=$(LIBRARY_TYPE) \
-XXMLADA_BUILD=$(LIBRARY_TYPE) \
-XLALTOOLS_BUILD_MODE=$(BUILD_MODE) \
-XLALTOOLS_SET=$(LALTOOLS_SET) \
-P $$proj ; \
done
.PHONY: testsuite_drivers
testsuite_drivers:
which gprbuild
which gcc
for proj in $(TESTSUITE_PROJECTS) ; do \
$(GPRBUILD) \
-XLIBRARY_TYPE=$(LIBRARY_TYPE) \
-XXMLADA_BUILD=$(LIBRARY_TYPE) \
-XLALTOOLS_BUILD_MODE=$(BUILD_MODE) \
-XLALTOOLS_SET=$(LALTOOLS_SET) \
-P $$proj ; \
done
.PHONY: test
test: all
$(BIN)/utils-var_length_ints-test
testsuite/testsuite.py
.PHONY: clean
clean:
for proj in $(ALL_PROJECTS) ; do \
for build_mode in $(ALL_BUILD_MODES) ; do \
for library_type in $(ALL_LIBRARY_TYPES) ; do \
gprclean $(RELOCATE_BUILD) \
-XLIBRARY_TYPE=$$library_type \
-XLALTOOLS_BUILD_MODE=$$build_mode \
-q -P $$proj; \
done ; \
done ; \
done
.PHONY: install-lib
install-lib:
for proj in $(LIB_PROJECTS) ; do \
for kind in $(ALL_LIBRARY_TYPES) ; do \
gprinstall $(RELOCATE_BUILD) \
-XLIBRARY_TYPE=$$kind \
-XLALTOOLS_BUILD_MODE=$(BUILD_MODE) \
--prefix="$(DESTDIR)" \
--sources-subdir=include/$$(basename $$proj | cut -d. -f1) \
--build-name=$$kind \
--build-var=LIBRARY_TYPE --build-var=LAL_TOOLS_BUILD \
-P $$proj -p -f ; \
done ; \
done
.PHONY: install-bin-strip
install-bin-strip:
mkdir -p "$(DESTDIR)"
cp -r "$(BIN)" "$(DESTDIR)/"
# Don't strip debug builds
test "$(BUILD_MODE)" = dev || strip "$(DESTDIR)/bin/"*
.PHONY: install-tgen
install-tgen:
mkdir -p "$(DESTDIR)/share/tgen"
cp -r src/tgen/tgen_rts "$(DESTDIR)/share/tgen/"
cp -r share/tgen/templates "$(DESTDIR)/share/tgen/"