]> git.ipfire.org Git - location/libloc.git/blob - Makefile.am
3dca0fee8207b7d006d487259ab4880f6bb08001
[location/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/country.h \
72 src/loc/database.h \
73 src/loc/format.h \
74 src/loc/network.h \
75 src/loc/private.h \
76 src/loc/stringpool.h \
77 src/loc/writer.h
78
79 lib_LTLIBRARIES = \
80 src/libloc.la
81
82 src_libloc_la_SOURCES = \
83 src/libloc.c \
84 src/as.c \
85 src/country.c \
86 src/database.c \
87 src/network.c \
88 src/stringpool.c \
89 src/writer.c
90
91 EXTRA_DIST += src/libloc.sym
92
93 src_libloc_la_CFLAGS = \
94 $(AM_CFLAGS) \
95 -DLIBLOC_PRIVATE \
96 -fvisibility=hidden
97
98 src_libloc_la_LDFLAGS = \
99 $(AM_LDFLAGS) \
100 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE) \
101 -Wl,--version-script=$(top_srcdir)/src/libloc.sym
102
103 src_libloc_la_DEPENDENCIES = \
104 ${top_srcdir}/src/libloc.sym
105
106 pkgconfig_DATA = \
107 src/libloc.pc
108
109 EXTRA_DIST += \
110 src/libloc.pc.in
111
112 CLEANFILES += \
113 src/libloc.pc
114
115 pyexec_LTLIBRARIES = \
116 src/python/location.la
117
118 src_python_location_la_SOURCES = \
119 src/python/locationmodule.c \
120 src/python/locationmodule.h \
121 src/python/as.c \
122 src/python/as.h \
123 src/python/country.c \
124 src/python/country.h \
125 src/python/database.c \
126 src/python/database.h \
127 src/python/network.c \
128 src/python/network.h \
129 src/python/writer.c \
130 src/python/writer.h
131
132 src_python_location_la_CFLAGS = \
133 $(AM_CFLAGS) \
134 $(PYTHON_CFLAGS)
135
136 src_python_location_la_LDFLAGS = \
137 $(AM_LDFLAGS) \
138 -shared \
139 -module \
140 -avoid-version
141
142 src_python_location_la_LIBADD = \
143 src/libloc.la \
144 $(PYTHON_LIBS)
145
146 # Compile & install bindings
147 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
148 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
149 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
150 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
151 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
152
153 # Perl Bindings
154 EXTRA_DIST += \
155 src/perl/.gitignore \
156 src/perl/Location.xs \
157 src/perl/MANIFEST \
158 src/perl/Makefile.PL \
159 src/perl/lib/Location.pm \
160 src/perl/t/Location.t \
161 src/perl/typemap
162
163 .PHONY: build-perl
164 build-perl:
165 @mkdir -p $(builddir)/src/perl/{lib,t}
166 @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
167 @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
168 @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/
169 @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/
170 @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/
171 @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/
172
173 cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
174 INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
175 cd $(builddir)/src/perl && $(MAKE)
176
177 .PHONY: check-perl
178 check-perl: testdata.db
179 cd $(builddir)/src/perl && $(MAKE) test database="../../$<"
180
181 .PHONY: install-perl
182 install-perl:
183 cd $(builddir)/src/perl && $(MAKE) install
184
185 .PHONY: clean-perl
186 clean-perl:
187 cd $(builddir)/src/perl && $(MAKE) distclean
188
189 .PHONY: uninstall-perl
190 uninstall-perl:
191 rm -rvf \
192 $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \
193 $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \
194 $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \
195 $(DESTDIR)/$(prefix)/man/man3/Location.3pm
196
197 bin_SCRIPTS = \
198 src/python/location-query
199
200 EXTRA_DIST += \
201 src/python/location-query.in
202
203 CLEANFILES += \
204 src/python/location-query
205
206 # ------------------------------------------------------------------------------
207
208 TESTS_CFLAGS = \
209 $(AM_CFLAGS) \
210 -DLIBLOC_PRIVATE
211
212 TESTS = \
213 src/test-libloc \
214 src/test-stringpool \
215 src/test-database \
216 src/test-as \
217 src/test-network \
218 src/test-country
219
220 CLEANFILES += \
221 test.db \
222 testdata.db
223
224 testdata.db: examples/python/create-database.py
225 PYTHONPATH=$(abs_builddir)/src/python/.libs $(PYTHON) $< $@
226
227 check_PROGRAMS = \
228 src/test-libloc \
229 src/test-stringpool \
230 src/test-database \
231 src/test-as \
232 src/test-network \
233 src/test-country
234
235 src_test_libloc_SOURCES = \
236 src/test-libloc.c
237
238 src_test_libloc_CFLAGS = \
239 $(TESTS_CFLAGS)
240
241 src_test_libloc_LDADD = \
242 src/libloc.la
243
244 src_test_as_SOURCES = \
245 src/test-as.c
246
247 src_test_as_CFLAGS = \
248 $(TESTS_CFLAGS)
249
250 src_test_as_LDADD = \
251 src/libloc.la
252
253 src_test_country_SOURCES = \
254 src/test-country.c
255
256 src_test_country_CFLAGS = \
257 $(TESTS_CFLAGS)
258
259 src_test_country_LDADD = \
260 src/libloc.la
261
262 src_test_network_SOURCES = \
263 src/test-network.c
264
265 src_test_network_CFLAGS = \
266 $(TESTS_CFLAGS)
267
268 src_test_network_LDADD = \
269 src/libloc.la
270
271 src_test_stringpool_SOURCES = \
272 src/test-stringpool.c
273
274 src_test_stringpool_CFLAGS = \
275 $(TESTS_CFLAGS)
276
277 src_test_stringpool_LDADD = \
278 src/libloc.la
279
280 src_test_database_SOURCES = \
281 src/test-database.c
282
283 src_test_database_CFLAGS = \
284 $(TESTS_CFLAGS)
285
286 src_test_database_LDADD = \
287 src/libloc.la
288
289 # ------------------------------------------------------------------------------
290
291 MANPAGES = \
292 man/location-query.8
293
294 MANPAGES_TXT = $(patsubst %.8,%.txt,$(MANPAGES))
295 MANPAGES_HTML = $(patsubst %.txt,%.html,$(MANPAGES_TXT))
296 MANPAGES_XML = $(patsubst %.txt,%.xml,$(MANPAGES_TXT))
297
298 .PHONY: man
299 man: $(MANPAGES) $(MANPAGES_HTML)
300
301 if ENABLE_MANPAGES
302 man_MANS = \
303 $(MANPAGES)
304 endif
305
306 CLEANFILES += \
307 $(MANPAGES) \
308 $(MANPAGES_HTML) \
309 $(MANPAGES_XML)
310
311 EXTRA_DIST += \
312 man/asciidoc.conf \
313 $(MANPAGES_TXT)
314
315 XSLTPROC_FLAGS = \
316 --nonet \
317 --stringparam man.output.quietly 1 \
318 --stringparam funcsynopsis.style ansi \
319 --stringparam man.th.extra1.suppress 1 \
320 --stringparam man.authors.section.enabled 1 \
321 --stringparam man.copyright.section.enabled 1
322
323 XSLTPROC_COMMAND_MAN = \
324 $(AM_V_XSLT)$(MKDIR_P) $(dir $@) && \
325 $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) \
326 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
327
328 man/%.xml: man/%.txt man/asciidoc.conf
329 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
330 $(ASCIIDOC) \
331 -f $(abs_srcdir)/man/asciidoc.conf \
332 -d manpage -b docbook -o $@ $<
333
334 man/%.8: man/%.xml
335 $(XSLTPROC_COMMAND_MAN)
336
337 man/%.html: man/%.txt man/asciidoc.conf
338 $(AM_V_ASCIIDOC)$(MKDIR_P) $(dir $@) && \
339 $(ASCIIDOC) \
340 -f $(abs_srcdir)/man/asciidoc.conf \
341 -b html5 -a icons -a theme=flask -o $@ $<
342
343 .PHONY: upload-man
344 upload-man: $(MANPAGES_HTML)
345 rsync -avHz --delete --progress $(MANPAGES_HTML) ms@fs01.haj.ipfire.org:/pub/man-pages/$(PACKAGE_NAME)/