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