1 ## Process this file with automake to produce Makefile.in
3 include ../generic/generic.mk
5 abs_builddir = @abs_builddir@
7 ## Test programs to be run
10 # Use -n to disable use of the system php.ini (which might prevent php from
11 # using dl() which would make our test fail). It would be nicer to use "-c"
12 # and provide an alternative php.ini but with "-c" it seems PHP still loads the
13 # system.ini first (at least with PHP 4.3.10).
14 AM_LOG_FLAGS = -n -d safe_mode=off -d enable_dl=on \
15 -d extension_dir='$(abs_builddir)/.libs' \
16 -d include_path='php5$(PHP_PATH_SEPARATOR)$(srcdir)/php5'
19 $(MAKE) check AM_LOG_FLAGS=
27 EXTRA_DIST = php.i except.i \
28 generate-php-exceptions \
29 add-php-ref-handling \
32 $(TESTS) $(SWIG_GENERATED)
34 BUILT_SOURCES = $(SWIG_GENERATED)
36 phpextdir = $(PHP_EXTENSION_DIR)
38 phpext_LTLIBRARIES = xapian.la
40 # This location is correct for Debian, but in general there doesn't seem
41 # to be a suitable location which is guaranteed to be in the include_path
43 phpincdir = $(datadir)/php$(PHP_MAJOR_VERSION)
44 phpinc_DATA = php5/xapian.php
46 # Remove the .la file - xapian.la is never linked against (it's a module)
47 # and PHP doesn't use libltdl. Note that the library gets installed by
48 # install-data, so that's where we need to hook.
50 rm -f $(DESTDIR)$(phpextdir)/xapian.la
52 # Because we don't install the .la file, "make uninstall" doesn't work and
53 # we need to remove the file ourselves.
55 eval `grep '^dlname=' $(phpext_LTLIBRARIES)` ; \
56 rm -f $(DESTDIR)$(phpextdir)/"$$dlname"
58 AM_CPPFLAGS = $(PHP_INC)
59 AM_CXXFLAGS = $(SWIG_CXXFLAGS) $(XAPIAN_CXXFLAGS)
60 xapian_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
61 xapian_la_SOURCES = php5/xapian_wrap.cc php5/xapian_wrap.h
62 xapian_la_LIBADD = $(XAPIAN_LIBS) $(PHP_LIBS)
65 BUILT_SOURCES += except.i
66 except.i: $(srcdir)/generate-php-exceptions ../../xapian-core/exception_data.pm
67 $(PERL) -w -I$(srcdir)/../../xapian-core $(srcdir)/generate-php-exceptions
69 # We need to explicitly set -outdir because on Windows, SWIG splits paths at
70 # "\" when extracting the output directory from the value passed to the -o
73 stamp = php5/xapian_wrap.stamp
74 RUN_SWIG = stamp='$(stamp)' $(PERL) '$(top_srcdir)'/swig-depcomp $(SWIG)
76 php5/xapian_wrap.cc php5/xapian_wrap.h php5/php_xapian.h php5/xapian.php: $(stamp)
78 $(stamp): except.i add-php-ref-handling add-php-type-hints
81 $(RUN_SWIG) $(SWIG_WERROR) -I'$(srcdir)' $(SWIG_FLAGS) -c++ \
82 -php5 -prefix Xapian -outdir php5 \
83 -o php5/xapian_wrap.cc '$(srcdir)/'php.i
84 $(PERL) '$(srcdir)/'add-php-ref-handling php5/xapian.php | \
85 $(PERL) '$(srcdir)/'add-php-type-hints > php5/xapian.tmp
86 mv php5/xapian.tmp php5/xapian.php
89 -include php5/xapian_wrap.d
93 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
95 exampledatadir = $(docdir)/php/examples
96 dist_exampledata_DATA =\
97 docs/examples/simplesearch.php5\
98 docs/examples/simpleindex.php5\
99 docs/examples/simpleexpand.php5\
100 docs/examples/simplematchdecider.php5
102 docdatadir = $(docdir)/php
103 dist_docdata_DATA = docs/index.html
105 if DOCUMENTATION_RULES
106 BUILT_SOURCES += docs/index.html
109 -case "$@" in */*) d=`echo "$@"|sed 's,/[^/]*$$,,'`; $(MKDIR_P) "$$d" ;; esac
110 $(RST2HTML) --exit-status=warning $< $@