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