]> git.ipfire.org Git - people/ms/libloc.git/blob - Makefile.am
perl: Automatically build modules
[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 .PHONY: update-po
49 update-po:
50 $(MAKE) -C po update-po
51
52 EXTRA_DIST += \
53 examples/python/create-database.py \
54 examples/python/read-database.py
55
56 pkginclude_HEADERS = \
57 src/loc/libloc.h \
58 src/loc/as.h \
59 src/loc/database.h \
60 src/loc/format.h \
61 src/loc/network.h \
62 src/loc/private.h \
63 src/loc/stringpool.h \
64 src/loc/writer.h
65
66 lib_LTLIBRARIES = \
67 src/libloc.la
68
69 src_libloc_la_SOURCES = \
70 src/libloc.c \
71 src/as.c \
72 src/database.c \
73 src/network.c \
74 src/stringpool.c \
75 src/writer.c
76
77 EXTRA_DIST += src/libloc.sym
78
79 src_libloc_la_CFLAGS = \
80 $(AM_CFLAGS) \
81 -DLIBLOC_PRIVATE \
82 -fvisibility=hidden
83
84 src_libloc_la_LDFLAGS = \
85 $(AM_LDFLAGS) \
86 -version-info $(LIBLOC_CURRENT):$(LIBLOC_REVISION):$(LIBLOC_AGE) \
87 -Wl,--version-script=$(top_srcdir)/src/libloc.sym
88
89 src_libloc_la_DEPENDENCIES = \
90 ${top_srcdir}/src/libloc.sym
91
92 pkgconfig_DATA = \
93 src/libloc.pc
94
95 EXTRA_DIST += \
96 src/libloc.pc.in
97
98 CLEANFILES += \
99 src/libloc.pc
100
101 pyexec_LTLIBRARIES = \
102 src/python/location.la
103
104 src_python_location_la_SOURCES = \
105 src/python/locationmodule.c \
106 src/python/locationmodule.h \
107 src/python/as.c \
108 src/python/as.h \
109 src/python/database.c \
110 src/python/database.h \
111 src/python/network.c \
112 src/python/network.h \
113 src/python/writer.c \
114 src/python/writer.h
115
116 src_python_location_la_CFLAGS = \
117 $(AM_CFLAGS) \
118 $(PYTHON_CFLAGS)
119
120 src_python_location_la_LDFLAGS = \
121 $(AM_LDFLAGS) \
122 -shared \
123 -module \
124 -avoid-version
125
126 src_python_location_la_LIBADD = \
127 src/libloc.la \
128 $(PYTHON_LIBS)
129
130 # Compile & install bindings
131 all-local: $(foreach binding,$(BINDINGS),build-$(binding))
132 check-local: $(foreach binding,$(BINDINGS),check-$(binding))
133 install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
134 clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
135 uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
136
137 # Perl Bindings
138 EXTRA_DIST += \
139 src/perl/.gitignore \
140 src/perl/Location.xs \
141 src/perl/MANIFEST \
142 src/perl/Makefile.PL \
143 src/perl/lib/Location.pm \
144 src/perl/t/Location.t \
145 src/perl/typemap
146
147 .PHONY: build-perl
148 build-perl:
149 @mkdir -p $(builddir)/src/perl/{lib,t}
150 @test -e $(builddir)/src/perl/Location.xs || ln -s --relative $(srcdir)/src/perl/Location.xs $(builddir)/src/perl/
151 @test -e $(builddir)/src/perl/MANIFEST || ln -s --relative $(srcdir)/src/perl/MANIFEST $(builddir)/src/perl/
152 @test -e $(builddir)/src/perl/Makefile.PL || ln -s --relative $(srcdir)/src/perl/Makefile.PL $(builddir)/src/perl/
153 @test -e $(builddir)/src/perl/lib/Location.pm || ln -s --relative $(srcdir)/src/perl/lib/Location.pm $(builddir)/src/perl/lib/
154 @test -e $(builddir)/src/perl/t/Location.t || ln -s --relative $(srcdir)/src/perl/t/Location.t $(builddir)/src/perl/t/
155 @test -e $(builddir)/src/perl/typemap || ln -s --relative $(srcdir)/src/perl/typemap $(builddir)/src/perl/
156
157 cd $(builddir)/src/perl && $(PERL) Makefile.PL PREFIX="$(prefix)" \
158 INC="-I$(abs_srcdir)/src" LIBS="-L$(abs_builddir)/src/.libs -lloc"
159 cd $(builddir)/src/perl && $(MAKE)
160
161 .PHONY: check-perl
162 check-perl:
163 cd $(builddir)/src/perl && $(MAKE) test
164
165 .PHONY: install-perl
166 install-perl:
167 cd $(builddir)/src/perl && $(MAKE) install
168
169 .PHONY: clean-perl
170 clean-perl:
171 cd $(builddir)/src/perl && $(MAKE) distclean
172
173 .PHONY: uninstall-perl
174 uninstall-perl:
175 rm -rvf \
176 $(DESTDIR)/$(prefix)/lib/*/perl/*/Location.pm \
177 $(DESTDIR)/$(prefix)/lib/*/perl/*/auto/Location \
178 $(DESTDIR)/$(prefix)/lib/*/perl/*/perllocal.pod \
179 $(DESTDIR)/$(prefix)/man/man3/Location.3pm
180
181 bin_SCRIPTS = \
182 src/python/location-query
183
184 EXTRA_DIST += \
185 src/python/location-query.in
186
187 CLEANFILES += \
188 src/python/location-query
189
190 TESTS_CFLAGS = \
191 $(AM_CFLAGS) \
192 -DLIBLOC_PRIVATE
193
194 TESTS = \
195 src/test-libloc \
196 src/test-stringpool \
197 src/test-database \
198 src/test-as \
199 src/test-network
200
201 CLEANFILES += \
202 test.db
203
204 check_PROGRAMS = \
205 src/test-libloc \
206 src/test-stringpool \
207 src/test-database \
208 src/test-as \
209 src/test-network
210
211 src_test_libloc_SOURCES = \
212 src/test-libloc.c
213
214 src_test_libloc_CFLAGS = \
215 $(TESTS_CFLAGS)
216
217 src_test_libloc_LDADD = \
218 src/libloc.la
219
220 src_test_as_SOURCES = \
221 src/test-as.c
222
223 src_test_as_CFLAGS = \
224 $(TESTS_CFLAGS)
225
226 src_test_as_LDADD = \
227 src/libloc.la
228
229 src_test_network_SOURCES = \
230 src/test-network.c
231
232 src_test_network_CFLAGS = \
233 $(TESTS_CFLAGS)
234
235 src_test_network_LDADD = \
236 src/libloc.la
237
238 src_test_stringpool_SOURCES = \
239 src/test-stringpool.c
240
241 src_test_stringpool_CFLAGS = \
242 $(TESTS_CFLAGS)
243
244 src_test_stringpool_LDADD = \
245 src/libloc.la
246
247 src_test_database_SOURCES = \
248 src/test-database.c
249
250 src_test_database_CFLAGS = \
251 $(TESTS_CFLAGS)
252
253 src_test_database_LDADD = \
254 src/libloc.la