2002-03-07 22:20:02 +08:00
|
|
|
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
|
|
|
|
INSTALL = $(top_srcdir)/build/shtool install -c
|
|
|
|
INSTALL_DATA = $(INSTALL) -m 644
|
|
|
|
|
2002-03-20 21:24:59 +08:00
|
|
|
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
|
2002-08-07 06:05:38 +08:00
|
|
|
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
|
2002-03-07 22:20:02 +08:00
|
|
|
|
|
|
|
all: $(all_targets)
|
2003-05-19 07:52:09 +08:00
|
|
|
@echo
|
2003-05-15 02:23:33 +08:00
|
|
|
@echo "Build complete."
|
2007-02-26 22:51:44 +08:00
|
|
|
@echo "Don't forget to run 'make test'."
|
2003-05-15 02:23:33 +08:00
|
|
|
@echo
|
2013-07-31 04:36:10 +08:00
|
|
|
|
2008-02-18 04:50:03 +08:00
|
|
|
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2010-11-14 07:13:07 +08:00
|
|
|
build-binaries: $(PHP_BINARIES)
|
|
|
|
|
2007-07-27 06:45:59 +08:00
|
|
|
libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
2002-08-07 01:51:24 +08:00
|
|
|
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
|
2007-07-27 06:45:59 +08:00
|
|
|
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2007-07-27 06:45:59 +08:00
|
|
|
libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
|
|
|
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so
|
2002-03-30 11:17:25 +08:00
|
|
|
|
2003-06-29 13:59:29 +08:00
|
|
|
install: $(all_targets) $(install_targets)
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2003-07-02 09:08:26 +08:00
|
|
|
install-sapi: $(OVERALL_TARGET)
|
2003-07-02 10:38:47 +08:00
|
|
|
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
|
2002-03-07 22:20:02 +08:00
|
|
|
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
|
2007-07-27 06:45:59 +08:00
|
|
|
-@if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \
|
2002-03-07 22:20:02 +08:00
|
|
|
for i in 0.0.0 0.0 0; do \
|
2007-07-27 06:45:59 +08:00
|
|
|
if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \
|
|
|
|
$(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \
|
2002-03-07 22:20:02 +08:00
|
|
|
break; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
fi
|
2002-07-04 06:12:13 +08:00
|
|
|
@$(INSTALL_IT)
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2010-11-14 07:13:07 +08:00
|
|
|
install-binaries: build-binaries $(install_binary_targets)
|
|
|
|
|
2002-06-28 07:56:27 +08:00
|
|
|
install-modules: build-modules
|
2002-03-07 22:20:02 +08:00
|
|
|
@test -d modules && \
|
2003-12-04 23:57:55 +08:00
|
|
|
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
|
|
|
|
@echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
|
|
|
|
@rm -f modules/*.la >/dev/null 2>&1
|
|
|
|
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2005-11-22 07:08:02 +08:00
|
|
|
install-headers:
|
2005-11-22 08:50:36 +08:00
|
|
|
-@if test "$(INSTALL_HEADERS)"; then \
|
2006-04-06 04:22:21 +08:00
|
|
|
for i in `echo $(INSTALL_HEADERS)`; do \
|
2005-11-22 07:08:02 +08:00
|
|
|
i=`$(top_srcdir)/build/shtool path -d $$i`; \
|
|
|
|
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
|
|
|
|
done; \
|
|
|
|
$(mkinstalldirs) $$paths && \
|
|
|
|
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
|
2006-04-06 04:22:21 +08:00
|
|
|
for i in `echo $(INSTALL_HEADERS)`; do \
|
2005-11-22 07:08:02 +08:00
|
|
|
if test "$(PHP_PECL_EXTENSION)"; then \
|
|
|
|
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
|
|
|
|
else \
|
|
|
|
src=$$i; \
|
|
|
|
fi; \
|
|
|
|
if test -f "$(top_srcdir)/$$src"; then \
|
|
|
|
$(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
|
|
|
|
elif test -f "$(top_builddir)/$$src"; then \
|
|
|
|
$(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
|
|
|
|
else \
|
|
|
|
(cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
|
|
|
|
cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
|
|
|
|
fi \
|
|
|
|
done; \
|
|
|
|
fi
|
2002-03-07 22:20:02 +08:00
|
|
|
|
2007-07-27 06:45:59 +08:00
|
|
|
PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1'
|
|
|
|
PHP_TEST_SHARED_EXTENSIONS = ` \
|
2007-08-03 22:01:56 +08:00
|
|
|
if test "x$(PHP_MODULES)" != "x"; then \
|
|
|
|
for i in $(PHP_MODULES)""; do \
|
2007-06-29 23:13:40 +08:00
|
|
|
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
|
2007-06-29 22:30:35 +08:00
|
|
|
done; \
|
2008-02-18 04:50:03 +08:00
|
|
|
fi; \
|
|
|
|
if test "x$(PHP_ZEND_EX)" != "x"; then \
|
|
|
|
for i in $(PHP_ZEND_EX)""; do \
|
|
|
|
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
|
|
|
|
done; \
|
2007-06-29 22:30:35 +08:00
|
|
|
fi`
|
2010-04-27 07:53:30 +08:00
|
|
|
PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
|
2007-06-07 02:28:13 +08:00
|
|
|
|
2007-06-29 22:30:35 +08:00
|
|
|
test: all
|
2005-09-15 01:57:32 +08:00
|
|
|
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
|
2009-11-19 01:52:22 +08:00
|
|
|
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
|
2007-07-03 23:56:21 +08:00
|
|
|
if test "$$INI_FILE"; then \
|
2009-11-28 07:34:36 +08:00
|
|
|
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
|
2007-06-29 22:30:35 +08:00
|
|
|
else \
|
|
|
|
echo > $(top_builddir)/tmp-php.ini; \
|
2007-06-26 18:22:48 +08:00
|
|
|
fi; \
|
2009-11-19 01:52:22 +08:00
|
|
|
INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
|
2008-08-13 08:53:28 +08:00
|
|
|
if test "$$INI_SCANNED_PATH"; then \
|
|
|
|
INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
|
2009-11-28 07:34:36 +08:00
|
|
|
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
|
2008-08-13 08:53:28 +08:00
|
|
|
fi; \
|
2009-11-19 01:52:22 +08:00
|
|
|
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
|
2003-07-25 01:44:16 +08:00
|
|
|
TEST_PHP_SRCDIR=$(top_srcdir) \
|
|
|
|
CC="$(CC)" \
|
2009-11-19 01:52:22 +08:00
|
|
|
$(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
|
2010-09-05 20:29:47 +08:00
|
|
|
rm $(top_builddir)/tmp-php.ini; \
|
2003-07-25 01:44:16 +08:00
|
|
|
else \
|
|
|
|
echo "ERROR: Cannot run tests without CLI sapi."; \
|
|
|
|
fi
|
2002-03-07 22:20:02 +08:00
|
|
|
|
|
|
|
clean:
|
2007-06-07 02:28:13 +08:00
|
|
|
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
|
2002-09-30 12:42:11 +08:00
|
|
|
find . -name \*.lo -o -name \*.o | xargs rm -f
|
2002-09-30 17:15:23 +08:00
|
|
|
find . -name \*.la -o -name \*.a | xargs rm -f
|
2002-09-30 12:42:11 +08:00
|
|
|
find . -name \*.so | xargs rm -f
|
2002-06-30 12:26:05 +08:00
|
|
|
find . -name .libs -a -type d|xargs rm -rf
|
2014-01-24 10:28:45 +08:00
|
|
|
find . -name \*.1 | xargs rm -f
|
2007-07-27 06:45:59 +08:00
|
|
|
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
|
2002-03-07 22:20:02 +08:00
|
|
|
|
|
|
|
distclean: clean
|
2013-08-01 00:58:28 +08:00
|
|
|
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak
|
2005-05-27 21:10:01 +08:00
|
|
|
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
|
2002-03-07 22:20:02 +08:00
|
|
|
|
|
|
|
.PHONY: all clean install distclean test
|
|
|
|
.NOEXPORT:
|