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