1mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p 2INSTALL = $(top_srcdir)/build/shtool install -c 3INSTALL_DATA = $(INSTALL) -m 644 4 5DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir) 6COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH) 7 8all: $(all_targets) 9 @echo 10 @echo "Build complete." 11 @echo "Don't forget to run 'make test'." 12 @echo 13 14build-modules: $(PHP_MODULES) $(PHP_ZEND_EX) 15 16libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) 17 $(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 $@ 18 -@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1 19 20libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) 21 $(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 22 23install: $(all_targets) $(install_targets) 24 25install-sapi: $(OVERALL_TARGET) 26 @echo "Installing PHP SAPI module: $(PHP_SAPI)" 27 -@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) 28 -@if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \ 29 for i in 0.0.0 0.0 0; do \ 30 if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \ 31 $(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \ 32 break; \ 33 fi; \ 34 done; \ 35 fi 36 @$(INSTALL_IT) 37 38install-modules: build-modules 39 @test -d modules && \ 40 $(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) 41 @echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" 42 @rm -f modules/*.la >/dev/null 2>&1 43 @$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) 44 45install-headers: 46 -@if test "$(INSTALL_HEADERS)"; then \ 47 for i in `echo $(INSTALL_HEADERS)`; do \ 48 i=`$(top_srcdir)/build/shtool path -d $$i`; \ 49 paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \ 50 done; \ 51 $(mkinstalldirs) $$paths && \ 52 echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \ 53 for i in `echo $(INSTALL_HEADERS)`; do \ 54 if test "$(PHP_PECL_EXTENSION)"; then \ 55 src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \ 56 else \ 57 src=$$i; \ 58 fi; \ 59 if test -f "$(top_srcdir)/$$src"; then \ 60 $(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \ 61 elif test -f "$(top_builddir)/$$src"; then \ 62 $(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \ 63 else \ 64 (cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \ 65 cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \ 66 fi \ 67 done; \ 68 fi 69 70PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' 71PHP_TEST_SHARED_EXTENSIONS = ` \ 72 if test "x$(PHP_MODULES)" != "x"; then \ 73 for i in $(PHP_MODULES)""; do \ 74 . $$i; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \ 75 done; \ 76 fi; \ 77 if test "x$(PHP_ZEND_EX)" != "x"; then \ 78 for i in $(PHP_ZEND_EX)""; do \ 79 . $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \ 80 done; \ 81 fi` 82PHP_DEPRECATED_DIRECTIVES_REGEX = '^(define_syslog_variables|register_(globals|long_arrays)?|safe_mode|magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*=' 83 84test: all 85 -@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \ 86 INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \ 87 if test "$$INI_FILE"; then \ 88 $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \ 89 else \ 90 echo > $(top_builddir)/tmp-php.ini; \ 91 fi; \ 92 INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \ 93 if test "$$INI_SCANNED_PATH"; then \ 94 INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \ 95 $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \ 96 fi; \ 97 TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \ 98 TEST_PHP_SRCDIR=$(top_srcdir) \ 99 CC="$(CC)" \ 100 $(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); \ 101 TEST_RESULT_EXIT_CODE=$$?; \ 102 rm $(top_builddir)/tmp-php.ini; \ 103 exit $$TEST_RESULT_EXIT_CODE; \ 104 else \ 105 echo "ERROR: Cannot run tests without CLI sapi."; \ 106 fi 107 108clean: 109 find . -name \*.gcno -o -name \*.gcda | xargs rm -f 110 find . -name \*.lo -o -name \*.o | xargs rm -f 111 find . -name \*.la -o -name \*.a | xargs rm -f 112 find . -name \*.so | xargs rm -f 113 find . -name .libs -a -type d|xargs rm -rf 114 rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/* 115 116distclean: clean 117 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 118 $(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f 119 120.PHONY: all clean install distclean test 121.NOEXPORT: 122