xref: /PHP-5.6/Makefile.global (revision 6772fbff)
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
16build-binaries: $(PHP_BINARIES)
17
18libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
19	$(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 $@
20	-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
21
22libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
23	$(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
24
25install: $(all_targets) $(install_targets)
26
27install-sapi: $(OVERALL_TARGET)
28	@echo "Installing PHP SAPI module:       $(PHP_SAPI)"
29	-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
30	-@if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \
31		for i in 0.0.0 0.0 0; do \
32			if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \
33				$(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \
34				break; \
35			fi; \
36		done; \
37	fi
38	@$(INSTALL_IT)
39
40install-binaries: build-binaries $(install_binary_targets)
41
42install-modules: build-modules
43	@test -d modules && \
44	$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
45	@echo "Installing shared extensions:     $(INSTALL_ROOT)$(EXTENSION_DIR)/"
46	@rm -f modules/*.la >/dev/null 2>&1
47	@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
48
49install-headers:
50	-@if test "$(INSTALL_HEADERS)"; then \
51		for i in `echo $(INSTALL_HEADERS)`; do \
52			i=`$(top_srcdir)/build/shtool path -d $$i`; \
53			paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
54		done; \
55		$(mkinstalldirs) $$paths && \
56		echo "Installing header files:           $(INSTALL_ROOT)$(phpincludedir)/" && \
57		for i in `echo $(INSTALL_HEADERS)`; do \
58			if test "$(PHP_PECL_EXTENSION)"; then \
59				src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
60			else \
61				src=$$i; \
62			fi; \
63			if test -f "$(top_srcdir)/$$src"; then \
64				$(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
65			elif test -f "$(top_builddir)/$$src"; then \
66				$(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
67			else \
68				(cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
69				cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
70			fi \
71		done; \
72	fi
73
74PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1'
75PHP_TEST_SHARED_EXTENSIONS =  ` \
76	if test "x$(PHP_MODULES)" != "x"; then \
77		for i in $(PHP_MODULES)""; do \
78			. $$i; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
79		done; \
80	fi; \
81	if test "x$(PHP_ZEND_EX)" != "x"; then \
82		for i in $(PHP_ZEND_EX)""; do \
83			. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
84		done; \
85	fi`
86PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
87
88test: all
89	@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
90		INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
91		if test "$$INI_FILE"; then \
92			$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
93		else \
94			echo > $(top_builddir)/tmp-php.ini; \
95		fi; \
96		INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
97		if test "$$INI_SCANNED_PATH"; then \
98			INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
99			$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
100		fi; \
101		TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
102		TEST_PHP_SRCDIR=$(top_srcdir) \
103		CC="$(CC)" \
104			$(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); \
105		TEST_RESULT_EXIT_CODE=$$?; \
106		rm $(top_builddir)/tmp-php.ini; \
107		exit $$TEST_RESULT_EXIT_CODE; \
108	else \
109		echo "ERROR: Cannot run tests without CLI sapi."; \
110	fi
111
112clean:
113	find . -name \*.gcno -o -name \*.gcda | xargs rm -f
114	find . -name \*.lo -o -name \*.o | xargs rm -f
115	find . -name \*.la -o -name \*.a | xargs rm -f
116	find . -name \*.so | xargs rm -f
117	find . -name .libs -a -type d|xargs rm -rf
118	rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_MILTER_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
119
120distclean: clean
121	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 stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module sapi/apache_hooks/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
122	rm -f php5.spec main/build-defs.h scripts/phpize
123	rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
124	rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
125	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
126	rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
127	rm -f ext/phar/phar.phar ext/phar/phar.php
128	if test "$(srcdir)" != "$(builddir)"; then \
129	  rm -f ext/phar/phar/phar.inc; \
130	fi
131	$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
132
133.PHONY: all clean install distclean test
134.NOEXPORT:
135