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