]> git.ipfire.org Git - people/ms/libloc.git/blob - Makefile.am
country: Include compat.h to build on other arches
[people/ms/libloc.git] / Makefile.am
1 EXTRA_DIST =
2 CLEANFILES =
3 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
4 AM_MAKEFLAGS = --no-print-directory
5
6 SUBDIRS = . po
7 BINDINGS =
8
9 if ENABLE_PERL
10 BINDINGS += perl
11 endif
12
13 AM_CPPFLAGS = \
14 -include $(top_builddir)/config.h \
15 -DSYSCONFDIR=\""$(sysconfdir)"\" \
16 -I${top_srcdir}/src
17
18 AM_CFLAGS = ${my_CFLAGS} \
19 -ffunction-sections \
20 -fdata-sections
21
22 AM_LDFLAGS = \
23 -Wl,--gc-sections \
24 -Wl,--as-needed
25
26 LIBLOC_CURRENT=0
27 LIBLOC_REVISION=0
28 LIBLOC_AGE=0
29
30 SED_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' \
37 -e 's,@databasedir\@,$(databasedir),g' \
38 < $< > $@ || rm $@
39
40 databasedir = $(datadir)/location
41 pkgconfigdir = $(libdir)/pkgconfig
42
43 %: %.in Makefile
44 $(SED_PROCESS)
45
46 @INTLTOOL_POLICY_RULE@
47
48 # ------------------------------------------------------------------------------
49
50 AM_V_ASCIIDOC = $(AM_V_ASCIIDOC_$(V))
51 AM_V_ASCIIDOC_ = $(AM_V_ASCIIDOC_$(AM_DEFAULT_VERBOSITY))
52 AM_V_ASCIIDOC_0 = @echo " ASCIIDOC" $@;
53
54 AM_V_XSLT = $(AM_V_XSLT_$(V))
55 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
56 AM_V_XSLT_0 = @echo " XSLT " $@;
57
58 # ------------------------------------------------------------------------------
59
60 .PHONY: update-po
61 update-po:
62 $(MAKE) -C po update-po
63
64 EXTRA_DIST += \
65 examples/python/create-database.py \
66 examples/python/read-database.py
67
68 pkginclude_HEADERS = \
69 src/loc/libloc.h \
70 src/loc/as.h \
71 src/loc/compat.h \
72 src/loc/country.h \
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 \
78 src/loc/writer.h
79
80 lib_LTLIBRARIES = \
81 src/libloc.la
82
83 src_libloc_la_SOURCES = \
84 src/libloc.c \
85 src/as.c \
86 src/country.c \
87 src/database.c \
88 src/network.c \
89 src/stringpool.c \
90 src/writer.c
91
92 EXTRA_DIST += src/libloc.sym
93
94 src_libloc_la_CFLAGS = \
95 $(AM_CFLAGS) \
96 -DLIBLOC_PRIVATE \
97 -fvisibility=hidden
98
99 src_libloc_la_LDFLAGS = \
100 $(AM_LDFLAGS) \
101 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE)
102
103 if HAVE_LD_VERSION_SCRIPT
104 src_libloc_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/src/libloc.sym
105 else
106 src_libloc_la_LDFLAGS += -export-symbols $(top_srcdir)/src/libloc.sym
107 endif
108
109 src_libloc_la_DEPENDENCIES = \
110 ${top_srcdir}/src/libloc.sym
111
112 pkgconfig_DATA = \
113 src/libloc.pc
114
115 EXTRA_DIST += \
116 src/libloc.pc.in
117
118 CLEANFILES += \
119 src/libloc.pc
120
121 pyexec_LTLIBRARIES = \
122 src/python/location.la
123
124 src_python_location_la_SOURCES = \
125 src/python/locationmodule.c \
126 src/python/locationmodule.h \
127 src/python/as.c \
128 src/python/as.h \
129 src/python/country.c \
130 src/python/country.h \
131 src/python/database.c \
132 src/python/database.h \
133 src/python/network.c \
134 src/python/network.h \
135 src/python/writer.c \
136 src/python/writer.h
137
138 src_python_location_la_CFLAGS = \
139 $(AM_CFLAGS) \
140 $(PYTHON_CFLAGS)
141
142 src_python_location_la_LDFLAGS = \
143 $(AM_LDFLAGS) \
144 -shared \
145 -module \
146 -avoid-version
147
148 src_python_location_la_LIBADD = \
149 src/libloc.la \
150 $(PYTHON_LIBS)
151
152 # Compile & install bindings
153 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
154 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
155 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
156 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
157 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
158
159 # Perl Bindings
160 EXTRA_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
170 build-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
184 check-perl: testdata.db
185 cd $(builddir)/src/perl && $(MAKE) test database="../../$<"
186
187 .PHONY: install-perl
188 install-perl:
189 cd $(builddir)/src/perl && $(MAKE) install
190
191 .PHONY: clean-perl
192 clean-perl:
193 cd $(builddir)/src/perl && $(MAKE) distclean
194
195 .PHONY: uninstall-perl
196 uninstall-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
203 bin_SCRIPTS = \
204 src/python/location-query
205
206 EXTRA_DIST += \
207 src/python/location-query.in
208
209 CLEANFILES += \
210 src/python/location-query
211
212 # ------------------------------------------------------------------------------
213
214 TESTS_CFLAGS = \
215 $(AM_CFLAGS) \
216 -DLIBLOC_PRIVATE
217
218 TESTS = \
219 src/test-libloc \
220 src/test-stringpool \
221 src/test-database \
222 src/test-as \
223 src/test-network \
224 src/test-country
225
226 CLEANFILES += \
227 test.db \
228 testdata.db
229
230 testdata.db: examples/python/create-database.py
231 PYTHONPATH=$(abs_builddir)/src/python/.libs $(PYTHON) $< $@
232
233 check_PROGRAMS = \
234 src/test-libloc \
235 src/test-stringpool \
236 src/test-database \
237 src/test-as \
238 src/test-network \
239 src/test-country
240
241 src_test_libloc_SOURCES = \
242 src/test-libloc.c
243
244 src_test_libloc_CFLAGS = \
245 $(TESTS_CFLAGS)
246
247 src_test_libloc_LDADD = \
248 src/libloc.la
249
250 src_test_as_SOURCES = \
251 src/test-as.c
252
253 src_test_as_CFLAGS = \
254 $(TESTS_CFLAGS)
255
256 src_test_as_LDADD = \
257 src/libloc.la
258
259 src_test_country_SOURCES = \
260 src/test-country.c
261
262 src_test_country_CFLAGS = \
263 $(TESTS_CFLAGS)
264
265 src_test_country_LDADD = \
266 src/libloc.la
267
268 src_test_network_SOURCES = \
269 src/test-network.c
270
271 src_test_network_CFLAGS = \
272 $(TESTS_CFLAGS)
273
274 src_test_network_LDADD = \
275 src/libloc.la
276
277 src_test_stringpool_SOURCES = \
278 src/test-stringpool.c
279
280 src_test_stringpool_CFLAGS = \
281 $(TESTS_CFLAGS)
282
283 src_test_stringpool_LDADD = \
284 src/libloc.la
285
286 src_test_database_SOURCES = \
287 src/test-database.c
288
289 src_test_database_CFLAGS = \
290 $(TESTS_CFLAGS)
291
292 src_test_database_LDADD = \
293 src/libloc.la
294
295 # ------------------------------------------------------------------------------
296
297 MANPAGES = \
298 man/location-query.8
299
300 MANPAGES_TXT = $(patsubst %.8,%.txt,$(MANPAGES))
301 MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
302 MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
303
304 .PHONY: man
305 man: $(MANPAGES) $(MANPAGES_HTML)
306
307 if ENABLE_MANPAGES
308 man_MANS = \
309 $(MANPAGES)
310 endif
311
312 CLEANFILES += \
313 $(MANPAGES) \
314 $(MANPAGES_HTML) \
315 $(MANPAGES_XML)
316
317 EXTRA_DIST += \
318 man/asciidoc.conf \
319 $(MANPAGES_TXT)
320
321 XSLTPROC_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
329 XSLTPROC_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
334 man/%.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
340 man/%.8: man/%.xml
341 $(XSLTPROC_COMMAND_MAN)
342
343 man/%.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
350 upload-man: $(MANPAGES_HTML)
351 rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/