]> granicus.if.org Git - php/commitdiff
Join build makefiles together
authorPeter Kokot <peterkokot@gmail.com>
Tue, 16 Apr 2019 22:09:36 +0000 (00:09 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Wed, 17 Apr 2019 19:52:58 +0000 (21:52 +0200)
Changes:
- Joins build/build.mk and build/build2.mk files together since there
  isn't any practical reason for having two different files with the
  current build system.
- Makefile is now more portable. All special syntaxes are omitted, for
  example, a conditional assignment operators `?=`. This makes buildconf
  more useful on Solaris make derivative, so there is no longer need to
  override make with gmake: `MAKE=gmake ./buildconf`.
- Suppressing autoconf and autoheader warnings is not needed anymore
  with current build system. Instead, the option `-Wall` has been used
  when running `./buildconf --debug` to get more useful debug info
  about current M4.

build/build.mk
build/build2.mk [deleted file]
buildconf

index bf7bbf4be5e27f0c57e6c99ecd1aaffc654ed803..46cb0c3360ab88f09ee853b5a472bdd070e8313b 100644 (file)
 # Makefile to generate build tools
 #
 
-SUBDIRS = Zend TSRM
+subdirs = Zend TSRM
+stamp = buildmk.stamp
+config_h_in = main/php_config.h.in
+PHP_AUTOCONF = autoconf
+PHP_AUTOHEADER = autoheader
+PHP_AUTOCONF_FLAGS = -f
 
-STAMP = buildmk.stamp
+all: $(stamp) configure $(config_h_in)
 
-all: $(STAMP)
-       @$(MAKE) -s -f build/build2.mk
+$(stamp): build/buildcheck.sh
+       @build/buildcheck.sh $@
 
-$(STAMP): build/buildcheck.sh
-       @build/buildcheck.sh $(STAMP)
+configure: aclocal.m4 configure.ac $(PHP_M4_FILES)
+       @echo rebuilding $@
+       @rm -f $@
+       @$(PHP_AUTOCONF) $(PHP_AUTOCONF_FLAGS)
+
+aclocal.m4: configure.ac acinclude.m4
+       @echo rebuilding $@
+       @cat acinclude.m4 ./build/libtool.m4 > $@
+
+$(config_h_in): configure
+# Explicitly remove target since autoheader does not seem to work correctly
+# otherwise (timestamps are not updated). Also disable PACKAGE_* symbols in the
+# generated php_config.h.in template.
+       @echo rebuilding $@
+       @rm -f $@
+       @$(PHP_AUTOHEADER) $(PHP_AUTOCONF_FLAGS)
+       @sed -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $@ > $@.tmp && mv $@.tmp $@
 
 snapshot:
        distname='$(DISTNAME)'; \
@@ -36,8 +56,8 @@ snapshot:
        myname=`basename \`pwd\`` ; \
        cd .. && cp -rp $$myname $$distname; \
        cd $$distname; \
-       rm -f $(SUBDIRS) 2>/dev/null || true; \
-       for i in $(SUBDIRS); do \
+       rm -f $(subdirs) 2>/dev/null || true; \
+       for i in $(subdirs); do \
                test -d $$i || (test -d ../$$i && cp -rp ../$$i $$i); \
        done; \
        find . -type l -exec rm {} \; ; \
diff --git a/build/build2.mk b/build/build2.mk
deleted file mode 100644 (file)
index b6b0343..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#  +----------------------------------------------------------------------+
-#  | PHP Version 7                                                        |
-#  +----------------------------------------------------------------------+
-#  | Copyright (c) The PHP Group                                          |
-#  +----------------------------------------------------------------------+
-#  | This source file is subject to version 3.01 of the PHP license,      |
-#  | that is bundled with this package in the file LICENSE, and is        |
-#  | available through the world-wide-web at the following url:           |
-#  | http://www.php.net/license/3_01.txt                                  |
-#  | If you did not receive a copy of the PHP license and are unable to   |
-#  | obtain it through the world-wide-web, please send a note to          |
-#  | license@php.net so we can mail you a copy immediately.               |
-#  +----------------------------------------------------------------------+
-#  | Author: Sascha Schumann <sascha@schumann.cx>                         |
-#  +----------------------------------------------------------------------+
-
-config_h_in = main/php_config.h.in
-
-targets = configure $(config_h_in)
-
-PHP_AUTOCONF ?= 'autoconf'
-PHP_AUTOHEADER ?= 'autoheader'
-
-SUPPRESS_WARNINGS ?= 2>&1 | (egrep -v '(AC_PROG_CXXCPP was called before AC_PROG_CXX|defined in acinclude.m4 but never used)'||true)
-
-all: $(targets)
-
-$(config_h_in): configure
-# Explicitly remove target since autoheader does not seem to work correctly
-# otherwise (timestamps are not updated). Also disable PACKAGE_* symbols in the
-# generated php_config.h.in template.
-       @echo rebuilding $@
-       @rm -f $@
-       $(PHP_AUTOHEADER) $(SUPPRESS_WARNINGS)
-       sed -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $@ > $@.tmp && mv $@.tmp $@
-
-aclocal.m4: configure.ac acinclude.m4
-       @echo rebuilding $@
-       cat acinclude.m4 ./build/libtool.m4 > $@
-
-configure: aclocal.m4 configure.ac $(M4_FILES)
-       @echo rebuilding $@
-       @rm -f $@
-       $(PHP_AUTOCONF) -f $(SUPPRESS_WARNINGS)
index 2b2f8f696ad5e1ac98da8fb5ab835e2a69412d82..7d3aaedc6ba0e7f01a12c2d7cf279c72d5fc3d28 100755 (executable)
--- a/buildconf
+++ b/buildconf
@@ -3,6 +3,8 @@
 # A wrapper around Autoconf that generates files to build PHP on *nix systems.
 
 MAKE=${MAKE:-make}
+PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf}
+PHP_AUTOHEADER=${PHP_AUTOHEADER:-autoheader}
 force=0
 debug=0
 
@@ -91,11 +93,14 @@ fi
 
 echo "buildconf: Building configure files"
 
-# List of *.m4 prerequisites files for the make configure target.
-M4_FILES=$(echo TSRM/*.m4 Zend/*.m4 ext/*/config*.m4 sapi/*/config*.m4)
-
 if test "$debug" = "1"; then
-  $MAKE -s -f build/build.mk M4_FILES="$M4_FILES" SUPPRESS_WARNINGS=""
+  autoconf_flags="-f -Wall"
 else
-  $MAKE -s -f build/build.mk M4_FILES="$M4_FILES"
+  autoconf_flags="-f"
 fi
+
+$MAKE -s -f build/build.mk \
+  PHP_AUTOCONF="$PHP_AUTOCONF" \
+  PHP_AUTOHEADER="$PHP_AUTOHEADER" \
+  PHP_AUTOCONF_FLAGS="$autoconf_flags" \
+  PHP_M4_FILES="$(echo TSRM/*.m4 Zend/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"