source: trunk/server/common/oursrc/php_scripts/test/Makefile.global @ 1137

Last change on this file since 1137 was 1137, checked in by quentin, 14 years ago
Import scripts PHP module
File size: 5.6 KB
Line 
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 = -n -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`
82
83test: all
84        -@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
85                TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
86                TEST_PHP_SRCDIR=$(top_srcdir) \
87                CC="$(CC)" \
88                        $(PHP_EXECUTABLE) $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -d extension_dir=modules/ $(PHP_TEST_SHARED_EXTENSIONS) tests/; \
89        elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
90                INI_FILE=`$(top_builddir)/$(SAPI_CLI_PATH) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
91                if test "$$INI_FILE"; then \
92                        $(EGREP) -v '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
93                else \
94                        echo > $(top_builddir)/tmp-php.ini; \
95                fi; \
96                INI_SCANNED_PATH=`$(top_builddir)/$(SAPI_CLI_PATH) -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 '^(zend_)?extension(_debug)?(_ts)?[\t\ ]*=' "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
100                fi; \
101                TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
102                TEST_PHP_SRCDIR=$(top_srcdir) \
103                CC="$(CC)" \
104                        $(top_builddir)/$(SAPI_CLI_PATH) -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        else \
106                echo "ERROR: Cannot run tests without CLI sapi."; \
107        fi
108
109clean:
110        find . -name \*.gcno -o -name \*.gcda | xargs rm -f
111        find . -name \*.lo -o -name \*.o | xargs rm -f
112        find . -name \*.la -o -name \*.a | xargs rm -f
113        find . -name \*.so | xargs rm -f
114        find . -name .libs -a -type d|xargs rm -rf
115        rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
116
117distclean: clean
118        rm -f config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h php5.spec sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
119        $(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
120        find . -name Makefile | xargs rm -f
121
122.PHONY: all clean install distclean test
123.NOEXPORT:
Note: See TracBrowser for help on using the repository browser.