forked from stcarrez/ada-util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
349 lines (303 loc) · 11.7 KB
/
Makefile.in
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
344
345
346
347
348
349
## The type of library we want to build. Possible values:
## relocatable
## static
UTIL_LIBRARY_TYPE=static
# You may edit this makefile as long as you keep these original
# target names defined.
MODE=distrib
GNATMAKE=@GNATMAKE@
GNATCLEAN=gnatclean
SVN=svn
INSTALL=@INSTALL@
GPRPATH=util.gpr
UTIL_HTTP_GPRPATH=util_http.gpr
UTIL_HTTP_CURL_GPRPATH=util_http_curl.gpr
UTIL_HTTP_AWS_GPRPATH=util_http_aws.gpr
TESTUTIL_GPRPATH=util_unit.gpr
BUILDS_SHARED=@BUILDS_SHARED@
version=@UTIL_VERSION@
distdir=ada-util-@UTIL_VERSION@
DIST_FILE=ada-util-@UTIL_VERSION@.tar.gz
XML_SRC_DIR=@UTIL_XML_DIR@
ASM_SRC_DIR=@UTIL_ASM_DIR@
OS_SRC_DIR=@UTIL_OS_DIR@
OS_VERSION=@UTIL_OS_VERSION@
AUNIT_SRC_DIR=@UTIL_AUNIT_DIR@
AHVEN_SRC_DIR=@UTIL_AHVEN_DIR@
AHVEN_SRC_OS_DIR=@UTIL_AHVEN_OS_DIR@
HAVE_XML=@UTIL_HAVE_XML@
HAVE_CURL=@UTIL_HAVE_CURL@
HAVE_AWS=@UTIL_HAVE_AWS@
HAVE_VECTOR_MAPPERS=@UTIL_HAVE_VECTOR_MAPPERS@
HAVE_PRJ_DIRECTORIES=@UTIL_HAVE_PRJ_DIRECTORIES@
LN_S=@LN_S@
MKDIR=mkdir
CP=cp
LN=ln -s
CC=@CC@
CFLAGS=@CFLAGS@ @DEFS@
ifeq (${OS},Windows_NT)
LIBEXT=dll
LIBVER=dll
else
LIBEXT=so
LIBVER=so.$(version)
endif
srcdir = .
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
top_builddir = .
# share/ada/adainclude
infix_inc=@ADA_INC_BASE@
# share/ada/adainclude
infix_prj=@ADA_PRJ_BASE@
# lib
infix_lib=@ADA_LIB_BASE@
# lib/ada/adalib
infix_ali=@ADA_ALI_BASE@
includedir=${prefix}/${infix_inc}
projectdir=${prefix}/${infix_prj}
bindir=${prefix}/bin
libdir=${prefix}/${infix_lib}
alidir=${prefix}/${infix_ali}
libname=libada_util
libprefix=$(libname)_
CPUS := @NR_CPUS@
MAKE_ARGS=-XMODE=${MODE} -XUTIL_LIBRARY_TYPE=${UTIL_LIBRARY_TYPE} -XPROCESSORS=$(CPUS)
# The timeout execution time in second for a test case.
# The concurrent fifo test takes arround 120 seconds on some ARM but only 4 seconds on an i7.
# Make this a make configuration variable so that it can be given when launching make.
TEST_TIMEOUT=30
ifeq (${BUILDS_SHARED},yes)
all: static shared
install: install_static install_shared install-info
else
all: static
install: install_static install-info
endif
UTIL_GEN_FILES=src/util-systems-constants.ads
UTIL_GEN_FILES+=src/util-systems-types.ads
ifeq (${HAVE_CURL},yes)
UTIL_GEN_FILES+=src/http/curl/util-http-clients-curl-constants.ads
endif
# Build executables for all mains defined by the project.
build: $(UTIL_GEN_FILES)
$(GNATMAKE) -m -p -P"$(GPRPATH)" $(MAKE_ARGS)
test T${HAVE_CURL} = Tno || $(GNATMAKE) -m -p -P"$(UTIL_HTTP_CURL_GPRPATH)" $(MAKE_ARGS)
test T${HAVE_AWS} = Tno || $(GNATMAKE) -m -p -P"$(UTIL_HTTP_AWS_GPRPATH)" $(MAKE_ARGS)
$(GNATMAKE) -m -p -P"$(TESTUTIL_GPRPATH)" $(MAKE_ARGS)
$(GNATMAKE) -m -p -P"$(UTIL_HTTP_GPRPATH)" $(MAKE_ARGS)
static:
$(MAKE) UTIL_LIBRARY_TYPE=static build
shared:
$(MAKE) UTIL_LIBRARY_TYPE=relocatable build
# Build and run the unit tests
test: build regtests/util-testsuite.adb
$(GNATMAKE) -p -Ptests_proc $(MAKE_ARGS)
$(GNATMAKE) -p -Putil_tests $(MAKE_ARGS)
-bin/util_harness -xml util-aunit.xml -timeout ${TEST_TIMEOUT}
regtests/util-testsuite.adb: regtests/util-testsuite.gpb Makefile
gnatprep -DHAVE_XML=$(HAVE_XML) -DHAVE_CURL=$(HAVE_CURL) \
-DHAVE_AWS=$(HAVE_AWS) -DHAVE_VECTOR_MAPPERS=$(HAVE_VECTOR_MAPPERS) \
-DOS_VERSION='"$(OS_VERSION)"' \
regtests/util-testsuite.gpb $@
# Not intended for manual invocation.
# Invoked if automatic builds are enabled.
# Analyzes only on those sources that have changed.
# Does not build executables.
autobuild:
$(GNATMAKE) -gnatc -c -k -P "$(GPRPATH)"
# Clean the root project of all build products.
clean: clean_test
-rm -rf obj/* $(UTIL_GEN_FILES) bin/utilgen
-rm -rf lib/util
-rm -rf lib/util-curl
-rm -rf lib/util-aws
-rm -rf lib/testutil
-rm -f bin/util_harness bin/util_test_process
# Clean the files produced by the unit tests
clean_test:
rm -f test?.log test.log test-stream.txt test-write.txt util-tests.xml
rm -rf regtests/result
# Clean root project and all imported projects too.
clean_tree:
$(GNATCLEAN) -P "$(GPRPATH)" -r
# Check *all* sources for errors, even those not changed.
# Does not build executables.
analyze:
$(GNATMAKE) -f -gnatc -c -k -P "$(GPRPATH)"
# Clean, then build executables for all mains defined by the project.
rebuild: clean build
# Update src/util.ads with the latest SVN revision number.
version:
gnatprep `svn info | grep '^[UR][eR][Lv]' | sed -e 's,URL: \(.*\),-DURL="\1",' -e 's,Revision: ,-DREVISION=,'` \
src/util.gpb src/util.ads
# Files to package in source distribution
DISTFILES=README LICENSE.txt LICENSE.Ahven NOTICE.txt NEWS CHANGES ChangeLog \
config.guess configure config.sub \
configure.in Makefile.in install-sh \
util.gpr.in util_http.gpr.in config.gpr util_unit.gpr.in tests.gpr tests_proc.gpr samples.gpr \
util_http_aws.gpr.in util_http_curl.gpr.in \
src samples regtests testutil \
distrib support bundles debian
dist:
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
rm -f $(distdir)/distrib/*.gpr
rm -rf $(distdir)/regtests/result
mkdir $(distdir)/bin
mkdir $(distdir)/obj
mkdir $(distdir)/lib
tar --exclude=.svn --exclude=.git --exclude="*~" --exclude="*.o" --exclude="*.ali" \
--exclude="*.log" --exclude="*.a" \
-cvzf $(DIST_FILE) $(distdir)
install_static:
$(MAKE) UTIL_LIBRARY_TYPE=static install_lib
install_shared:
$(MAKE) UTIL_LIBRARY_TYPE=relocatable install_lib
install_lib:
rm -rf ${alidir}/ada-util-curl \
${alidir}/ada-util-aws \
${alidir}/ada-util-unit \
${alidir}/ada-util
$(MKDIR) -p ${includedir}/ada-util
$(MKDIR) -p ${includedir}/ada-util-unit
$(MKDIR) -p ${projectdir}/
${MKDIR} -p ${alidir}/ada-util-unit
${MKDIR} -p ${alidir}/ada-util
${MKDIR} -p ${libdir} ${bindir}
${CP} -p testutil/*.ad[bs] ${includedir}/ada-util-unit
${CP} -p src/*.ad[bs] ${includedir}/ada-util
${CP} -p src/http/*.ad[bs] ${includedir}/ada-util
if test T${XML_SRC_DIR} != T ; then \
${CP} -p ${XML_SRC_DIR}/*.ad[bs] ${includedir}/ada-util ; \
fi
if test T${ASM_SRC_DIR} != T ; then \
${CP} -p ${ASM_SRC_DIR}/*.ad[bs] ${includedir}/ada-util ; \
fi
if test T${OS_SRC_DIR} != T ; then \
${CP} -p ${OS_SRC_DIR}/*.ad[bs] ${includedir}/ada-util ; \
fi
if test T${AUNIT_SRC_DIR} != T ; then \
${CP} -p ${AUNIT_SRC_DIR}/*.ad[bs] ${includedir}/ada-util-unit ; \
fi
if test T${AHVEN_SRC_DIR} != T ; then \
${CP} -p ${AHVEN_SRC_DIR}/*.ad[bs] ${includedir}/ada-util-unit ; \
${CP} -p ${AHVEN_SRC_OS_DIR}/*.ad[bs] ${includedir}/ada-util-unit ; \
fi
test T${HAVE_PRJ_DIRECTORIES} = Tyes || \
sed -e "s,ALI_INSTALL,${alidir},g" \
-e "s,LIB_INSTALL,${libdir},g" \
-e "s,BIN_INSTALL,${bindir},g" \
-e "s,INCLUDE_INSTALL,${includedir},g" \
< distrib/util_config-default.gpr > ${projectdir}/util_config.gpr
test T${HAVE_PRJ_DIRECTORIES} = Tno || \
${CP} distrib/util_config-directories.gpr ${projectdir}/util_config.gpr
sed -e "s,LIBRARY_TYPE,$(UTIL_LIBRARY_TYPE),g" < distrib/util.gpr > ${projectdir}/util.gpr
sed -e "s,LIBRARY_TYPE,$(UTIL_LIBRARY_TYPE),g" < distrib/util_unit.gpr > ${projectdir}/util_unit.gpr
sed -e "s,LIBRARY_TYPE,$(UTIL_LIBRARY_TYPE),g" < distrib/util_http.gpr > ${projectdir}/util_http.gpr
test T${HAVE_CURL} = Tno || \
sed -e "s,LIBRARY_TYPE,$(UTIL_LIBRARY_TYPE),g" \
< distrib/util_http_curl.gpr > ${projectdir}/util_http_curl.gpr
test T${HAVE_AWS} = Tno || \
sed -e "s,LIBRARY_TYPE,$(UTIL_LIBRARY_TYPE),g" \
< distrib/util_http_aws.gpr > ${projectdir}/util_http_aws.gpr
test T${HAVE_CURL} = Tno || \
(${MKDIR} -p ${includedir}/ada-util-curl && \
${MKDIR} -p ${alidir}/ada-util-curl && \
${CP} -p src/http/curl/*.ad[bs] ${includedir}/ada-util-curl && \
${CP} -p lib/util-curl/$(UTIL_LIBRARY_TYPE)/*.ali ${alidir}/ada-util-curl)
test T${HAVE_AWS} = Tno || \
(${MKDIR} -p ${includedir}/ada-util-aws && \
${MKDIR} -p ${alidir}/ada-util-aws && \
${CP} -p src/http/aws/*.ad[bs] ${includedir}/ada-util-aws && \
${CP} -p lib/util-aws/$(UTIL_LIBRARY_TYPE)/*.ali ${alidir}/ada-util-aws)
${CP} -p lib/testutil/$(UTIL_LIBRARY_TYPE)/*.ali ${alidir}/ada-util-unit
${CP} -p lib/util/$(UTIL_LIBRARY_TYPE)/*.ali ${alidir}/ada-util
ifeq ($(UTIL_LIBRARY_TYPE),static)
test T${HAVE_AWS} = Tno || \
${CP} -p lib/util-aws/$(UTIL_LIBRARY_TYPE)/$(libprefix)aws.a ${libdir}/
test T${HAVE_CURL} = Tno || \
${CP} -p lib/util-curl/$(UTIL_LIBRARY_TYPE)/$(libprefix)curl.a ${libdir}/
${CP} -p lib/util/$(UTIL_LIBRARY_TYPE)/$(libname).a ${libdir}/
${CP} -p lib/testutil/$(UTIL_LIBRARY_TYPE)/$(libprefix)unit.a ${libdir}/
else
test T${HAVE_AWS} = Tno || \
${CP} -p lib/util-aws/$(UTIL_LIBRARY_TYPE)/$(libprefix)aws.$(LIBVER) ${libdir}/
test T${HAVE_CURL} = Tno || \
${CP} -p lib/util-curl/$(UTIL_LIBRARY_TYPE)/$(libprefix)curl.$(LIBVER) ${libdir}/
${CP} -p lib/util/$(UTIL_LIBRARY_TYPE)/$(libname).$(LIBVER) ${libdir}/
${CP} -p lib/testutil/$(UTIL_LIBRARY_TYPE)/$(libprefix)unit.$(LIBVER) ${libdir}/
ifneq (${OS},Windows_NT)
cd ${libdir} && \
rm -f $(libname).$(LIBEXT) $(libprefix)unit.$(LIBEXT) && \
rm -f $(libprefix)aws.$(LIBEXT) $(libprefix)curl.$(LIBEXT) && \
${LN} $(libname).$(LIBVER) $(libname).$(LIBEXT) && \
${LN} $(libprefix)unit.$(LIBVER) $(libprefix)unit.$(LIBEXT) && \
(test T${HAVE_AWS} = Tno || \
${LN} $(libprefix)aws.$(LIBVER) $(libprefix)aws.$(LIBEXT)) && \
(test T${HAVE_CURL} = Tno || \
${LN} $(libprefix)curl.$(LIBVER) $(libprefix)curl.$(LIBEXT))
else
${CP} -p lib/util/$(UTIL_LIBRARY_TYPE)/$(libname).$(LIBVER) ${bindir}/
${CP} -p lib/testutil/$(UTIL_LIBRARY_TYPE)/$(libprefix)unit.$(LIBVER) ${bindir}/
endif
endif
install-info:
@echo "Installation directories:"
@echo " Ada source files: ${includedir}"
@echo " ALI files: ${alidir}"
@echo " Libraries: ${libdir}"
@echo " GNAT project: ${projectdir}"
@echo "Environment setup:"
@echo " export ADA_PROJECT_PATH=${projectdir}:$$ADA_PROJECT_PATH"
install-support:
$(MKDIR) -p ${bindir}
${CP} support/*.sh ${bindir}
${CP} support/*.xsl ${bindir}
uninstall:
rm -rf ${includedir}/ada-util ${includedir}/ada-util-unit ${includedir}/ada-util-curl ${includedir}/ada-util-aws
rm -rf ${alidir}/ada-util ${alidir}/ada-util-unit ${alidir}/ada-util-curl ${alidir}/ada-util-aws ${alidir}/ada-util-unit
rm -f ${libdir}/$(libname).a
rm -f ${libdir}/$(libprefix)curl.a ${libdir}/$(libprefix)curl.$(LIBEXT) ${libdir}/$(libprefix)curl.$(LIBEXT).${version}
rm -f ${libdir}/$(libprefix)aws.a ${libdir}/$(libprefix)aws.$(LIBEXT) ${libdir}/$(libprefix)aws.$(LIBEXT).${version}
rm -f ${libdir}/$(libprefix)unit.a ${libdir}/$(libprefix)unit.$(LIBEXT) ${libdir}/$(libprefix)unit.$(LIBEXT).${version}
rm -f ${libdir}/$(libname).so.${version}
rm -f ${libdir}/$(libprefix)unit.so.${version}
rm -f ${projectdir}/util_http_aws.gpr
rm -f ${projectdir}/util_http_curl.gpr
rm -f ${projectdir}/util_http.gpr
rm -f ${projectdir}/util_unit.gpr
rm -f ${projectdir}/util.gpr
# prepare before releasing a new version of the package
# (collect information about changes and SVN repository)
prepare-release:
# ${SVN} update
# ${SVN} info > CHANGES
# ${SVN} log -v > ChangeLog
src/util-systems-constants.ads: bin/utilgen
bin/utilgen > $@
src/util-systems-types.ads: bin/utilgen
bin/utilgen types > $@
src/http/curl/util-http-clients-curl-constants.ads: bin/utilgen
bin/utilgen curl > $@
# Utility for the generation of util-systems-constants.ads
bin/utilgen: support/utilgen.c Makefile
mkdir -p bin
$(CC) -o $@ $(CFLAGS) -g support/utilgen.c