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