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