location-downloader: Add proper logging infrastructure
[people/ms/libloc.git] / Makefile.am
CommitLineData
46aded9a
MT
1EXTRA_DIST =
2CLEANFILES =
3ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
4AM_MAKEFLAGS = --no-print-directory
5
2bb7d64e 6SUBDIRS = . po
747cbcb1
MT
7BINDINGS =
8
afe51420
MT
9OS = $(shell uname -s)
10
747cbcb1
MT
11if ENABLE_PERL
12BINDINGS += perl
13endif
2bb7d64e 14
46aded9a
MT
15AM_CPPFLAGS = \
16 -include $(top_builddir)/config.h \
17 -DSYSCONFDIR=\""$(sysconfdir)"\" \
18 -I${top_srcdir}/src
19
20AM_CFLAGS = ${my_CFLAGS} \
46aded9a
MT
21 -ffunction-sections \
22 -fdata-sections
23
afe51420
MT
24AM_LDFLAGS =
25
26# leaving a space here to work around automake's conditionals
27 ifeq ($(OS),Darwin)
28 AM_LDFLAGS += -Wl,-dead_strip
29 else
30 AM_LDFLAGS += \
31 -Wl,--as-needed \
32 -Wl,--gc-sections
33 endif
46aded9a
MT
34
35LIBLOC_CURRENT=0
36LIBLOC_REVISION=0
37LIBLOC_AGE=0
38
39SED_PROCESS = \
40 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \
41 -e 's,@VERSION\@,$(VERSION),g' \
42 -e 's,@prefix\@,$(prefix),g' \
43 -e 's,@exec_prefix\@,$(exec_prefix),g' \
44 -e 's,@libdir\@,$(libdir),g' \
45 -e 's,@includedir\@,$(includedir),g' \
73d1b258 46 -e 's,@databasedir\@,$(databasedir),g' \
46aded9a
MT
47 < $< > $@ || rm $@
48
73d1b258 49databasedir = $(datadir)/location
46aded9a
MT
50pkgconfigdir = $(libdir)/pkgconfig
51
73d1b258 52%: %.in Makefile
46aded9a
MT
53 $(SED_PROCESS)
54
2bb7d64e
MT
55@INTLTOOL_POLICY_RULE@
56
161ac92d
MT
57# ------------------------------------------------------------------------------
58
59AM_V_ASCIIDOC = $(AM_V_ASCIIDOC_$(V))
60AM_V_ASCIIDOC_ = $(AM_V_ASCIIDOC_$(AM_DEFAULT_VERBOSITY))
61AM_V_ASCIIDOC_0 = @echo " ASCIIDOC" $@;
62
63AM_V_XSLT = $(AM_V_XSLT_$(V))
64AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
65AM_V_XSLT_0 = @echo " XSLT " $@;
66
67# ------------------------------------------------------------------------------
68
2bb7d64e
MT
69.PHONY: update-po
70update-po:
71 $(MAKE) -C po update-po
72
e51e1dec
MT
73EXTRA_DIST += \
74 examples/python/create-database.py \
75 examples/python/read-database.py
76
46aded9a 77pkginclude_HEADERS = \
c182393f 78 src/loc/libloc.h \
9fc7f001 79 src/loc/as.h \
42f3ccd7 80 src/loc/compat.h \
ec684c1a 81 src/loc/country.h \
9fc7f001
MT
82 src/loc/database.h \
83 src/loc/format.h \
84 src/loc/network.h \
85 src/loc/private.h \
86 src/loc/stringpool.h \
c182393f 87 src/loc/writer.h
46aded9a
MT
88
89lib_LTLIBRARIES = \
90 src/libloc.la
91
9fc7f001 92src_libloc_la_SOURCES = \
62b83e6d 93 src/libloc.c \
a5db3e49 94 src/as.c \
ec684c1a 95 src/country.c \
2601e83e 96 src/database.c \
3b5f4af2 97 src/network.c \
62b83e6d 98 src/stringpool.c \
c182393f 99 src/writer.c
46aded9a
MT
100
101EXTRA_DIST += src/libloc.sym
102
18e2b14c
MT
103src_libloc_la_CFLAGS = \
104 $(AM_CFLAGS) \
1a3cb1b4 105 -DLIBLOC_PRIVATE \
18e2b14c
MT
106 -fvisibility=hidden
107
46aded9a
MT
108src_libloc_la_LDFLAGS = \
109 $(AM_LDFLAGS) \
a76b0b96
MT
110 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE)
111
112if HAVE_LD_VERSION_SCRIPT
113 src_libloc_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libloc.sym
114else
115 src_libloc_la_LDFLAGS += -export-symbols $(top_srcdir)/src/libloc.sym
116endif
46aded9a
MT
117
118src_libloc_la_DEPENDENCIES = \
119 ${top_srcdir}/src/libloc.sym
120
121pkgconfig_DATA = \
122 src/libloc.pc
123
124EXTRA_DIST += \
125 src/libloc.pc.in
126
127CLEANFILES += \
128 src/libloc.pc
129
a2ab8ddf 130pyexec_LTLIBRARIES = \
18e2b14c
MT
131 src/python/location.la
132
133src_python_location_la_SOURCES = \
9cdf6c53 134 src/python/locationmodule.c \
62ffafdd 135 src/python/locationmodule.h \
fadebc89
MT
136 src/python/as.c \
137 src/python/as.h \
af208e26
MT
138 src/python/country.c \
139 src/python/country.h \
9cdf6c53 140 src/python/database.c \
d688e569 141 src/python/database.h \
39967361
MT
142 src/python/network.c \
143 src/python/network.h \
d688e569
MT
144 src/python/writer.c \
145 src/python/writer.h
18e2b14c
MT
146
147src_python_location_la_CFLAGS = \
148 $(AM_CFLAGS) \
149 $(PYTHON_CFLAGS)
150
151src_python_location_la_LDFLAGS = \
152 $(AM_LDFLAGS) \
153 -shared \
154 -module \
155 -avoid-version
156
157src_python_location_la_LIBADD = \
158 src/libloc.la \
159 $(PYTHON_LIBS)
160
747cbcb1
MT
161# Compile & install bindings
162all-local: $(foreach binding,$(BINDINGS),build-$(binding))
163check-local: $(foreach binding,$(BINDINGS),check-$(binding))
164install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
165clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
166uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
167
168# Perl Bindings
169EXTRA_DIST += \
170 src/perl/.gitignore \
171 src/perl/Location.xs \
172 src/perl/MANIFEST \
173 src/perl/Makefile.PL \
174 src/perl/lib/Location.pm \
175 src/perl/t/Location.t \
176 src/perl/typemap
177
178.PHONY: build-perl
179build-perl:
180 @mkdir -p $(builddir)/src/perl/{lib,t}
181 @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
182 @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
183 @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/
184 @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/
185 @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/
186 @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/
187
188 cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
189 INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
190 cd $(builddir)/src/perl && $(MAKE)
191
192.PHONY: check-perl
f852b157
MT
193check-perl: testdata.db
194 cd $(builddir)/src/perl && $(MAKE) test database="../../$<"
747cbcb1
MT
195
196.PHONY: install-perl
197install-perl:
198 cd $(builddir)/src/perl && $(MAKE) install
199
200.PHONY: clean-perl
201clean-perl:
202 cd $(builddir)/src/perl && $(MAKE) distclean
203
204.PHONY: uninstall-perl
205uninstall-perl:
206 rm -rvf \
207 $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \
208 $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \
209 $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \
210 $(DESTDIR)/$(prefix)/man/man3/Location.3pm
211
5118a4b8 212bin_SCRIPTS = \
244a3b61 213 src/python/location-downloader \
5118a4b8
MT
214 src/python/location-query
215
73d1b258 216EXTRA_DIST += \
244a3b61 217 src/python/location-downloader.in \
73d1b258
MT
218 src/python/location-query.in
219
220CLEANFILES += \
244a3b61 221 src/python/location-downloader \
73d1b258
MT
222 src/python/location-query
223
161ac92d
MT
224# ------------------------------------------------------------------------------
225
30ac38a1
MT
226TESTS_CFLAGS = \
227 $(AM_CFLAGS) \
228 -DLIBLOC_PRIVATE
229
46aded9a 230TESTS = \
62b83e6d 231 src/test-libloc \
2601e83e 232 src/test-stringpool \
a5db3e49 233 src/test-database \
3b5f4af2 234 src/test-as \
ec684c1a
MT
235 src/test-network \
236 src/test-country
46aded9a 237
f3bf970a 238CLEANFILES += \
f852b157
MT
239 test.db \
240 testdata.db
f3bf970a 241
f852b157
MT
242testdata.db: examples/python/create-database.py
243 PYTHONPATH=$(abs_builddir)/src/python/.libs $(PYTHON) $< $@
1235c0b0 244
46aded9a 245check_PROGRAMS = \
62b83e6d 246 src/test-libloc \
2601e83e 247 src/test-stringpool \
a5db3e49 248 src/test-database \
3b5f4af2 249 src/test-as \
ec684c1a
MT
250 src/test-network \
251 src/test-country
46aded9a
MT
252
253src_test_libloc_SOURCES = \
254 src/test-libloc.c
255
30ac38a1
MT
256src_test_libloc_CFLAGS = \
257 $(TESTS_CFLAGS)
258
46aded9a
MT
259src_test_libloc_LDADD = \
260 src/libloc.la
62b83e6d 261
a5db3e49
MT
262src_test_as_SOURCES = \
263 src/test-as.c
264
30ac38a1
MT
265src_test_as_CFLAGS = \
266 $(TESTS_CFLAGS)
267
a5db3e49
MT
268src_test_as_LDADD = \
269 src/libloc.la
270
ec684c1a
MT
271src_test_country_SOURCES = \
272 src/test-country.c
273
274src_test_country_CFLAGS = \
275 $(TESTS_CFLAGS)
276
277src_test_country_LDADD = \
278 src/libloc.la
279
3b5f4af2
MT
280src_test_network_SOURCES = \
281 src/test-network.c
282
30ac38a1
MT
283src_test_network_CFLAGS = \
284 $(TESTS_CFLAGS)
285
3b5f4af2
MT
286src_test_network_LDADD = \
287 src/libloc.la
288
62b83e6d
MT
289src_test_stringpool_SOURCES = \
290 src/test-stringpool.c
291
30ac38a1
MT
292src_test_stringpool_CFLAGS = \
293 $(TESTS_CFLAGS)
294
62b83e6d
MT
295src_test_stringpool_LDADD = \
296 src/libloc.la
2601e83e
MT
297
298src_test_database_SOURCES = \
299 src/test-database.c
300
30ac38a1
MT
301src_test_database_CFLAGS = \
302 $(TESTS_CFLAGS)
303
2601e83e
MT
304src_test_database_LDADD = \
305 src/libloc.la
161ac92d
MT
306
307# ------------------------------------------------------------------------------
308
309MANPAGES = \
310 man/location-query.8
311
312MANPAGES_TXT = $(patsubst %.8,%.txt,$(MANPAGES))
313MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
314MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
315
316.PHONY: man
317man: $(MANPAGES) $(MANPAGES_HTML)
318
319if ENABLE_MANPAGES
320man_MANS = \
321 $(MANPAGES)
322endif
323
324CLEANFILES += \
325 $(MANPAGES) \
326 $(MANPAGES_HTML) \
327 $(MANPAGES_XML)
328
329EXTRA_DIST += \
330 man/asciidoc.conf \
331 $(MANPAGES_TXT)
332
333XSLTPROC_FLAGS = \
334 --nonet \
335 --stringparam man.output.quietly 1 \
336 --stringparam funcsynopsis.style ansi \
337 --stringparam man.th.extra1.suppress 1 \
338 --stringparam man.authors.section.enabled 1 \
339 --stringparam man.copyright.section.enabled 1
340
341XSLTPROC_COMMAND_MAN = \
342 $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
343 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
344 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
345
346man/%.xml: man/%.txt man/asciidoc.conf
347 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
348 $(ASCIIDOC) \
349 -f $(abs_srcdir)/man/asciidoc.conf \
350 -d manpage -b docbook -o $@ $<
351
352man/%.8: man/%.xml
353 $(XSLTPROC_COMMAND_MAN)
354
355man/%.html: man/%.txt man/asciidoc.conf
356 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
357 $(ASCIIDOC) \
358 -f $(abs_srcdir)/man/asciidoc.conf \
359 -b html5 -a icons -a theme=flask -o $@ $<
360
361.PHONY: upload-man
362upload-man: $(MANPAGES_HTML)
363 rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/