]> git.ipfire.org Git - location/libloc.git/blob - Makefile.am
location.in: do not confuse UTC with local time zones
[location/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/database.h \
97 src/loc/format.h \
98 src/loc/network.h \
99 src/loc/private.h \
100 src/loc/stringpool.h \
101 src/loc/resolv.h \
102 src/loc/writer.h
103
104 lib_LTLIBRARIES = \
105 src/libloc.la
106
107 src_libloc_la_SOURCES = \
108 src/libloc.c \
109 src/as.c \
110 src/country.c \
111 src/database.c \
112 src/network.c \
113 src/resolv.c \
114 src/stringpool.c \
115 src/writer.c
116
117 EXTRA_DIST += src/libloc.sym
118
119 src_libloc_la_CFLAGS = \
120 $(AM_CFLAGS) \
121 -DLIBLOC_PRIVATE \
122 -fvisibility=hidden
123
124 src_libloc_la_LDFLAGS = \
125 $(AM_LDFLAGS) \
126 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE)
127
128 if HAVE_LD_VERSION_SCRIPT
129 src_libloc_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libloc.sym
130 else
131 src_libloc_la_LDFLAGS += -export-symbols $(top_srcdir)/src/libloc.sym
132 endif
133
134 src_libloc_la_LIBADD = \
135 $(OPENSSL_LIBS) \
136 $(RESOLV_LIBS)
137
138 src_libloc_la_DEPENDENCIES = \
139 ${top_srcdir}/src/libloc.sym
140
141 pkgconfig_DATA = \
142 src/libloc.pc
143
144 EXTRA_DIST += \
145 src/libloc.pc.in
146
147 CLEANFILES += \
148 src/libloc.pc
149
150 dist_pkgpython_PYTHON = \
151 src/python/database.py \
152 src/python/downloader.py \
153 src/python/export.py \
154 src/python/i18n.py \
155 src/python/importer.py \
156 src/python/logger.py
157
158 pkgpython_PYTHON = \
159 src/python/__init__.py
160
161 EXTRA_DIST += \
162 src/python/__init__.py.in
163
164 CLEANFILES += \
165 src/python/__init__.py
166
167 pyexec_LTLIBRARIES = \
168 src/python/_location.la
169
170 src_python__location_la_SOURCES = \
171 src/python/locationmodule.c \
172 src/python/locationmodule.h \
173 src/python/as.c \
174 src/python/as.h \
175 src/python/country.c \
176 src/python/country.h \
177 src/python/database.c \
178 src/python/database.h \
179 src/python/network.c \
180 src/python/network.h \
181 src/python/writer.c \
182 src/python/writer.h
183
184 src_python__location_la_CFLAGS = \
185 $(AM_CFLAGS) \
186 $(PYTHON_CFLAGS)
187
188 src_python__location_la_LDFLAGS = \
189 $(AM_LDFLAGS) \
190 -shared \
191 -module \
192 -avoid-version
193
194 src_python__location_la_LIBADD = \
195 src/libloc.la \
196 $(PYTHON_LIBS)
197
198 # Compile & install bindings
199 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
200 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
201 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
202 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
203 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
204
205 # Perl Bindings
206 EXTRA_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
216 build-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"
227 cd $(builddir)/src/perl && $(MAKE) CC="$(CC)" LD="$(LD)" LD_RUN_PATH=
228
229 .PHONY: check-perl
230 check-perl: testdata.db
231 cd $(builddir)/src/perl && $(MAKE) LD_LIBRARY_PATH="$(abs_builddir)/src/.libs" test \
232 database="../../$<" keyfile="$(abs_srcdir)/examples/public-key.pem"
233
234 .PHONY: install-perl
235 install-perl:
236 cd $(builddir)/src/perl && $(MAKE) install
237
238 .PHONY: clean-perl
239 clean-perl:
240 cd $(builddir)/src/perl && $(MAKE) distclean
241
242 .PHONY: uninstall-perl
243 uninstall-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
250 bin_SCRIPTS = \
251 src/python/location \
252 src/python/location-importer
253
254 EXTRA_DIST += \
255 src/python/location.in \
256 src/python/location-importer.in
257
258 CLEANFILES += \
259 src/python/location \
260 src/python/location-importer
261
262 # ------------------------------------------------------------------------------
263
264 if HAVE_SYSTEMD
265 systemdsystemunit_DATA = \
266 src/systemd/location-update.service \
267 src/systemd/location-update.timer
268
269 CLEANFILES += \
270 $(systemdsystemunit_DATA)
271
272 INSTALL_DIRS += \
273 $(systemdsystemunitdir)
274 endif
275
276 EXTRA_DIST += \
277 src/systemd/location-update.service.in \
278 src/systemd/location-update.timer.in
279
280 # ------------------------------------------------------------------------------
281
282 dist_database_DATA = \
283 src/signing-key.pem
284
285 # ------------------------------------------------------------------------------
286
287 TESTS_CFLAGS = \
288 $(AM_CFLAGS) \
289 -DLIBLOC_PRIVATE \
290 -DABS_SRCDIR=\"$(abs_srcdir)\"
291
292 TESTS = \
293 src/test-libloc \
294 src/test-stringpool \
295 src/test-database \
296 src/test-as \
297 src/test-network \
298 src/test-country \
299 src/test-signature
300
301 CLEANFILES += \
302 testdata.db
303
304 testdata.db: examples/python/create-database.py
305 PYTHONPATH=$(abs_builddir)/src/python/.libs \
306 ABS_SRCDIR="$(abs_srcdir)" \
307 $(PYTHON) $< $@
308
309 check_PROGRAMS = \
310 src/test-libloc \
311 src/test-stringpool \
312 src/test-database \
313 src/test-as \
314 src/test-network \
315 src/test-country \
316 src/test-signature
317
318 src_test_libloc_SOURCES = \
319 src/test-libloc.c
320
321 src_test_libloc_CFLAGS = \
322 $(TESTS_CFLAGS)
323
324 src_test_libloc_LDADD = \
325 src/libloc.la
326
327 src_test_as_SOURCES = \
328 src/test-as.c
329
330 src_test_as_CFLAGS = \
331 $(TESTS_CFLAGS)
332
333 src_test_as_LDADD = \
334 src/libloc.la
335
336 src_test_country_SOURCES = \
337 src/test-country.c
338
339 src_test_country_CFLAGS = \
340 $(TESTS_CFLAGS)
341
342 src_test_country_LDADD = \
343 src/libloc.la
344
345 src_test_network_SOURCES = \
346 src/test-network.c
347
348 src_test_network_CFLAGS = \
349 $(TESTS_CFLAGS)
350
351 src_test_network_LDADD = \
352 src/libloc.la
353
354 src_test_stringpool_SOURCES = \
355 src/test-stringpool.c
356
357 src_test_stringpool_CFLAGS = \
358 $(TESTS_CFLAGS)
359
360 src_test_stringpool_LDADD = \
361 src/libloc.la
362
363 src_test_database_SOURCES = \
364 src/test-database.c
365
366 src_test_database_CFLAGS = \
367 $(TESTS_CFLAGS)
368
369 src_test_database_LDADD = \
370 src/libloc.la
371
372 src_test_signature_SOURCES = \
373 src/test-signature.c
374
375 src_test_signature_CFLAGS = \
376 $(TESTS_CFLAGS)
377
378 src_test_signature_LDADD = \
379 src/libloc.la
380
381 # ------------------------------------------------------------------------------
382
383 MANPAGES = \
384 man/location.8
385
386 MANPAGES_TXT = $(patsubst %.8,%.txt,$(MANPAGES))
387 MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
388 MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
389
390 .PHONY: man
391 man: $(MANPAGES) $(MANPAGES_HTML)
392
393 if ENABLE_MANPAGES
394 man_MANS = \
395 $(MANPAGES)
396 endif
397
398 CLEANFILES += \
399 $(MANPAGES) \
400 $(MANPAGES_HTML) \
401 $(MANPAGES_XML)
402
403 EXTRA_DIST += \
404 man/asciidoc.conf \
405 $(MANPAGES_TXT)
406
407 XSLTPROC_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
415 XSLTPROC_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
420 # Let XSLT find its source on Mac OS X
421 ifeq ($(OS),Darwin)
422 export XML_CATALOG_FILES = /usr/local/etc/xml/catalog
423 endif
424
425 man/%.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
431 man/%.8: man/%.xml
432 $(XSLTPROC_COMMAND_MAN)
433
434 man/%.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
441 upload-man: $(MANPAGES_HTML)
442 rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/
443
444 EXTRA_DIST += \
445 debian/build.sh \
446 debian/changelog \
447 debian/compat \
448 debian/control \
449 debian/copyright \
450 debian/location.install \
451 debian/location.manpages \
452 debian/location-python.install \
453 debian/libloc1.install \
454 debian/libloc-dev.install \
455 debian/rules \
456 debian/source/format
457
458 .PHONY: debian
459 debian: dist
460 $(SHELL) debian/build.sh $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(distdir).tar.xz