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