]> git.ipfire.org Git - people/ms/libloc.git/blob - Makefile.am
Implement filtering for multiple countries in the enumerator
[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 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 =
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=0
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 databasedir = $(localstatedir)/lib/location
55 pkgconfigdir = $(libdir)/pkgconfig
56
57 # Overwrite Python path
58 pkgpythondir = $(pythondir)/location
59
60 %: %.in Makefile
61 $(SED_PROCESS)
62
63 @INTLTOOL_POLICY_RULE@
64
65 # ------------------------------------------------------------------------------
66
67 AM_V_ASCIIDOC = $(AM_V_ASCIIDOC_$(V))
68 AM_V_ASCIIDOC_ = $(AM_V_ASCIIDOC_$(AM_DEFAULT_VERBOSITY))
69 AM_V_ASCIIDOC_0 = @echo " ASCIIDOC" $@;
70
71 AM_V_XSLT = $(AM_V_XSLT_$(V))
72 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
73 AM_V_XSLT_0 = @echo " XSLT " $@;
74
75 # ------------------------------------------------------------------------------
76
77 .PHONY: update-po
78 update-po: po/POTFILES.in
79 $(MAKE) -C po update-po
80
81 po/POTFILES.in: Makefile
82 find $(abs_srcdir)/src | \
83 grep -E "\.(in|py)$$" | sed -e "s@$(abs_srcdir)/@@g" | sort > $@
84
85 EXTRA_DIST += \
86 examples/private-key.pem \
87 examples/public-key.pem \
88 examples/python/create-database.py \
89 examples/python/read-database.py
90
91 pkginclude_HEADERS = \
92 src/loc/libloc.h \
93 src/loc/as.h \
94 src/loc/compat.h \
95 src/loc/country.h \
96 src/loc/country-list.h \
97 src/loc/database.h \
98 src/loc/format.h \
99 src/loc/network.h \
100 src/loc/network-list.h \
101 src/loc/private.h \
102 src/loc/stringpool.h \
103 src/loc/resolv.h \
104 src/loc/writer.h
105
106 lib_LTLIBRARIES = \
107 src/libloc.la
108
109 src_libloc_la_SOURCES = \
110 src/libloc.c \
111 src/as.c \
112 src/country.c \
113 src/country-list.c \
114 src/database.c \
115 src/network.c \
116 src/network-list.c \
117 src/resolv.c \
118 src/stringpool.c \
119 src/writer.c
120
121 EXTRA_DIST += src/libloc.sym
122
123 src_libloc_la_CFLAGS = \
124 $(AM_CFLAGS) \
125 -DLIBLOC_PRIVATE \
126 -fvisibility=hidden
127
128 src_libloc_la_LDFLAGS = \
129 $(AM_LDFLAGS) \
130 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE)
131
132 if HAVE_LD_VERSION_SCRIPT
133 src_libloc_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libloc.sym
134 else
135 src_libloc_la_LDFLAGS += -export-symbols $(top_srcdir)/src/libloc.sym
136 endif
137
138 src_libloc_la_LIBADD = \
139 $(OPENSSL_LIBS) \
140 $(RESOLV_LIBS)
141
142 src_libloc_la_DEPENDENCIES = \
143 ${top_srcdir}/src/libloc.sym
144
145 pkgconfig_DATA = \
146 src/libloc.pc
147
148 EXTRA_DIST += \
149 src/libloc.pc.in
150
151 CLEANFILES += \
152 src/libloc.pc
153
154 dist_pkgpython_PYTHON = \
155 src/python/database.py \
156 src/python/downloader.py \
157 src/python/export.py \
158 src/python/i18n.py \
159 src/python/importer.py \
160 src/python/logger.py
161
162 pkgpython_PYTHON = \
163 src/python/__init__.py
164
165 EXTRA_DIST += \
166 src/python/__init__.py.in
167
168 CLEANFILES += \
169 src/python/__init__.py
170
171 pyexec_LTLIBRARIES = \
172 src/python/_location.la
173
174 src_python__location_la_SOURCES = \
175 src/python/locationmodule.c \
176 src/python/locationmodule.h \
177 src/python/as.c \
178 src/python/as.h \
179 src/python/country.c \
180 src/python/country.h \
181 src/python/database.c \
182 src/python/database.h \
183 src/python/network.c \
184 src/python/network.h \
185 src/python/writer.c \
186 src/python/writer.h
187
188 src_python__location_la_CFLAGS = \
189 $(AM_CFLAGS) \
190 $(PYTHON_CFLAGS)
191
192 src_python__location_la_LDFLAGS = \
193 $(AM_LDFLAGS) \
194 -shared \
195 -module \
196 -avoid-version
197
198 src_python__location_la_LIBADD = \
199 src/libloc.la \
200 $(PYTHON_LIBS)
201
202 # Compile & install bindings
203 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
204 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
205 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
206 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
207 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
208
209 # Perl Bindings
210 EXTRA_DIST += \
211 src/perl/.gitignore \
212 src/perl/Location.xs \
213 src/perl/MANIFEST \
214 src/perl/Makefile.PL \
215 src/perl/lib/Location.pm \
216 src/perl/t/Location.t \
217 src/perl/typemap
218
219 .PHONY: build-perl
220 build-perl:
221 @mkdir -p $(builddir)/src/perl/{lib,t}
222 @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
223 @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
224 @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/
225 @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/
226 @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/
227 @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/
228
229 cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
230 INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
231 cd $(builddir)/src/perl && $(MAKE) CC="$(CC)" LD="$(LD)" LD_RUN_PATH=
232
233 .PHONY: check-perl
234 check-perl: testdata.db
235 cd $(builddir)/src/perl && $(MAKE) LD_LIBRARY_PATH="$(abs_builddir)/src/.libs" test \
236 database="../../$<" keyfile="$(abs_srcdir)/examples/public-key.pem"
237
238 .PHONY: install-perl
239 install-perl:
240 cd $(builddir)/src/perl && $(MAKE) install
241
242 .PHONY: clean-perl
243 clean-perl:
244 cd $(builddir)/src/perl && $(MAKE) distclean
245
246 .PHONY: uninstall-perl
247 uninstall-perl:
248 rm -rvf \
249 $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \
250 $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \
251 $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \
252 $(DESTDIR)/$(prefix)/man/man3/Location.3pm
253
254 bin_SCRIPTS = \
255 src/python/location \
256 src/python/location-importer
257
258 EXTRA_DIST += \
259 src/python/location.in \
260 src/python/location-importer.in
261
262 CLEANFILES += \
263 src/python/location \
264 src/python/location-importer
265
266 # ------------------------------------------------------------------------------
267
268 if HAVE_SYSTEMD
269 systemdsystemunit_DATA = \
270 src/systemd/location-update.service \
271 src/systemd/location-update.timer
272
273 CLEANFILES += \
274 $(systemdsystemunit_DATA)
275
276 INSTALL_DIRS += \
277 $(systemdsystemunitdir)
278 endif
279
280 EXTRA_DIST += \
281 src/systemd/location-update.service.in \
282 src/systemd/location-update.timer.in
283
284 # ------------------------------------------------------------------------------
285
286 dist_database_DATA = \
287 src/signing-key.pem
288
289 # ------------------------------------------------------------------------------
290
291 TESTS_CFLAGS = \
292 $(AM_CFLAGS) \
293 -DLIBLOC_PRIVATE \
294 -DABS_SRCDIR=\"$(abs_srcdir)\"
295
296 TESTS = \
297 src/test-libloc \
298 src/test-stringpool \
299 src/test-database \
300 src/test-as \
301 src/test-network \
302 src/test-country \
303 src/test-signature
304
305 CLEANFILES += \
306 testdata.db
307
308 testdata.db: examples/python/create-database.py
309 PYTHONPATH=$(abs_builddir)/src/python/.libs \
310 ABS_SRCDIR="$(abs_srcdir)" \
311 $(PYTHON) $< $@
312
313 check_PROGRAMS = \
314 src/test-libloc \
315 src/test-stringpool \
316 src/test-database \
317 src/test-as \
318 src/test-network \
319 src/test-country \
320 src/test-signature
321
322 src_test_libloc_SOURCES = \
323 src/test-libloc.c
324
325 src_test_libloc_CFLAGS = \
326 $(TESTS_CFLAGS)
327
328 src_test_libloc_LDADD = \
329 src/libloc.la
330
331 src_test_as_SOURCES = \
332 src/test-as.c
333
334 src_test_as_CFLAGS = \
335 $(TESTS_CFLAGS)
336
337 src_test_as_LDADD = \
338 src/libloc.la
339
340 src_test_country_SOURCES = \
341 src/test-country.c
342
343 src_test_country_CFLAGS = \
344 $(TESTS_CFLAGS)
345
346 src_test_country_LDADD = \
347 src/libloc.la
348
349 src_test_network_SOURCES = \
350 src/test-network.c
351
352 src_test_network_CFLAGS = \
353 $(TESTS_CFLAGS)
354
355 src_test_network_LDADD = \
356 src/libloc.la
357
358 src_test_stringpool_SOURCES = \
359 src/test-stringpool.c
360
361 src_test_stringpool_CFLAGS = \
362 $(TESTS_CFLAGS)
363
364 src_test_stringpool_LDADD = \
365 src/libloc.la
366
367 src_test_database_SOURCES = \
368 src/test-database.c
369
370 src_test_database_CFLAGS = \
371 $(TESTS_CFLAGS)
372
373 src_test_database_LDADD = \
374 src/libloc.la
375
376 src_test_signature_SOURCES = \
377 src/test-signature.c
378
379 src_test_signature_CFLAGS = \
380 $(TESTS_CFLAGS)
381
382 src_test_signature_LDADD = \
383 src/libloc.la
384
385 # ------------------------------------------------------------------------------
386
387 MANPAGES = \
388 man/location.8
389
390 MANPAGES_TXT = $(patsubst %.8,%.txt,$(MANPAGES))
391 MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
392 MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
393
394 .PHONY: man
395 man: $(MANPAGES) $(MANPAGES_HTML)
396
397 if ENABLE_MANPAGES
398 man_MANS = \
399 $(MANPAGES)
400 endif
401
402 CLEANFILES += \
403 $(MANPAGES) \
404 $(MANPAGES_HTML) \
405 $(MANPAGES_XML)
406
407 EXTRA_DIST += \
408 man/asciidoc.conf \
409 $(MANPAGES_TXT)
410
411 XSLTPROC_FLAGS = \
412 --nonet \
413 --stringparam man.output.quietly 1 \
414 --stringparam funcsynopsis.style ansi \
415 --stringparam man.th.extra1.suppress 1 \
416 --stringparam man.authors.section.enabled 1 \
417 --stringparam man.copyright.section.enabled 1
418
419 XSLTPROC_COMMAND_MAN = \
420 $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
421 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
422 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
423
424 # Let XSLT find its source on Mac OS X
425 ifeq ($(OS),Darwin)
426 export XML_CATALOG_FILES = /usr/local/etc/xml/catalog
427 endif
428
429 man/%.xml: man/%.txt man/asciidoc.conf
430 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
431 $(ASCIIDOC) \
432 -f $(abs_srcdir)/man/asciidoc.conf \
433 -d manpage -b docbook -o $@ $<
434
435 man/%.8: man/%.xml
436 $(XSLTPROC_COMMAND_MAN)
437
438 man/%.html: man/%.txt man/asciidoc.conf
439 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
440 $(ASCIIDOC) \
441 -f $(abs_srcdir)/man/asciidoc.conf \
442 -b html5 -a icons -a theme=flask -o $@ $<
443
444 .PHONY: upload-man
445 upload-man: $(MANPAGES_HTML)
446 rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/
447
448 EXTRA_DIST += \
449 debian/build.sh \
450 debian/changelog \
451 debian/compat \
452 debian/control \
453 debian/copyright \
454 debian/location.install \
455 debian/location.manpages \
456 debian/location-python.install \
457 debian/libloc1.install \
458 debian/libloc-dev.install \
459 debian/rules \
460 debian/source/format
461
462 .PHONY: debian
463 debian: dist
464 $(SHELL) debian/build.sh $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(distdir).tar.xz