1## Process this file with automake to produce Makefile.in
2
3include ../generic/generic.mk
4
5TESTS_ENVIRONMENT = LUA_CPATH='.libs/?$(LUA_SO)' $(LUA)
6
7## Test programs to be run
8TESTS = smoketest.lua
9
10EXTRA_DIST = util.i except.i \
11	generate-lua-exceptions \
12	$(TESTS) $(BUILT_SOURCES)
13
14lualibdir = @LUA_LIB@
15
16lualib_LTLIBRARIES = xapian.la
17
18# Remove the .la file - xapian.la is never linked against (it's a module)
19# and LUA doesn't use libltdl.  Note that the library gets installed by
20# install-data, so that's where we need to hook.
21install-data-hook:
22	rm -f $(DESTDIR)$(lualibdir)/xapian.la
23
24# Because we don't install the .la file, "make uninstall" doesn't work and
25# we need to remove the file ourselves.
26uninstall-local:
27	rm -f $(DESTDIR)$(lualibdir)/xapian$(LUA_SO)
28
29AM_CPPFLAGS = @LUA_CPPFLAGS@
30AM_CXXFLAGS = @SWIG_CXXFLAGS@ $(XAPIAN_CXXFLAGS)
31xapian_la_LDFLAGS = -avoid-version -module -shrext "$(LUA_SO)" $(NO_UNDEFINED)
32nodist_xapian_la_SOURCES = xapian_wrap.cc
33xapian_la_LIBADD = $(XAPIAN_LIBS)
34
35BUILT_SOURCES = xapian_wrap.cc
36
37if MAINTAINER_MODE
38BUILT_SOURCES += except.i
39except.i: $(srcdir)/generate-lua-exceptions ../../xapian-core/exception_data.pm
40	$(PERL) -w -I$(srcdir)/../../xapian-core $(srcdir)/generate-lua-exceptions
41
42xapian_wrap.cc: $(SWIG_sources) util.i except.i
43	$(SWIG) $(SWIG_includes) $(SWIG_FLAGS) -c++ \
44	    -lua \
45	    -o xapian_wrap_cc.tmp -MD -MF xapian_wrap_d.tmp $(SWIG_mainsource)
46	$(PERL) -p -e 's/\blua_strlen\(/lua_rawlen\(/;s/\bluaL_reg\b/luaL_Reg/;/end module/../return/ and /lua_pop/ and $$_=""' xapian_wrap_cc.tmp > xapian_wrap.cc
47	rm xapian_wrap_cc.tmp
48	mv xapian_wrap_d.tmp xapian_wrap.d
49
50-include xapian_wrap.d
51endif
52MAINTAINERCLEANFILES = $(BUILT_SOURCES)
53
54exampledatadir = $(docdir)/lua/examples
55dist_exampledata_DATA = \
56	docs/examples/simpleindex.lua \
57	docs/examples/simpleexpand.lua \
58	docs/examples/simplematchdecider.lua \
59	docs/examples/simplesearch.lua
60
61docdatadir = $(docdir)/lua
62dist_docdata_DATA = docs/index.html
63