1mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p 2INSTALL = $(top_srcdir)/build/shtool install -c 3INSTALL_DATA = $(INSTALL) -m 644 4 5COMMON_FLAGS = $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH) 6 7all: $(all_targets) 8 @echo 9 @echo "Build complete." 10 @echo "Don't forget to run 'make test'." 11 @echo 12 13build-modules: $(PHP_MODULES) $(PHP_ZEND_EX) 14 15build-binaries: $(PHP_BINARIES) 16 17libphp.la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) 18 $(LIBTOOL) --tag=CC --mode=link $(CC) $(LIBPHP_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ 19 -@$(LIBTOOL) --tag=CC --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1 20 21libs/libphp.bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) 22 $(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.so 23 24install: $(all_targets) $(install_targets) 25 26install-sapi: $(OVERALL_TARGET) 27 @echo "Installing PHP SAPI module: $(PHP_SAPI)" 28 -@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) 29 -@if test ! -r $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME); then \ 30 for i in 0.0.0 0.0 0; do \ 31 if test -r $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME).$$i; then \ 32 $(LN_S) $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp.$(SHLIB_DL_SUFFIX_NAME); \ 33 break; \ 34 fi; \ 35 done; \ 36 fi 37 @$(INSTALL_IT) 38 39install-binaries: build-binaries $(install_binary_targets) 40 41install-modules: build-modules 42 @test -d modules && \ 43 $(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR) 44 @echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/" 45 @rm -f modules/*.la >/dev/null 2>&1 46 @$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR) 47 48install-headers: 49 -@if test "$(INSTALL_HEADERS)"; then \ 50 for i in `echo $(INSTALL_HEADERS)`; do \ 51 i=`$(top_srcdir)/build/shtool path -d $$i`; \ 52 paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \ 53 done; \ 54 $(mkinstalldirs) $$paths && \ 55 echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \ 56 for i in `echo $(INSTALL_HEADERS)`; do \ 57 if test "$(PHP_PECL_EXTENSION)"; then \ 58 src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \ 59 else \ 60 src=$$i; \ 61 fi; \ 62 if test -f "$(top_srcdir)/$$src"; then \ 63 $(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \ 64 elif test -f "$(top_builddir)/$$src"; then \ 65 $(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \ 66 else \ 67 (cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \ 68 cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \ 69 fi \ 70 done; \ 71 fi 72 73PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' 74PHP_TEST_SHARED_EXTENSIONS = ` \ 75 if test "x$(PHP_MODULES)" != "x"; then \ 76 for i in $(PHP_MODULES)""; do \ 77 . $$i; \ 78 if test "x$$dlname" != "xdl_test.so"; then \ 79 $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \ 80 fi; \ 81 done; \ 82 fi; \ 83 if test "x$(PHP_ZEND_EX)" != "x"; then \ 84 for i in $(PHP_ZEND_EX)""; do \ 85 . $$i; $(top_srcdir)/build/shtool echo -n -- " -d zend_extension=$(top_builddir)/modules/$$dlname"; \ 86 done; \ 87 fi` 88PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*=' 89 90test: all 91 @if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \ 92 INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \ 93 if test "$$INI_FILE"; then \ 94 $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \ 95 else \ 96 echo > $(top_builddir)/tmp-php.ini; \ 97 fi; \ 98 INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \ 99 if test "$$INI_SCANNED_PATH"; then \ 100 INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \ 101 $(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \ 102 fi; \ 103 TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \ 104 TEST_PHP_SRCDIR=$(top_srcdir) \ 105 CC="$(CC)" \ 106 $(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); \ 107 TEST_RESULT_EXIT_CODE=$$?; \ 108 rm $(top_builddir)/tmp-php.ini; \ 109 exit $$TEST_RESULT_EXIT_CODE; \ 110 else \ 111 echo "ERROR: Cannot run tests without CLI sapi."; \ 112 fi 113 114clean: 115 find . -name \*.gcno -o -name \*.gcda | xargs rm -f 116 find . -name \*.lo -o -name \*.o -o -name \*.dep | xargs rm -f 117 find . -name \*.la -o -name \*.a | xargs rm -f 118 find . -name \*.so | xargs rm -f 119 find . -name .libs -a -type d|xargs rm -rf 120 rm -f libphp.la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/* 121 rm -f ext/opcache/jit/ir/gen_ir_fold_hash 122 rm -f ext/opcache/jit/ir/minilua 123 rm -f ext/opcache/jit/ir/ir_fold_hash.h 124 rm -f ext/opcache/jit/ir/ir_emit_x86.h 125 rm -f ext/opcache/jit/ir/ir_emit_aarch64.h 126 127distclean: clean 128 rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h 129 rm -f main/build-defs.h scripts/phpize 130 rm -f ext/date/lib/timelib_config.h ext/mbstring/libmbfl/config.h 131 rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1 132 rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html 133 rm -f ext/phar/phar.phar ext/phar/phar.php 134 if test "$(srcdir)" != "$(builddir)"; then \ 135 rm -f ext/phar/phar/phar.inc; \ 136 fi 137 138prof-gen: 139 CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-generate all 140 find . -name \*.gcda | xargs rm -f 141 142prof-clean: 143 find . -name \*.lo -o -name \*.o | xargs rm -f 144 find . -name \*.la -o -name \*.a | xargs rm -f 145 find . -name \*.so | xargs rm -f 146 rm -f libphp.la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/* 147 148prof-use: 149 CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-use all 150 151%_arginfo.h: %.stub.php 152 @if test -e "$(top_srcdir)/build/gen_stub.php"; then \ 153 if test ! -z "$(PHP)"; then \ 154 echo Parse $< to generate $@;\ 155 $(PHP) $(top_srcdir)/build/gen_stub.php $<; \ 156 elif test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \ 157 echo Parse $< to generate $@;\ 158 $(PHP_EXECUTABLE) $(top_srcdir)/build/gen_stub.php $<; \ 159 fi; \ 160 fi; 161 162.PHONY: all clean install distclean test prof-gen prof-clean prof-use 163