]> git.ipfire.org Git - people/ms/libloc.git/blob - Makefile.am
Makefile: Cleanup Debian tarball
[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 DEBIAN_TARBALL_NAME = $(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.xz
13
14 CLEANFILES += \
15 $(DEBIAN_TARBALL_NAME)
16
17 if ENABLE_PERL
18 BINDINGS += perl
19 endif
20
21 AM_CPPFLAGS = \
22 -include $(top_builddir)/config.h \
23 -DSYSCONFDIR=\""$(sysconfdir)"\" \
24 -I${top_srcdir}/src
25
26 AM_CFLAGS = ${my_CFLAGS} \
27 -ffunction-sections \
28 -fdata-sections
29
30 AM_LDFLAGS =
31
32 # leaving a space here to work around automake's conditionals
33 ifeq ($(OS),Darwin)
34 AM_LDFLAGS += -Wl,-dead_strip
35 else
36 AM_LDFLAGS += \
37 -Wl,--as-needed \
38 -Wl,--gc-sections
39 endif
40
41 LIBLOC_CURRENT=0
42 LIBLOC_REVISION=0
43 LIBLOC_AGE=0
44
45 DISTCHECK_CONFIGURE_FLAGS = \
46 --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
47
48 SED_PROCESS = \
49 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
50 -e 's,@VERSION\@,$(VERSION),g' \
51 -e 's,@prefix\@,$(prefix),g' \
52 -e 's,@exec_prefix\@,$(exec_prefix),g' \
53 -e 's,@bindir\@,$(bindir),g' \
54 -e 's,@libdir\@,$(libdir),g' \
55 -e 's,@includedir\@,$(includedir),g' \
56 -e 's,@databasedir\@,$(databasedir),g' \
57 < $< > $@ || rm $@
58
59 databasedir = $(datadir)/location
60 pkgconfigdir = $(libdir)/pkgconfig
61
62 %: %.in Makefile
63 $(SED_PROCESS)
64
65 @INTLTOOL_POLICY_RULE@
66
67 # ------------------------------------------------------------------------------
68
69 AM_V_ASCIIDOC = $(AM_V_ASCIIDOC_$(V))
70 AM_V_ASCIIDOC_ = $(AM_V_ASCIIDOC_$(AM_DEFAULT_VERBOSITY))
71 AM_V_ASCIIDOC_0 = @echo " ASCIIDOC" $@;
72
73 AM_V_XSLT = $(AM_V_XSLT_$(V))
74 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
75 AM_V_XSLT_0 = @echo " XSLT " $@;
76
77 # ------------------------------------------------------------------------------
78
79 .PHONY: update-po
80 update-po:
81 $(MAKE) -C po update-po
82
83 EXTRA_DIST += \
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 $(RESOLV_LIBS)
132
133 src_libloc_la_DEPENDENCIES = \
134 ${top_srcdir}/src/libloc.sym
135
136 pkgconfig_DATA = \
137 src/libloc.pc
138
139 EXTRA_DIST += \
140 src/libloc.pc.in
141
142 CLEANFILES += \
143 src/libloc.pc
144
145 pyexec_LTLIBRARIES = \
146 src/python/location.la
147
148 src_python_location_la_SOURCES = \
149 src/python/locationmodule.c \
150 src/python/locationmodule.h \
151 src/python/as.c \
152 src/python/as.h \
153 src/python/country.c \
154 src/python/country.h \
155 src/python/database.c \
156 src/python/database.h \
157 src/python/network.c \
158 src/python/network.h \
159 src/python/writer.c \
160 src/python/writer.h
161
162 src_python_location_la_CFLAGS = \
163 $(AM_CFLAGS) \
164 $(PYTHON_CFLAGS)
165
166 src_python_location_la_LDFLAGS = \
167 $(AM_LDFLAGS) \
168 -shared \
169 -module \
170 -avoid-version
171
172 src_python_location_la_LIBADD = \
173 src/libloc.la \
174 $(PYTHON_LIBS)
175
176 # Compile & install bindings
177 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
178 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
179 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
180 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
181 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
182
183 # Perl Bindings
184 EXTRA_DIST += \
185 src/perl/.gitignore \
186 src/perl/Location.xs \
187 src/perl/MANIFEST \
188 src/perl/Makefile.PL \
189 src/perl/lib/Location.pm \
190 src/perl/t/Location.t \
191 src/perl/typemap
192
193 .PHONY: build-perl
194 build-perl:
195 @mkdir -p $(builddir)/src/perl/{lib,t}
196 @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
197 @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
198 @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/
199 @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/
200 @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/
201 @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/
202
203 cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
204 INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
205 cd $(builddir)/src/perl && $(MAKE) LD_RUN_PATH=
206
207 .PHONY: check-perl
208 check-perl: testdata.db
209 cd $(builddir)/src/perl && $(MAKE) LD_LIBRARY_PATH="$(abs_builddir)/src/.libs" test database="../../$<"
210
211 .PHONY: install-perl
212 install-perl:
213 cd $(builddir)/src/perl && $(MAKE) install
214
215 .PHONY: clean-perl
216 clean-perl:
217 cd $(builddir)/src/perl && $(MAKE) distclean
218
219 .PHONY: uninstall-perl
220 uninstall-perl:
221 rm -rvf \
222 $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \
223 $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \
224 $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \
225 $(DESTDIR)/$(prefix)/man/man3/Location.3pm
226
227 bin_SCRIPTS = \
228 src/python/location-downloader \
229 src/python/location-query
230
231 EXTRA_DIST += \
232 src/python/location-downloader.in \
233 src/python/location-query.in
234
235 CLEANFILES += \
236 src/python/location-downloader \
237 src/python/location-query
238 # ------------------------------------------------------------------------------
239
240 if HAVE_SYSTEMD
241 systemdsystemunit_DATA = \
242 src/systemd/location-downloader.service \
243 src/systemd/location-downloader.timer
244
245 CLEANFILES += \
246 $(systemdsystemunit_DATA)
247
248 INSTALL_DIRS += \
249 $(systemdsystemunitdir)
250 endif
251
252 EXTRA_DIST += \
253 src/systemd/location-downloader.service.in \
254 src/systemd/location-downloader.timer.in
255
256 # ------------------------------------------------------------------------------
257
258 TESTS_CFLAGS = \
259 $(AM_CFLAGS) \
260 -DLIBLOC_PRIVATE
261
262 TESTS = \
263 src/test-libloc \
264 src/test-stringpool \
265 src/test-database \
266 src/test-as \
267 src/test-network \
268 src/test-country
269
270 CLEANFILES += \
271 test.db \
272 testdata.db
273
274 testdata.db: examples/python/create-database.py
275 PYTHONPATH=$(abs_builddir)/src/python/.libs $(PYTHON) $< $@
276
277 check_PROGRAMS = \
278 src/test-libloc \
279 src/test-stringpool \
280 src/test-database \
281 src/test-as \
282 src/test-network \
283 src/test-country
284
285 src_test_libloc_SOURCES = \
286 src/test-libloc.c
287
288 src_test_libloc_CFLAGS = \
289 $(TESTS_CFLAGS)
290
291 src_test_libloc_LDADD = \
292 src/libloc.la
293
294 src_test_as_SOURCES = \
295 src/test-as.c
296
297 src_test_as_CFLAGS = \
298 $(TESTS_CFLAGS)
299
300 src_test_as_LDADD = \
301 src/libloc.la
302
303 src_test_country_SOURCES = \
304 src/test-country.c
305
306 src_test_country_CFLAGS = \
307 $(TESTS_CFLAGS)
308
309 src_test_country_LDADD = \
310 src/libloc.la
311
312 src_test_network_SOURCES = \
313 src/test-network.c
314
315 src_test_network_CFLAGS = \
316 $(TESTS_CFLAGS)
317
318 src_test_network_LDADD = \
319 src/libloc.la
320
321 src_test_stringpool_SOURCES = \
322 src/test-stringpool.c
323
324 src_test_stringpool_CFLAGS = \
325 $(TESTS_CFLAGS)
326
327 src_test_stringpool_LDADD = \
328 src/libloc.la
329
330 src_test_database_SOURCES = \
331 src/test-database.c
332
333 src_test_database_CFLAGS = \
334 $(TESTS_CFLAGS)
335
336 src_test_database_LDADD = \
337 src/libloc.la
338
339 # ------------------------------------------------------------------------------
340
341 MANPAGES = \
342 man/location-downloader.8 \
343 man/location-query.8
344
345 MANPAGES_TXT = $(patsubst %.8,%.txt,$(MANPAGES))
346 MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
347 MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
348
349 .PHONY: man
350 man: $(MANPAGES) $(MANPAGES_HTML)
351
352 if ENABLE_MANPAGES
353 man_MANS = \
354 $(MANPAGES)
355 endif
356
357 CLEANFILES += \
358 $(MANPAGES) \
359 $(MANPAGES_HTML) \
360 $(MANPAGES_XML)
361
362 EXTRA_DIST += \
363 man/asciidoc.conf \
364 $(MANPAGES_TXT)
365
366 XSLTPROC_FLAGS = \
367 --nonet \
368 --stringparam man.output.quietly 1 \
369 --stringparam funcsynopsis.style ansi \
370 --stringparam man.th.extra1.suppress 1 \
371 --stringparam man.authors.section.enabled 1 \
372 --stringparam man.copyright.section.enabled 1
373
374 XSLTPROC_COMMAND_MAN = \
375 $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
376 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
377 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
378
379 # Let XSLT find its source on Mac OS X
380 ifeq ($(OS),Darwin)
381 export XML_CATALOG_FILES = /usr/local/etc/xml/catalog
382 endif
383
384 man/%.xml: man/%.txt man/asciidoc.conf
385 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
386 $(ASCIIDOC) \
387 -f $(abs_srcdir)/man/asciidoc.conf \
388 -d manpage -b docbook -o $@ $<
389
390 man/%.8: man/%.xml
391 $(XSLTPROC_COMMAND_MAN)
392
393 man/%.html: man/%.txt man/asciidoc.conf
394 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
395 $(ASCIIDOC) \
396 -f $(abs_srcdir)/man/asciidoc.conf \
397 -b html5 -a icons -a theme=flask -o $@ $<
398
399 .PHONY: upload-man
400 upload-man: $(MANPAGES_HTML)
401 rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/
402
403 $(DEBIAN_TARBALL_NAME): dist
404 cp -v $(distdir).tar.xz $@
405
406 .PHONY: debian
407 debian: $(DEBIAN_TARBALL_NAME)
408 debuild -i -us -uc -b