]>
Commit | Line | Data |
---|---|---|
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 | if ENABLE_PERL | |
13 | BINDINGS += perl | |
14 | endif | |
15 | ||
16 | AM_CPPFLAGS = \ | |
17 | -include $(top_builddir)/config.h \ | |
18 | -DSYSCONFDIR=\""$(sysconfdir)"\" \ | |
19 | -I${top_srcdir}/src | |
20 | ||
21 | AM_CFLAGS = ${my_CFLAGS} \ | |
22 | -ffunction-sections \ | |
23 | -fdata-sections | |
24 | ||
25 | AM_LDFLAGS = ${my_LDFLAGS} | |
26 | ||
27 | # leaving a space here to work around automake's conditionals | |
28 | ifeq ($(OS),Darwin) | |
29 | AM_LDFLAGS += -Wl,-dead_strip | |
30 | else | |
31 | AM_LDFLAGS += \ | |
32 | -Wl,--as-needed \ | |
33 | -Wl,--gc-sections | |
34 | endif | |
35 | ||
36 | LIBLOC_CURRENT=1 | |
37 | LIBLOC_REVISION=2 | |
38 | LIBLOC_AGE=0 | |
39 | ||
40 | DISTCHECK_CONFIGURE_FLAGS = \ | |
41 | --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) | |
42 | ||
43 | SED_PROCESS = \ | |
44 | $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ | |
45 | -e 's,@VERSION\@,$(VERSION),g' \ | |
46 | -e 's,@prefix\@,$(prefix),g' \ | |
47 | -e 's,@exec_prefix\@,$(exec_prefix),g' \ | |
48 | -e 's,@bindir\@,$(bindir),g' \ | |
49 | -e 's,@libdir\@,$(libdir),g' \ | |
50 | -e 's,@includedir\@,$(includedir),g' \ | |
51 | -e 's,@databasedir\@,$(databasedir),g' \ | |
52 | < $< > $@ || rm $@ | |
53 | ||
54 | cron_dailydir = $(sysconfdir)/cron.daily | |
55 | databasedir = $(localstatedir)/lib/location | |
56 | pkgconfigdir = $(libdir)/pkgconfig | |
57 | ||
58 | # Overwrite Python path | |
59 | #pkgpythondir = $(pythondir)/location | |
60 | pkgpythondir = /usr/lib/python3/dist-packages/location | |
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: po/POTFILES.in | |
81 | $(MAKE) -C po update-po | |
82 | ||
83 | po/POTFILES.in: Makefile | |
84 | find $(abs_srcdir)/src -type f \( -name '*.in' -o -name '*.py' \) \ | |
85 | \! -exec git check-ignore -q {} \; -print | \ | |
86 | sed -e "s@$(abs_srcdir)/@@g" | LC_ALL=C sort > $@ | |
87 | ||
88 | EXTRA_DIST += \ | |
89 | examples/private-key.pem \ | |
90 | examples/public-key.pem \ | |
91 | examples/python/create-database.py \ | |
92 | examples/python/read-database.py | |
93 | ||
94 | pkginclude_HEADERS = \ | |
95 | src/libloc/libloc.h \ | |
96 | src/libloc/address.h \ | |
97 | src/libloc/as.h \ | |
98 | src/libloc/as-list.h \ | |
99 | src/libloc/compat.h \ | |
100 | src/libloc/country.h \ | |
101 | src/libloc/country-list.h \ | |
102 | src/libloc/database.h \ | |
103 | src/libloc/format.h \ | |
104 | src/libloc/network.h \ | |
105 | src/libloc/network-list.h \ | |
106 | src/libloc/private.h \ | |
107 | src/libloc/stringpool.h \ | |
108 | src/libloc/resolv.h \ | |
109 | src/libloc/writer.h | |
110 | ||
111 | lib_LTLIBRARIES = \ | |
112 | src/libloc.la | |
113 | ||
114 | src_libloc_la_SOURCES = \ | |
115 | src/libloc.c \ | |
116 | src/address.c \ | |
117 | src/as.c \ | |
118 | src/as-list.c \ | |
119 | src/country.c \ | |
120 | src/country-list.c \ | |
121 | src/database.c \ | |
122 | src/network.c \ | |
123 | src/network-list.c \ | |
124 | src/resolv.c \ | |
125 | src/stringpool.c \ | |
126 | src/writer.c | |
127 | ||
128 | EXTRA_DIST += src/libloc.sym | |
129 | ||
130 | src_libloc_la_CFLAGS = \ | |
131 | $(AM_CFLAGS) \ | |
132 | -DLIBLOC_PRIVATE \ | |
133 | -fvisibility=hidden | |
134 | ||
135 | src_libloc_la_LDFLAGS = \ | |
136 | $(AM_LDFLAGS) \ | |
137 | -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE) | |
138 | ||
139 | if HAVE_LD_VERSION_SCRIPT | |
140 | src_libloc_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libloc.sym | |
141 | else | |
142 | src_libloc_la_LDFLAGS += -export-symbols $(top_srcdir)/src/libloc.sym | |
143 | endif | |
144 | ||
145 | src_libloc_la_LIBADD = \ | |
146 | $(OPENSSL_LIBS) \ | |
147 | $(RESOLV_LIBS) | |
148 | ||
149 | src_libloc_la_DEPENDENCIES = \ | |
150 | ${top_srcdir}/src/libloc.sym | |
151 | ||
152 | noinst_LTLIBRARIES = \ | |
153 | src/libloc-internal.la | |
154 | ||
155 | src_libloc_internal_la_SOURCES = \ | |
156 | $(src_libloc_la_SOURCES) | |
157 | ||
158 | src_libloc_internal_la_CFLAGS = \ | |
159 | $(src_libloc_la_CFLAGS) | |
160 | ||
161 | src_libloc_internal_la_LDFLAGS = \ | |
162 | $(filter-out -version-info %,$(src_libloc_la_LDFLAGS)) | |
163 | ||
164 | src_libloc_internal_la_LIBADD = \ | |
165 | $(src_libloc_la_LIBADD) | |
166 | ||
167 | src_libloc_internal_la_DEPENDENCIES = \ | |
168 | $(src_libloc_la_DEPENDENCIES) | |
169 | ||
170 | pkgconfig_DATA = \ | |
171 | src/libloc.pc | |
172 | ||
173 | EXTRA_DIST += \ | |
174 | src/libloc.pc.in | |
175 | ||
176 | CLEANFILES += \ | |
177 | src/libloc.pc | |
178 | ||
179 | dist_pkgpython_PYTHON = \ | |
180 | src/python/location/__init__.py \ | |
181 | src/python/location/database.py \ | |
182 | src/python/location/downloader.py \ | |
183 | src/python/location/export.py \ | |
184 | src/python/location/i18n.py \ | |
185 | src/python/location/importer.py \ | |
186 | src/python/location/logger.py | |
187 | ||
188 | pyexec_LTLIBRARIES = \ | |
189 | src/python/_location.la | |
190 | ||
191 | src_python__location_la_SOURCES = \ | |
192 | src/python/locationmodule.c \ | |
193 | src/python/locationmodule.h \ | |
194 | src/python/as.c \ | |
195 | src/python/as.h \ | |
196 | src/python/country.c \ | |
197 | src/python/country.h \ | |
198 | src/python/database.c \ | |
199 | src/python/database.h \ | |
200 | src/python/network.c \ | |
201 | src/python/network.h \ | |
202 | src/python/writer.c \ | |
203 | src/python/writer.h | |
204 | ||
205 | src_python__location_la_CFLAGS = \ | |
206 | $(AM_CFLAGS) \ | |
207 | $(PYTHON_CFLAGS) | |
208 | ||
209 | src_python__location_la_LDFLAGS = \ | |
210 | $(AM_LDFLAGS) \ | |
211 | -shared \ | |
212 | -module \ | |
213 | -avoid-version | |
214 | ||
215 | src_python__location_la_LIBADD = \ | |
216 | src/libloc.la \ | |
217 | $(PYTHON_LIBS) | |
218 | ||
219 | # Compile & install bindings | |
220 | all-local: $(foreach binding,$(BINDINGS),build-$(binding)) | |
221 | check-local: $(foreach binding,$(BINDINGS),check-$(binding)) | |
222 | install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding)) | |
223 | clean-local: $(foreach binding,$(BINDINGS),clean-$(binding)) | |
224 | uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding)) | |
225 | ||
226 | # Perl Bindings | |
227 | EXTRA_DIST += \ | |
228 | src/perl/.gitignore \ | |
229 | src/perl/Location.xs \ | |
230 | src/perl/MANIFEST \ | |
231 | src/perl/Makefile.PL \ | |
232 | src/perl/lib/Location.pm \ | |
233 | src/perl/t/Location.t \ | |
234 | src/perl/typemap | |
235 | ||
236 | .PHONY: build-perl | |
237 | build-perl: | |
238 | @mkdir -p $(builddir)/src/perl/{lib,t} | |
239 | @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/ | |
240 | @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/ | |
241 | @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/ | |
242 | @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/ | |
243 | @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/ | |
244 | @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/ | |
245 | ||
246 | cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \ | |
247 | INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc" | |
248 | cd $(builddir)/src/perl && $(MAKE) LD_RUN_PATH= | |
249 | ||
250 | .PHONY: check-perl | |
251 | check-perl: testdata.db | |
252 | cd $(builddir)/src/perl && $(MAKE) LD_LIBRARY_PATH="$(abs_builddir)/src/.libs" test \ | |
253 | database="../../$<" keyfile="$(abs_srcdir)/examples/public-key.pem" | |
254 | ||
255 | .PHONY: install-perl | |
256 | install-perl: | |
257 | cd $(builddir)/src/perl && $(MAKE) install DESTIDR=$(DESTDIR) | |
258 | ||
259 | .PHONY: clean-perl | |
260 | clean-perl: | |
261 | cd $(builddir)/src/perl && $(MAKE) distclean | |
262 | ||
263 | .PHONY: uninstall-perl | |
264 | uninstall-perl: | |
265 | rm -rvf \ | |
266 | $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \ | |
267 | $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \ | |
268 | $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \ | |
269 | $(DESTDIR)/$(prefix)/man/man3/Location.3pm | |
270 | ||
271 | bin_SCRIPTS = \ | |
272 | src/scripts/location \ | |
273 | src/scripts/location-importer | |
274 | ||
275 | EXTRA_DIST += \ | |
276 | src/scripts/location.in \ | |
277 | src/scripts/location-importer.in | |
278 | ||
279 | CLEANFILES += \ | |
280 | src/scripts/location \ | |
281 | src/scripts/location-importer | |
282 | ||
283 | # ------------------------------------------------------------------------------ | |
284 | ||
285 | # Use systemd timers if available | |
286 | if HAVE_SYSTEMD | |
287 | systemdsystemunit_DATA = \ | |
288 | src/systemd/location-update.service \ | |
289 | src/systemd/location-update.timer | |
290 | ||
291 | CLEANFILES += \ | |
292 | $(systemdsystemunit_DATA) | |
293 | ||
294 | INSTALL_DIRS += \ | |
295 | $(systemdsystemunitdir) | |
296 | ||
297 | # Otherwise fall back to cron | |
298 | else | |
299 | cron_daily_SCRIPTS = \ | |
300 | src/cron/location-update | |
301 | ||
302 | CLEANFILES += \ | |
303 | $(cron_daily_DATA) | |
304 | endif | |
305 | ||
306 | EXTRA_DIST += \ | |
307 | src/cron/location-update.in \ | |
308 | src/systemd/location-update.service.in \ | |
309 | src/systemd/location-update.timer.in | |
310 | ||
311 | # ------------------------------------------------------------------------------ | |
312 | ||
313 | dist_database_DATA = \ | |
314 | src/signing-key.pem | |
315 | ||
316 | # ------------------------------------------------------------------------------ | |
317 | ||
318 | TESTS_CFLAGS = \ | |
319 | $(AM_CFLAGS) \ | |
320 | -DLIBLOC_PRIVATE \ | |
321 | -DABS_SRCDIR=\"$(abs_srcdir)\" | |
322 | ||
323 | TESTS_LDADD = \ | |
324 | src/libloc.la \ | |
325 | src/libloc-internal.la | |
326 | ||
327 | TESTS_ENVIRONMENT = \ | |
328 | PYTHONPATH=$(abs_srcdir)/src/python:$(abs_builddir)/src/python/.libs \ | |
329 | TEST_DATA_DIR="$(abs_top_srcdir)/tests/data" | |
330 | ||
331 | TESTS = \ | |
332 | $(check_PROGRAMS) \ | |
333 | $(dist_check_SCRIPTS) | |
334 | ||
335 | EXTRA_DIST += \ | |
336 | tests/data/location-2022-03-30.db \ | |
337 | tests/data/signing-key.pem | |
338 | ||
339 | CLEANFILES += \ | |
340 | testdata.db | |
341 | ||
342 | testdata.db: examples/python/create-database.py | |
343 | PYTHONPATH=$(abs_srcdir)/src/python:$(abs_builddir)/src/python/.libs \ | |
344 | ABS_SRCDIR="$(abs_srcdir)" \ | |
345 | $(PYTHON) $< $@ | |
346 | ||
347 | dist_check_SCRIPTS = \ | |
348 | tests/python/test-database.py \ | |
349 | tests/python/test-export.py | |
350 | ||
351 | check_PROGRAMS = \ | |
352 | src/test-libloc \ | |
353 | src/test-stringpool \ | |
354 | src/test-database \ | |
355 | src/test-as \ | |
356 | src/test-network \ | |
357 | src/test-network-list \ | |
358 | src/test-country \ | |
359 | src/test-signature \ | |
360 | src/test-address | |
361 | ||
362 | src_test_libloc_SOURCES = \ | |
363 | src/test-libloc.c | |
364 | ||
365 | src_test_libloc_CFLAGS = \ | |
366 | $(TESTS_CFLAGS) | |
367 | ||
368 | src_test_libloc_LDADD = \ | |
369 | $(TESTS_LDADD) | |
370 | ||
371 | src_test_as_SOURCES = \ | |
372 | src/test-as.c | |
373 | ||
374 | src_test_as_CFLAGS = \ | |
375 | $(TESTS_CFLAGS) | |
376 | ||
377 | src_test_as_LDADD = \ | |
378 | $(TESTS_LDADD) | |
379 | ||
380 | src_test_country_SOURCES = \ | |
381 | src/test-country.c | |
382 | ||
383 | src_test_country_CFLAGS = \ | |
384 | $(TESTS_CFLAGS) | |
385 | ||
386 | src_test_country_LDADD = \ | |
387 | $(TESTS_LDADD) | |
388 | ||
389 | src_test_network_SOURCES = \ | |
390 | src/test-network.c | |
391 | ||
392 | src_test_network_CFLAGS = \ | |
393 | $(TESTS_CFLAGS) | |
394 | ||
395 | src_test_network_LDADD = \ | |
396 | $(TESTS_LDADD) | |
397 | ||
398 | src_test_network_list_SOURCES = \ | |
399 | src/test-network-list.c | |
400 | ||
401 | src_test_network_list_CFLAGS = \ | |
402 | $(TESTS_CFLAGS) | |
403 | ||
404 | src_test_network_list_LDADD = \ | |
405 | $(TESTS_LDADD) | |
406 | ||
407 | src_test_stringpool_SOURCES = \ | |
408 | src/test-stringpool.c | |
409 | ||
410 | src_test_stringpool_CFLAGS = \ | |
411 | $(TESTS_CFLAGS) | |
412 | ||
413 | src_test_stringpool_LDADD = \ | |
414 | $(TESTS_LDADD) | |
415 | ||
416 | src_test_database_SOURCES = \ | |
417 | src/test-database.c | |
418 | ||
419 | src_test_database_CFLAGS = \ | |
420 | $(TESTS_CFLAGS) | |
421 | ||
422 | src_test_database_LDADD = \ | |
423 | $(TESTS_LDADD) | |
424 | ||
425 | src_test_signature_SOURCES = \ | |
426 | src/test-signature.c | |
427 | ||
428 | src_test_signature_CFLAGS = \ | |
429 | $(TESTS_CFLAGS) | |
430 | ||
431 | src_test_signature_LDADD = \ | |
432 | $(TESTS_LDADD) | |
433 | ||
434 | src_test_address_SOURCES = \ | |
435 | src/test-address.c | |
436 | ||
437 | src_test_address_CFLAGS = \ | |
438 | $(TESTS_CFLAGS) | |
439 | ||
440 | src_test_address_LDADD = \ | |
441 | $(TESTS_LDADD) | |
442 | ||
443 | # ------------------------------------------------------------------------------ | |
444 | ||
445 | MANPAGES = \ | |
446 | $(MANPAGES_3) \ | |
447 | $(MANPAGES_8) | |
448 | ||
449 | MANPAGES_3 = \ | |
450 | man/libloc.3 \ | |
451 | man/loc_database_count_as.3 \ | |
452 | man/loc_database_get_as.3 \ | |
453 | man/loc_database_get_country.3 \ | |
454 | man/loc_database_lookup.3 \ | |
455 | man/loc_database_new.3 \ | |
456 | man/loc_get_log_priority.3 \ | |
457 | man/loc_new.3 \ | |
458 | man/loc_set_log_fn.3 \ | |
459 | man/loc_set_log_priority.3 | |
460 | ||
461 | MANPAGES_8 = \ | |
462 | man/location.8 | |
463 | ||
464 | MANPAGES_TXT = $(MANPAGES_TXT_3) $(MANPAGES_TXT_8) | |
465 | MANPAGES_TXT_3 = $(patsubst %.3,%.txt,$(MANPAGES_3)) | |
466 | MANPAGES_TXT_8 = $(patsubst %.8,%.txt,$(MANPAGES_8)) | |
467 | MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT)) | |
468 | MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT)) | |
469 | ||
470 | .PHONY: man | |
471 | man: $(MANPAGES) $(MANPAGES_HTML) | |
472 | ||
473 | if ENABLE_MAN_PAGES | |
474 | man_MANS = \ | |
475 | $(MANPAGES) | |
476 | endif | |
477 | ||
478 | CLEANFILES += \ | |
479 | $(MANPAGES) \ | |
480 | $(MANPAGES_HTML) \ | |
481 | $(MANPAGES_XML) | |
482 | ||
483 | EXTRA_DIST += \ | |
484 | man/asciidoc.conf \ | |
485 | $(MANPAGES_TXT) | |
486 | ||
487 | XSLTPROC_FLAGS = \ | |
488 | --nonet \ | |
489 | --stringparam man.output.quietly 1 \ | |
490 | --stringparam funcsynopsis.style ansi \ | |
491 | --stringparam man.th.extra1.suppress 1 \ | |
492 | --stringparam man.authors.section.enabled 1 \ | |
493 | --stringparam man.copyright.section.enabled 1 | |
494 | ||
495 | XSLTPROC_COMMAND_MAN = \ | |
496 | $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \ | |
497 | $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \ | |
498 | http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< | |
499 | ||
500 | # Let XSLT find its source on Mac OS X | |
501 | ifeq ($(OS),Darwin) | |
502 | export XML_CATALOG_FILES = /usr/local/etc/xml/catalog | |
503 | endif | |
504 | ||
505 | man/%.xml: man/%.txt man/asciidoc.conf | |
506 | $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \ | |
507 | $(ASCIIDOC) \ | |
508 | -f $(abs_srcdir)/man/asciidoc.conf \ | |
509 | -d manpage -b docbook -o $@ $< | |
510 | ||
511 | man/%.3: man/%.xml | |
512 | $(XSLTPROC_COMMAND_MAN) | |
513 | ||
514 | man/%.8: man/%.xml | |
515 | $(XSLTPROC_COMMAND_MAN) | |
516 | ||
517 | man/%.html: man/%.txt man/asciidoc.conf | |
518 | $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \ | |
519 | $(ASCIIDOC) \ | |
520 | -f $(abs_srcdir)/man/asciidoc.conf \ | |
521 | -b html5 -a icons -a theme=flask -o $@ $< | |
522 | ||
523 | .PHONY: upload-man | |
524 | upload-man: $(MANPAGES_HTML) | |
525 | rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/ | |
526 | ||
527 | EXTRA_DIST += \ | |
528 | debian/build.sh \ | |
529 | debian/changelog \ | |
530 | debian/control \ | |
531 | debian/copyright \ | |
532 | debian/genchangelog.sh \ | |
533 | debian/gensymbols.sh \ | |
534 | debian/libloc1.install \ | |
535 | debian/libloc1.symbols \ | |
536 | debian/libloc-dev.install \ | |
537 | debian/location.install \ | |
538 | debian/location.postinst \ | |
539 | debian/location.postrm \ | |
540 | debian/python3-location.examples \ | |
541 | debian/python3-location.install \ | |
542 | debian/rules \ | |
543 | debian/source/format \ | |
544 | debian/watch | |
545 | ||
546 | .PHONY: debian | |
547 | debian: dist | |
548 | $(SHELL) debian/build.sh $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(distdir).tar.xz |