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 $(LIBTOOL) -dlopen xapian.la --mode=execute $(OSX_SIP_HACK_ENV) $(PHP7)
11 # Use -n to disable use of the system php.ini (which might prevent php from
12 # using dl() which would make our test fail).
13 AM_LOG_FLAGS = -n -d safe_mode=off -d enable_dl=on \
14 -d extension_dir='$(abs_builddir)/.libs' \
15 -d include_path='php7$(PHP7_PATH_SEPARATOR)$(srcdir)/php7'
18 $(MAKE) check AM_LOG_FLAGS=
26 EXTRA_DIST = php.i except.i \
27 generate-php-exceptions \
28 add-php-ref-handling \
31 $(TESTS) $(SWIG_GENERATED)
33 BUILT_SOURCES = $(SWIG_GENERATED)
35 phpextdir = $(PHP7_EXTENSION_DIR)
37 phpext_LTLIBRARIES = xapian.la
39 # This location is correct for Debian, but in general there doesn't seem
40 # to be a suitable location which is guaranteed to be in the include_path
42 phpincdir = $(datadir)/php
43 phpinc_DATA = php7/xapian.php
45 # Remove the .la file - xapian.la is never linked against (it's a module)
46 # and PHP doesn't use libltdl. Note that the library gets installed by
47 # install-data, so that's where we need to hook.
49 rm -f $(DESTDIR)$(phpextdir)/xapian.la
51 # Because we don't install the .la file, "make uninstall" doesn't work and
52 # we need to remove the file ourselves.
54 eval `grep '^dlname=' $(phpext_LTLIBRARIES)` ; \
55 rm -f $(DESTDIR)$(phpextdir)/"$$dlname"
57 AM_CPPFLAGS = $(PHP7_INC)
58 AM_CXXFLAGS = $(SWIG_CXXFLAGS) $(XAPIAN_CXXFLAGS)
59 xapian_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
60 xapian_la_SOURCES = php7/xapian_wrap.cc php7/xapian_wrap.h
61 xapian_la_LIBADD = $(XAPIAN_LIBS) $(PHP7_LIBS)
64 BUILT_SOURCES += except.i
65 except.i: $(srcdir)/generate-php-exceptions ../../xapian-core/exception_data.pm
66 $(PERL) -w -I$(srcdir)/../../xapian-core $(srcdir)/generate-php-exceptions
68 # We need to explicitly set -outdir because on Windows, SWIG splits paths at
69 # "\" when extracting the output directory from the value passed to the -o
72 stamp = php7/xapian_wrap.stamp
73 RUN_SWIG = stamp='$(stamp)' $(PERL) '$(top_srcdir)'/swig-depcomp $(SWIG)
75 php7/xapian_wrap.cc php7/xapian_wrap.h php7/php_xapian.h php7/xapian.php: $(stamp)
77 $(stamp): except.i add-php-ref-handling add-php-type-hints
80 $(RUN_SWIG) $(SWIG_WERROR) -I'$(srcdir)' $(SWIG_FLAGS) -c++ \
81 -php7 -prefix Xapian -outdir php7 \
82 -o php7/xapian_wrap.cc '$(srcdir)/'php.i
83 $(PERL) '$(srcdir)/'add-php-ref-handling php7/xapian.php | \
84 $(PERL) '$(srcdir)/'add-php-type-hints > php7/xapian.tmp
85 mv php7/xapian.tmp php7/xapian.php
88 -include php7/xapian_wrap.d
92 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
94 exampledatadir = $(docdir)/php/examples
95 dist_exampledata_DATA =\
96 docs/examples/simplesearch.php7\
97 docs/examples/simpleindex.php7\
98 docs/examples/simpleexpand.php7\
99 docs/examples/simplematchdecider.php7
101 docdatadir = $(docdir)/php
102 dist_docdata_DATA = docs/index.html
104 if DOCUMENTATION_RULES
105 BUILT_SOURCES += docs/index.html
108 -case "$@" in */*) d=`echo "$@"|sed 's,/[^/]*$$,,'`; $(MKDIR_P) "$$d" ;; esac
109 $(RST2HTML) --exit-status=warning $< $@