]> git.ipfire.org Git - people/ms/libloc.git/blob - Makefile.am
test: Add test to check that invalid signatures do not validate
[people/ms/libloc.git] / Makefile.am
1 EXTRA_DIST =
2 CLEANFILES =
3 INSTALL_DIRS =
4 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
5 AM_MAKEFLAGS = --no-print-directory
6
7 SUBDIRS = . po
8 BINDINGS =
9
10 OS = $(shell uname -s)
11
12 DEBIAN_TARBALL_NAME = $(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.xz
13
14 CLEANFILES += \
15 $(DEBIAN_TARBALL_NAME)
16
17 if ENABLE_PERL
18 BINDINGS += perl
19 endif
20
21 AM_CPPFLAGS = \
22 -include $(top_builddir)/config.h \
23 -DSYSCONFDIR=\""$(sysconfdir)"\" \
24 -I${top_srcdir}/src
25
26 AM_CFLAGS = ${my_CFLAGS} \
27 -ffunction-sections \
28 -fdata-sections
29
30 AM_LDFLAGS =
31
32 # leaving a space here to work around automake's conditionals
33 ifeq ($(OS),Darwin)
34 AM_LDFLAGS += -Wl,-dead_strip
35 else
36 AM_LDFLAGS += \
37 -Wl,--as-needed \
38 -Wl,--gc-sections
39 endif
40
41 LIBLOC_CURRENT=0
42 LIBLOC_REVISION=0
43 LIBLOC_AGE=0
44
45 DISTCHECK_CONFIGURE_FLAGS = \
46 --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
47
48 SED_PROCESS = \
49 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
50 -e 's,@VERSION\@,$(VERSION),g' \
51 -e 's,@prefix\@,$(prefix),g' \
52 -e 's,@exec_prefix\@,$(exec_prefix),g' \
53 -e 's,@bindir\@,$(bindir),g' \
54 -e 's,@libdir\@,$(libdir),g' \
55 -e 's,@includedir\@,$(includedir),g' \
56 -e 's,@databasedir\@,$(databasedir),g' \
57 < $< > $@ || rm $@
58
59 databasedir = $(localstatedir)/lib/location
60 pkgconfigdir = $(libdir)/pkgconfig
61
62 %: %.in Makefile
63 $(SED_PROCESS)
64
65 @INTLTOOL_POLICY_RULE@
66
67 # ------------------------------------------------------------------------------
68
69 AM_V_ASCIIDOC = $(AM_V_ASCIIDOC_$(V))
70 AM_V_ASCIIDOC_ = $(AM_V_ASCIIDOC_$(AM_DEFAULT_VERBOSITY))
71 AM_V_ASCIIDOC_0 = @echo " ASCIIDOC" $@;
72
73 AM_V_XSLT = $(AM_V_XSLT_$(V))
74 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
75 AM_V_XSLT_0 = @echo " XSLT " $@;
76
77 # ------------------------------------------------------------------------------
78
79 .PHONY: update-po
80 update-po:
81 $(MAKE) -C po update-po
82
83 EXTRA_DIST += \
84 examples/private-key.pem \
85 examples/public-key.pem \
86 examples/python/create-database.py \
87 examples/python/read-database.py
88
89 pkginclude_HEADERS = \
90 src/loc/libloc.h \
91 src/loc/as.h \
92 src/loc/compat.h \
93 src/loc/country.h \
94 src/loc/database.h \
95 src/loc/format.h \
96 src/loc/network.h \
97 src/loc/private.h \
98 src/loc/stringpool.h \
99 src/loc/resolv.h \
100 src/loc/writer.h
101
102 lib_LTLIBRARIES = \
103 src/libloc.la
104
105 src_libloc_la_SOURCES = \
106 src/libloc.c \
107 src/as.c \
108 src/country.c \
109 src/database.c \
110 src/network.c \
111 src/resolv.c \
112 src/stringpool.c \
113 src/writer.c
114
115 EXTRA_DIST += src/libloc.sym
116
117 src_libloc_la_CFLAGS = \
118 $(AM_CFLAGS) \
119 -DLIBLOC_PRIVATE \
120 -fvisibility=hidden
121
122 src_libloc_la_LDFLAGS = \
123 $(AM_LDFLAGS) \
124 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE)
125
126 if HAVE_LD_VERSION_SCRIPT
127 src_libloc_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libloc.sym
128 else
129 src_libloc_la_LDFLAGS += -export-symbols $(top_srcdir)/src/libloc.sym
130 endif
131
132 src_libloc_la_LIBADD = \
133 $(OPENSSL_LIBS) \
134 $(RESOLV_LIBS)
135
136 src_libloc_la_DEPENDENCIES = \
137 ${top_srcdir}/src/libloc.sym
138
139 pkgconfig_DATA = \
140 src/libloc.pc
141
142 EXTRA_DIST += \
143 src/libloc.pc.in
144
145 CLEANFILES += \
146 src/libloc.pc
147
148 pyexec_LTLIBRARIES = \
149 src/python/location.la
150
151 src_python_location_la_SOURCES = \
152 src/python/locationmodule.c \
153 src/python/locationmodule.h \
154 src/python/as.c \
155 src/python/as.h \
156 src/python/country.c \
157 src/python/country.h \
158 src/python/database.c \
159 src/python/database.h \
160 src/python/network.c \
161 src/python/network.h \
162 src/python/writer.c \
163 src/python/writer.h
164
165 src_python_location_la_CFLAGS = \
166 $(AM_CFLAGS) \
167 $(PYTHON_CFLAGS)
168
169 src_python_location_la_LDFLAGS = \
170 $(AM_LDFLAGS) \
171 -shared \
172 -module \
173 -avoid-version
174
175 src_python_location_la_LIBADD = \
176 src/libloc.la \
177 $(PYTHON_LIBS)
178
179 # Compile & install bindings
180 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
181 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
182 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
183 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
184 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
185
186 # Perl Bindings
187 EXTRA_DIST += \
188 src/perl/.gitignore \
189 src/perl/Location.xs \
190 src/perl/MANIFEST \
191 src/perl/Makefile.PL \
192 src/perl/lib/Location.pm \
193 src/perl/t/Location.t \
194 src/perl/typemap
195
196 .PHONY: build-perl
197 build-perl:
198 @mkdir -p $(builddir)/src/perl/{lib,t}
199 @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
200 @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
201 @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/
202 @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/
203 @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/
204 @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/
205
206 cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
207 INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
208 cd $(builddir)/src/perl && $(MAKE) LD_RUN_PATH=
209
210 .PHONY: check-perl
211 check-perl: testdata.db
212 cd $(builddir)/src/perl && $(MAKE) LD_LIBRARY_PATH="$(abs_builddir)/src/.libs" test \
213 database="../../$<" keyfile="$(abs_srcdir)/examples/public-key.pem"
214
215 .PHONY: install-perl
216 install-perl:
217 cd $(builddir)/src/perl && $(MAKE) install
218
219 .PHONY: clean-perl
220 clean-perl:
221 cd $(builddir)/src/perl && $(MAKE) distclean
222
223 .PHONY: uninstall-perl
224 uninstall-perl:
225 rm -rvf \
226 $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \
227 $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \
228 $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \
229 $(DESTDIR)/$(prefix)/man/man3/Location.3pm
230
231 bin_SCRIPTS = \
232 src/python/location-downloader \
233 src/python/location-exporter \
234 src/python/location-query
235
236 EXTRA_DIST += \
237 src/python/location-downloader.in \
238 src/python/location-exporter.in \
239 src/python/location-query.in
240
241 CLEANFILES += \
242 src/python/location-downloader \
243 src/python/location-exporter \
244 src/python/location-query
245
246 # ------------------------------------------------------------------------------
247
248 if HAVE_SYSTEMD
249 systemdsystemunit_DATA = \
250 src/systemd/location-downloader.service \
251 src/systemd/location-downloader.timer
252
253 CLEANFILES += \
254 $(systemdsystemunit_DATA)
255
256 INSTALL_DIRS += \
257 $(systemdsystemunitdir)
258 endif
259
260 EXTRA_DIST += \
261 src/systemd/location-downloader.service.in \
262 src/systemd/location-downloader.timer.in
263
264 # ------------------------------------------------------------------------------
265
266 dist_database_DATA = \
267 src/signing-key.pem
268
269 # ------------------------------------------------------------------------------
270
271 TESTS_CFLAGS = \
272 $(AM_CFLAGS) \
273 -DLIBLOC_PRIVATE \
274 -DABS_SRCDIR=\"$(abs_srcdir)\"
275
276 TESTS = \
277 src/test-libloc \
278 src/test-stringpool \
279 src/test-database \
280 src/test-as \
281 src/test-network \
282 src/test-country \
283 src/test-signature
284
285 CLEANFILES += \
286 test.db \
287 testdata.db
288
289 testdata.db: examples/python/create-database.py
290 PYTHONPATH=$(abs_builddir)/src/python/.libs \
291 ABS_SRCDIR="$(abs_srcdir)" \
292 $(PYTHON) $< $@
293
294 check_PROGRAMS = \
295 src/test-libloc \
296 src/test-stringpool \
297 src/test-database \
298 src/test-as \
299 src/test-network \
300 src/test-country \
301 src/test-signature
302
303 src_test_libloc_SOURCES = \
304 src/test-libloc.c
305
306 src_test_libloc_CFLAGS = \
307 $(TESTS_CFLAGS)
308
309 src_test_libloc_LDADD = \
310 src/libloc.la
311
312 src_test_as_SOURCES = \
313 src/test-as.c
314
315 src_test_as_CFLAGS = \
316 $(TESTS_CFLAGS)
317
318 src_test_as_LDADD = \
319 src/libloc.la
320
321 src_test_country_SOURCES = \
322 src/test-country.c
323
324 src_test_country_CFLAGS = \
325 $(TESTS_CFLAGS)
326
327 src_test_country_LDADD = \
328 src/libloc.la
329
330 src_test_network_SOURCES = \
331 src/test-network.c
332
333 src_test_network_CFLAGS = \
334 $(TESTS_CFLAGS)
335
336 src_test_network_LDADD = \
337 src/libloc.la
338
339 src_test_stringpool_SOURCES = \
340 src/test-stringpool.c
341
342 src_test_stringpool_CFLAGS = \
343 $(TESTS_CFLAGS)
344
345 src_test_stringpool_LDADD = \
346 src/libloc.la
347
348 src_test_database_SOURCES = \
349 src/test-database.c
350
351 src_test_database_CFLAGS = \
352 $(TESTS_CFLAGS)
353
354 src_test_database_LDADD = \
355 src/libloc.la
356
357 src_test_signature_SOURCES = \
358 src/test-signature.c
359
360 src_test_signature_CFLAGS = \
361 $(TESTS_CFLAGS)
362
363 src_test_signature_LDADD = \
364 src/libloc.la
365
366 # ------------------------------------------------------------------------------
367
368 MANPAGES = \
369 man/location-downloader.8 \
370 man/location-query.8
371
372 MANPAGES_TXT = $(patsubst %.8,%.txt,$(MANPAGES))
373 MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
374 MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
375
376 .PHONY: man
377 man: $(MANPAGES) $(MANPAGES_HTML)
378
379 if ENABLE_MANPAGES
380 man_MANS = \
381 $(MANPAGES)
382 endif
383
384 CLEANFILES += \
385 $(MANPAGES) \
386 $(MANPAGES_HTML) \
387 $(MANPAGES_XML)
388
389 EXTRA_DIST += \
390 man/asciidoc.conf \
391 $(MANPAGES_TXT)
392
393 XSLTPROC_FLAGS = \
394 --nonet \
395 --stringparam man.output.quietly 1 \
396 --stringparam funcsynopsis.style ansi \
397 --stringparam man.th.extra1.suppress 1 \
398 --stringparam man.authors.section.enabled 1 \
399 --stringparam man.copyright.section.enabled 1
400
401 XSLTPROC_COMMAND_MAN = \
402 $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
403 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
404 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
405
406 # Let XSLT find its source on Mac OS X
407 ifeq ($(OS),Darwin)
408 export XML_CATALOG_FILES = /usr/local/etc/xml/catalog
409 endif
410
411 man/%.xml: man/%.txt man/asciidoc.conf
412 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
413 $(ASCIIDOC) \
414 -f $(abs_srcdir)/man/asciidoc.conf \
415 -d manpage -b docbook -o $@ $<
416
417 man/%.8: man/%.xml
418 $(XSLTPROC_COMMAND_MAN)
419
420 man/%.html: man/%.txt man/asciidoc.conf
421 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
422 $(ASCIIDOC) \
423 -f $(abs_srcdir)/man/asciidoc.conf \
424 -b html5 -a icons -a theme=flask -o $@ $<
425
426 .PHONY: upload-man
427 upload-man: $(MANPAGES_HTML)
428 rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/
429
430 $(DEBIAN_TARBALL_NAME): dist
431 cp -v $(distdir).tar.xz $@
432
433 .PHONY: debian
434 debian: $(DEBIAN_TARBALL_NAME)
435 debuild -i -us -uc -b