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