]> git.ipfire.org Git - location/libloc.git/blob - Makefile.am
Move location-downloader functionality into location-query
[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=0
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:
79 $(MAKE) -C po update-po
80
81 EXTRA_DIST += \
82 examples/private-key.pem \
83 examples/public-key.pem \
84 examples/python/create-database.py \
85 examples/python/read-database.py
86
87 pkginclude_HEADERS = \
88 src/loc/libloc.h \
89 src/loc/as.h \
90 src/loc/compat.h \
91 src/loc/country.h \
92 src/loc/database.h \
93 src/loc/format.h \
94 src/loc/network.h \
95 src/loc/private.h \
96 src/loc/stringpool.h \
97 src/loc/resolv.h \
98 src/loc/writer.h
99
100 lib_LTLIBRARIES = \
101 src/libloc.la
102
103 src_libloc_la_SOURCES = \
104 src/libloc.c \
105 src/as.c \
106 src/country.c \
107 src/database.c \
108 src/network.c \
109 src/resolv.c \
110 src/stringpool.c \
111 src/writer.c
112
113 EXTRA_DIST += src/libloc.sym
114
115 src_libloc_la_CFLAGS = \
116 $(AM_CFLAGS) \
117 -DLIBLOC_PRIVATE \
118 -fvisibility=hidden
119
120 src_libloc_la_LDFLAGS = \
121 $(AM_LDFLAGS) \
122 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE)
123
124 if HAVE_LD_VERSION_SCRIPT
125 src_libloc_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libloc.sym
126 else
127 src_libloc_la_LDFLAGS += -export-symbols $(top_srcdir)/src/libloc.sym
128 endif
129
130 src_libloc_la_LIBADD = \
131 $(OPENSSL_LIBS) \
132 $(RESOLV_LIBS)
133
134 src_libloc_la_DEPENDENCIES = \
135 ${top_srcdir}/src/libloc.sym
136
137 pkgconfig_DATA = \
138 src/libloc.pc
139
140 EXTRA_DIST += \
141 src/libloc.pc.in
142
143 CLEANFILES += \
144 src/libloc.pc
145
146 dist_pkgpython_PYTHON = \
147 src/python/__init__.py \
148 src/python/database.py \
149 src/python/downloader.py \
150 src/python/i18n.py \
151 src/python/importer.py \
152 src/python/logger.py
153
154 pyexec_LTLIBRARIES = \
155 src/python/_location.la
156
157 src_python__location_la_SOURCES = \
158 src/python/locationmodule.c \
159 src/python/locationmodule.h \
160 src/python/as.c \
161 src/python/as.h \
162 src/python/country.c \
163 src/python/country.h \
164 src/python/database.c \
165 src/python/database.h \
166 src/python/network.c \
167 src/python/network.h \
168 src/python/writer.c \
169 src/python/writer.h
170
171 src_python__location_la_CFLAGS = \
172 $(AM_CFLAGS) \
173 $(PYTHON_CFLAGS)
174
175 src_python__location_la_LDFLAGS = \
176 $(AM_LDFLAGS) \
177 -shared \
178 -module \
179 -avoid-version
180
181 src_python__location_la_LIBADD = \
182 src/libloc.la \
183 $(PYTHON_LIBS)
184
185 # Compile & install bindings
186 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
187 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
188 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
189 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
190 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
191
192 # Perl Bindings
193 EXTRA_DIST += \
194 src/perl/.gitignore \
195 src/perl/Location.xs \
196 src/perl/MANIFEST \
197 src/perl/Makefile.PL \
198 src/perl/lib/Location.pm \
199 src/perl/t/Location.t \
200 src/perl/typemap
201
202 .PHONY: build-perl
203 build-perl:
204 @mkdir -p $(builddir)/src/perl/{lib,t}
205 @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
206 @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
207 @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/
208 @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/
209 @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/
210 @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/
211
212 cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
213 INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
214 cd $(builddir)/src/perl && $(MAKE) CC="$(CC)" LD="$(LD)" LD_RUN_PATH=
215
216 .PHONY: check-perl
217 check-perl: testdata.db
218 cd $(builddir)/src/perl && $(MAKE) LD_LIBRARY_PATH="$(abs_builddir)/src/.libs" test \
219 database="../../$<" keyfile="$(abs_srcdir)/examples/public-key.pem"
220
221 .PHONY: install-perl
222 install-perl:
223 cd $(builddir)/src/perl && $(MAKE) install
224
225 .PHONY: clean-perl
226 clean-perl:
227 cd $(builddir)/src/perl && $(MAKE) distclean
228
229 .PHONY: uninstall-perl
230 uninstall-perl:
231 rm -rvf \
232 $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \
233 $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \
234 $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \
235 $(DESTDIR)/$(prefix)/man/man3/Location.3pm
236
237 bin_SCRIPTS = \
238 src/python/location-exporter \
239 src/python/location-importer \
240 src/python/location-query
241
242 EXTRA_DIST += \
243 src/python/location-exporter.in \
244 src/python/location-importer.in \
245 src/python/location-query.in
246
247 CLEANFILES += \
248 src/python/location-exporter \
249 src/python/location-importer \
250 src/python/location-query
251
252 # ------------------------------------------------------------------------------
253
254 if HAVE_SYSTEMD
255 systemdsystemunit_DATA = \
256 src/systemd/location-downloader.service \
257 src/systemd/location-downloader.timer
258
259 CLEANFILES += \
260 $(systemdsystemunit_DATA)
261
262 INSTALL_DIRS += \
263 $(systemdsystemunitdir)
264 endif
265
266 EXTRA_DIST += \
267 src/systemd/location-downloader.service.in \
268 src/systemd/location-downloader.timer.in
269
270 # ------------------------------------------------------------------------------
271
272 dist_database_DATA = \
273 src/signing-key.pem
274
275 # ------------------------------------------------------------------------------
276
277 TESTS_CFLAGS = \
278 $(AM_CFLAGS) \
279 -DLIBLOC_PRIVATE \
280 -DABS_SRCDIR=\"$(abs_srcdir)\"
281
282 TESTS = \
283 src/test-libloc \
284 src/test-stringpool \
285 src/test-database \
286 src/test-as \
287 src/test-network \
288 src/test-country \
289 src/test-signature
290
291 CLEANFILES += \
292 testdata.db
293
294 testdata.db: examples/python/create-database.py
295 PYTHONPATH=$(abs_builddir)/src/python/.libs \
296 ABS_SRCDIR="$(abs_srcdir)" \
297 $(PYTHON) $< $@
298
299 check_PROGRAMS = \
300 src/test-libloc \
301 src/test-stringpool \
302 src/test-database \
303 src/test-as \
304 src/test-network \
305 src/test-country \
306 src/test-signature
307
308 src_test_libloc_SOURCES = \
309 src/test-libloc.c
310
311 src_test_libloc_CFLAGS = \
312 $(TESTS_CFLAGS)
313
314 src_test_libloc_LDADD = \
315 src/libloc.la
316
317 src_test_as_SOURCES = \
318 src/test-as.c
319
320 src_test_as_CFLAGS = \
321 $(TESTS_CFLAGS)
322
323 src_test_as_LDADD = \
324 src/libloc.la
325
326 src_test_country_SOURCES = \
327 src/test-country.c
328
329 src_test_country_CFLAGS = \
330 $(TESTS_CFLAGS)
331
332 src_test_country_LDADD = \
333 src/libloc.la
334
335 src_test_network_SOURCES = \
336 src/test-network.c
337
338 src_test_network_CFLAGS = \
339 $(TESTS_CFLAGS)
340
341 src_test_network_LDADD = \
342 src/libloc.la
343
344 src_test_stringpool_SOURCES = \
345 src/test-stringpool.c
346
347 src_test_stringpool_CFLAGS = \
348 $(TESTS_CFLAGS)
349
350 src_test_stringpool_LDADD = \
351 src/libloc.la
352
353 src_test_database_SOURCES = \
354 src/test-database.c
355
356 src_test_database_CFLAGS = \
357 $(TESTS_CFLAGS)
358
359 src_test_database_LDADD = \
360 src/libloc.la
361
362 src_test_signature_SOURCES = \
363 src/test-signature.c
364
365 src_test_signature_CFLAGS = \
366 $(TESTS_CFLAGS)
367
368 src_test_signature_LDADD = \
369 src/libloc.la
370
371 # ------------------------------------------------------------------------------
372
373 MANPAGES = \
374 man/location-downloader.8 \
375 man/location-query.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