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