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