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