database: Print timings in milliseconds
[people/ms/libloc.git] / Makefile.am
CommitLineData
46aded9a
MT
1EXTRA_DIST =
2CLEANFILES =
3ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
4AM_MAKEFLAGS = --no-print-directory
5
2bb7d64e 6SUBDIRS = . po
747cbcb1
MT
7BINDINGS =
8
9if ENABLE_PERL
10BINDINGS += perl
11endif
2bb7d64e 12
46aded9a
MT
13AM_CPPFLAGS = \
14 -include $(top_builddir)/config.h \
15 -DSYSCONFDIR=\""$(sysconfdir)"\" \
16 -I${top_srcdir}/src
17
18AM_CFLAGS = ${my_CFLAGS} \
46aded9a
MT
19 -ffunction-sections \
20 -fdata-sections
21
22AM_LDFLAGS = \
23 -Wl,--gc-sections \
24 -Wl,--as-needed
25
26LIBLOC_CURRENT=0
27LIBLOC_REVISION=0
28LIBLOC_AGE=0
29
30SED_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' \
73d1b258 37 -e 's,@databasedir\@,$(databasedir),g' \
46aded9a
MT
38 < $< > $@ || rm $@
39
73d1b258 40databasedir = $(datadir)/location
46aded9a
MT
41pkgconfigdir = $(libdir)/pkgconfig
42
73d1b258 43%: %.in Makefile
46aded9a
MT
44 $(SED_PROCESS)
45
2bb7d64e
MT
46@INTLTOOL_POLICY_RULE@
47
48.PHONY: update-po
49update-po:
50 $(MAKE) -C po update-po
51
e51e1dec
MT
52EXTRA_DIST += \
53 examples/python/create-database.py \
54 examples/python/read-database.py
55
46aded9a 56pkginclude_HEADERS = \
c182393f 57 src/loc/libloc.h \
9fc7f001
MT
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 \
c182393f 64 src/loc/writer.h
46aded9a
MT
65
66lib_LTLIBRARIES = \
67 src/libloc.la
68
9fc7f001 69src_libloc_la_SOURCES = \
62b83e6d 70 src/libloc.c \
a5db3e49 71 src/as.c \
2601e83e 72 src/database.c \
3b5f4af2 73 src/network.c \
62b83e6d 74 src/stringpool.c \
c182393f 75 src/writer.c
46aded9a
MT
76
77EXTRA_DIST += src/libloc.sym
78
18e2b14c
MT
79src_libloc_la_CFLAGS = \
80 $(AM_CFLAGS) \
1a3cb1b4 81 -DLIBLOC_PRIVATE \
18e2b14c
MT
82 -fvisibility=hidden
83
46aded9a
MT
84src_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
89src_libloc_la_DEPENDENCIES = \
90 ${top_srcdir}/src/libloc.sym
91
92pkgconfig_DATA = \
93 src/libloc.pc
94
95EXTRA_DIST += \
96 src/libloc.pc.in
97
98CLEANFILES += \
99 src/libloc.pc
100
a2ab8ddf 101pyexec_LTLIBRARIES = \
18e2b14c
MT
102 src/python/location.la
103
104src_python_location_la_SOURCES = \
9cdf6c53 105 src/python/locationmodule.c \
62ffafdd 106 src/python/locationmodule.h \
fadebc89
MT
107 src/python/as.c \
108 src/python/as.h \
9cdf6c53 109 src/python/database.c \
d688e569 110 src/python/database.h \
39967361
MT
111 src/python/network.c \
112 src/python/network.h \
d688e569
MT
113 src/python/writer.c \
114 src/python/writer.h
18e2b14c
MT
115
116src_python_location_la_CFLAGS = \
117 $(AM_CFLAGS) \
118 $(PYTHON_CFLAGS)
119
120src_python_location_la_LDFLAGS = \
121 $(AM_LDFLAGS) \
122 -shared \
123 -module \
124 -avoid-version
125
126src_python_location_la_LIBADD = \
127 src/libloc.la \
128 $(PYTHON_LIBS)
129
747cbcb1
MT
130# Compile & install bindings
131all-local: $(foreach binding,$(BINDINGS),build-$(binding))
132check-local: $(foreach binding,$(BINDINGS),check-$(binding))
133install-exec-local: $(foreach binding,$(BINDINGS),install-$(binding))
134clean-local: $(foreach binding,$(BINDINGS),clean-$(binding))
135uninstall-local: $(foreach binding,$(BINDINGS),uninstall-$(binding))
136
137# Perl Bindings
138EXTRA_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
148build-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
f852b157
MT
162check-perl: testdata.db
163 cd $(builddir)/src/perl && $(MAKE) test database="../../$<"
747cbcb1
MT
164
165.PHONY: install-perl
166install-perl:
167 cd $(builddir)/src/perl && $(MAKE) install
168
169.PHONY: clean-perl
170clean-perl:
171 cd $(builddir)/src/perl && $(MAKE) distclean
172
173.PHONY: uninstall-perl
174uninstall-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
5118a4b8
MT
181bin_SCRIPTS = \
182 src/python/location-query
183
73d1b258
MT
184EXTRA_DIST += \
185 src/python/location-query.in
186
187CLEANFILES += \
188 src/python/location-query
189
30ac38a1
MT
190TESTS_CFLAGS = \
191 $(AM_CFLAGS) \
192 -DLIBLOC_PRIVATE
193
46aded9a 194TESTS = \
62b83e6d 195 src/test-libloc \
2601e83e 196 src/test-stringpool \
a5db3e49 197 src/test-database \
3b5f4af2
MT
198 src/test-as \
199 src/test-network
46aded9a 200
f3bf970a 201CLEANFILES += \
f852b157
MT
202 test.db \
203 testdata.db
f3bf970a 204
f852b157
MT
205testdata.db: examples/python/create-database.py
206 PYTHONPATH=$(abs_builddir)/src/python/.libs $(PYTHON) $< $@
1235c0b0 207
46aded9a 208check_PROGRAMS = \
62b83e6d 209 src/test-libloc \
2601e83e 210 src/test-stringpool \
a5db3e49 211 src/test-database \
3b5f4af2
MT
212 src/test-as \
213 src/test-network
46aded9a
MT
214
215src_test_libloc_SOURCES = \
216 src/test-libloc.c
217
30ac38a1
MT
218src_test_libloc_CFLAGS = \
219 $(TESTS_CFLAGS)
220
46aded9a
MT
221src_test_libloc_LDADD = \
222 src/libloc.la
62b83e6d 223
a5db3e49
MT
224src_test_as_SOURCES = \
225 src/test-as.c
226
30ac38a1
MT
227src_test_as_CFLAGS = \
228 $(TESTS_CFLAGS)
229
a5db3e49
MT
230src_test_as_LDADD = \
231 src/libloc.la
232
3b5f4af2
MT
233src_test_network_SOURCES = \
234 src/test-network.c
235
30ac38a1
MT
236src_test_network_CFLAGS = \
237 $(TESTS_CFLAGS)
238
3b5f4af2
MT
239src_test_network_LDADD = \
240 src/libloc.la
241
62b83e6d
MT
242src_test_stringpool_SOURCES = \
243 src/test-stringpool.c
244
30ac38a1
MT
245src_test_stringpool_CFLAGS = \
246 $(TESTS_CFLAGS)
247
62b83e6d
MT
248src_test_stringpool_LDADD = \
249 src/libloc.la
2601e83e
MT
250
251src_test_database_SOURCES = \
252 src/test-database.c
253
30ac38a1
MT
254src_test_database_CFLAGS = \
255 $(TESTS_CFLAGS)
256
2601e83e
MT
257src_test_database_LDADD = \
258 src/libloc.la