-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
343 lines (262 loc) · 10.1 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
############################################################################
# Ada Web Server #
# #
# Copyright (C) 2003-2024, AdaCore #
# #
# This is free software; you can redistribute it and/or modify it #
# under terms of the GNU General Public License as published by the #
# Free Software Foundation; either version 3, or (at your option) any #
# later version. This software is distributed in the hope that it will #
# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty #
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
# General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# distributed with this software; see file COPYING3. If not, go #
# to http://www.gnu.org/licenses for a complete copy of the license. #
############################################################################
ifndef VERBOSE_MAKE
.SILENT:
endif
# BLD_DIR : root build directory
# TGT_DIR : target directory
# PRJ_DIR : project directory
# STP_DIR : setup directory
# KND_DIR : kind dir, the debug or release dir
# CMN_DIR : directory for common generated files
BLD_DIR := $(CURDIR)
SRC_DIR := $(CURDIR)
# NOTE: You should not have to change this makefile. Configuration options
# can be changed in makefile.conf
include $(SRC_DIR)/makefile.conf
# default setup
include $(SRC_DIR)/makefile.checks
# consistency checks
TGT_DIR := $(BLD_DIR)/$(TARGET)
PRJ_DIR := $(TGT_DIR)/projects
STP_DIR := $(TGT_DIR)/setup
CMN_DIR := $(TGT_DIR)/common
ifeq ($(DEBUG), true)
MAKE_OPT =
KND_DIR = $(TGT_DIR)/debug
else
MAKE_OPT = -s
KND_DIR = $(TGT_DIR)/release
endif
# Target dir
ifeq ($(ISOOT), true)
OOTDIR := /$(TARGET)
else
OOTDIR := /$(TARGET)
endif
# Add path to generated project files
export GPR_PROJECT_PATH := $(PRJ_DIR)$(PSEP)$(GPR_PROJECT_PATH)
LIBAWS_TYPES := static
ifeq (${ENABLE_SHARED},true)
LIBAWS_TYPES += relocatable static-pic
endif
#############################################################################
# NO NEED TO CHANGE ANYTHING PAST THIS POINT
#############################################################################
all: build
ALL_OPTIONS = $(MAKE_OPT) SOCKET="$(SOCKET)" XMLADA="$(XMLADA)" \
EXEEXT="$(EXEEXT)" LDAP="$(LDAP)" DEBUG="$(DEBUG)" \
RM="$(RM)" CP="$(CP)" MKDIR="$(MKDIR)" SED="$(SED)" GCC="$(GCC)" \
GPRBUILD="$(GPRBUILD)" VERBOSE_MAKE="$(VERBOSE_MAKE)" ZLIB="$(ZLIB)" \
prefix="$(prefix)" ENABLE_SHARED="$(ENABLE_SHARED)" \
SOEXT="$(SOEXT)" GNAT="$(GNAT)" SSL_DYNAMIC="$(SSL_DYNAMIC)" \
LIBRARY_TYPE="$(LIBRARY_TYPE)" PYTHON="$(PYTHON)" \
TARGET="$(TARGET)" IS_CROSS=$(IS_CROSS) GPRINSTALL="$(GPRINSTALL)" \
SRC_DIR="$(SRC_DIR)" BLD_DIR="$(BLD_DIR)" PRJ_DIR=$(PRJ_DIR) \
TGT_DIR="$(TGT_DIR)" STP_DIR="$(STP_DIR)" KND_DIR="$(KND_DIR)" \
CMN_DIR="$(CMN_DIR)" ISOOT="$(ISOOT)" PSEP="$(PSEP)"
build-doc:
echo ""
echo "=== Build doc"
${MAKE} -C docs html latexpdf
${MAKE} -C templates_parser/docs html latexpdf
run_regtests:
echo ""
echo "=== Run regression tests"
echo ""
$(MAKE) -C regtests aws_regtests $(ALL_OPTIONS)
force:
#############################################################################
# Configuration for GNAT Projet Files
MODULES = config include ssl src gps regtests demos
MODULES_SETUP = ${MODULES:%=%_setup} templates_parser_setup
MODULES_INSTALL = ${MODULES:%=%_install}
MODULES_CHECK = ${MODULES:%=%_check}
GALL_OPTIONS := $(ALL_OPTIONS) \
PRJ_BUILD="$(PRJ_BUILD)" \
PRJ_XMLADA="$(PRJ_XMLADA)" \
PRJ_LAL="$(PRJ_LAL)" \
PRJ_SOCKLIB="$(PRJ_SOCKLIB)" \
PRJ_LDAP="$(PRJ_LDAP)" \
PRJ_TARGET="$(PRJ_TARGET)" \
TP_XMLADA="$(TP_XMLADA)" \
I_INC="$(I_INC)"
${MODULES_SETUP}: force
${MAKE} -C ${@:%_setup=%} setup $(GALL_OPTIONS)
${MODULES_INSTALL}: force
${MAKE} -C ${@:%_install=%} install $(GALL_OPTIONS)
${MODULES_CHECK}: force
${MAKE} -C ${@:%_check=%} check $(GALL_OPTIONS)
#######################################################################
# build
# build awsres tool as needed by wsdl2aws
build-awsres-tool-native:
$(GPRBUILD) -p $(GPROPTS) $(GPR_STATIC) -XTO_BUILD=awsres.adb \
tools/tools.gpr
build-tools-native: gen-templates build-lib-native
$(GPRBUILD) -p $(GPROPTS) $(GPR_STATIC) tools/tools.gpr
build-libs-%:
$(GPRBUILD) -p $(GPROPTS) \
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr
build-lib-native: ${LIBAWS_TYPES:%=build-libs-%}
build-gps-support: build-lib-native
$(GPRBUILD) -p $(GPROPTS) $(GPR_STATIC) gps/gps_support.gpr
${MAKE} -C gps $(GALL_OPTIONS) after-build
build-native: build-tools-native build-gps-support
build-tools-cross: build-lib-cross
$(GPRBUILD) -p --target=$(TARGET) $(GPROPTS) \
$(GPR_STATIC) tools/tools.gpr
build-libs-cross-%:
$(GPRBUILD) -p --target=$(TARGET) $(GPROPTS) \
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr
build-lib-cross: ${LIBAWS_TYPES:%=build-libs-cross-%}
build-dynamo:
make -C config build-dynamo $(ALL_OPTIONS)
gen-templates: build-awsres-tool-native force
make -C tools/wsdl2aws-templates \
gen-templates $(ALL_OPTIONS)
build-cross: build-tools-cross
ifeq (${IS_CROSS}, true)
build: gen-templates build-cross
else
build: gen-templates build-native
endif
gps: setup
$(GPS) $(GPROPTS) $(GPR_SHARED) -Paws.gpr &
#######################################################################
# clean
clean-libs-%:
$(GPRCLEAN) $(GPROPTS) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr
clean-lib-native: ${LIBAWS_TYPES:%=clean-libs-%}
clean-native: clean-lib-native
-$(GPRCLEAN) $(GPROPTS) $(GPR_STATIC) tools/tools.gpr
-$(GPRCLEAN) $(GPROPTS) $(GPR_STATIC) gps/gps_support.gpr
clean-libs-cross-%:
$(GPRCLEAN) --target=$(TARGET) \
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* aws.gpr
clean-cross: ${LIBAWS_TYPES:%=clean-libs-cross-%}
ifeq (${IS_CROSS}, true)
clean: clean-cross
else
clean: clean-native
endif
-${MAKE} -C regtests $(GALL_OPTIONS) clean
-${MAKE} -C docs $(GALL_OPTIONS) clean
-${RM} -fr $(BDIR)
#######################################################################
# install
install-clean:
ifneq (,$(wildcard $(TPREFIX)/share/gpr/manifests/aws))
-$(GPRINSTALL) $(GPROPTS) --uninstall --prefix=$(TPREFIX) aws
endif
GPRINST_OPTS=-p -f --prefix=$(TPREFIX) \
--build-var=LIBRARY_TYPE --build-var=AWS_BUILD
install-libs-%:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) \
-XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* \
--build-name=$* aws.gpr
install-lib-native: ${LIBAWS_TYPES:%=install-libs-%}
install-tools-native:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) $(GPR_STATIC) --mode=usage \
--build-name=static \
--install-name=aws tools/tools.gpr
install-native: install-clean install-lib-native install-tools-native
install-libs-cross-%:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) \
--target=$(TARGET) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* \
--build-name=$* aws.gpr
install-lib-cross: ${LIBAWS_TYPES:%=install-libs-cross-%}
install-tools-cross:
$(GPRINSTALL) $(GPROPTS) $(GPRINST_OPTS) --mode=usage \
--target=$(TARGET) $(GPROPTS) \
--install-name=aws tools/tools.gpr
install-cross: install-clean install-libs-cross install-tools-cross
ifeq (${IS_CROSS}, true)
install: install-cross
else
install: install-native
endif
#######################################################################
check: $(MODULES_CHECK)
lal_dummy:
echo "abstract project AWS_LAL is" > $(PRJ_DIR)/aws_lal.gpr
echo " for Source_Dirs use ();" >> $(PRJ_DIR)/aws_lal.gpr
echo "end AWS_LAL;" >> $(PRJ_DIR)/aws_lal.gpr
lal_setup:
echo 'with "libadalang";' > $(PRJ_DIR)/aws_lal.gpr
echo "abstract project AWS_LAL is" >> $(PRJ_DIR)/aws_lal.gpr
echo " for Source_Dirs use ();" >> $(PRJ_DIR)/aws_lal.gpr
echo "end AWS_LAL;" >> $(PRJ_DIR)/aws_lal.gpr
gxmlada_dummy:
echo "abstract project AWS_XMLADA is" > $(PRJ_DIR)/aws_xmlada.gpr
echo " for Source_Dirs use ();" >> $(PRJ_DIR)/aws_xmlada.gpr
echo "end AWS_XMLADA;" >> $(PRJ_DIR)/aws_xmlada.gpr
gxmlada_setup:
echo 'with "xmlada";' > $(PRJ_DIR)/aws_xmlada.gpr
echo "abstract project AWS_XMLADA is" >> $(PRJ_DIR)/aws_xmlada.gpr
echo " for Source_Dirs use ();" >> $(PRJ_DIR)/aws_xmlada.gpr
echo "end AWS_XMLADA;" >> $(PRJ_DIR)/aws_xmlada.gpr
setup_dir:
$(MKDIR) -p $(PRJ_DIR)
$(MKDIR) -p $(BLD_DIR)
$(MKDIR) -p $(CMN_DIR)/src
CONFGPR = $(PRJ_DIR)/aws_config.gpr
ifeq (${SOCKET}, ssl)
SOCKET = openssl
endif
SSL_SUFFIX=$(SOCKET)
ifeq (${SOCKET}, std)
SSL_SUFFIX = dummy
endif
setup_config:
echo 'abstract project AWS_Config is' > $(CONFGPR)
echo ' for Source_Dirs use ();' >> $(CONFGPR)
echo >> $(CONFGPR)
echo ' type Boolean_Type is ("true", "false");' >> $(CONFGPR)
echo ' Zlib_Exists : Boolean_Type := "$(ZLIB)";' >> $(CONFGPR)
echo >> $(CONFGPR)
echo ' type SOCKET_Type is ("std", "openssl", "gnutls");' \
>> $(CONFGPR)
echo ' SOCKET : SOCKET_Type := "$(SOCKET)";' >> $(CONFGPR)
echo >> $(CONFGPR)
echo 'end AWS_Config;' >> $(CONFGPR)
# Set up all modules to create all the directories. This way it is possible
# to build AWS using GPS using any settings.
setup_modules: $(MODULES_SETUP)
MSETUP := $(TGT_DIR)/makefile.setup
gen_setup: setup_dir
echo "prefix=$(prefix)" > $(MSETUP)
echo "ENABLE_SHARED=$(ENABLE_SHARED)" >> $(MSETUP)
echo "ZLIB=$(ZLIB)" >> $(MSETUP)
echo "XMLADA=$(XMLADA)" >> $(MSETUP)
echo "LAL=$(LAL)" >> $(MSETUP)
echo "NETLIB=$(NETLIB)" >> $(MSETUP)
echo "SOCKET=$(SOCKET)" >> $(MSETUP)
echo "SSL_DYNAMIC=$(SSL_DYNAMIC)" >> $(MSETUP)
echo "LDAP=$(LDAP)" >> $(MSETUP)
echo "DEBUG=$(DEBUG)" >> $(MSETUP)
echo "PROCESSORS=$(PROCESSORS)" >> $(MSETUP)
echo "TARGET=$(TARGET)" >> $(MSETUP)
echo "PRJ_TARGET=$(PRJ_TARGET)" >> $(MSETUP)
echo "THREAD_SANITIZER=$(THREAD_SANITIZER)" >> $(MSETUP)
echo "GSOAP=false" >> $(MSETUP)
echo "SERVER_HTTP2=$(SERVER_HTTP2)" >> $(MSETUP)
echo "CLIENT_HTTP2=$(CLIENT_HTTP2)" >> $(MSETUP)
setup: gen_setup setup_modules setup_config setup_tp $(GEXT_MODULE)
setup_tp:
$(MAKE) -C templates_parser setup $(GALL_OPTIONS)