From 2cb47d686eff408aab237c0a54f9094a7fc1bd76 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 2 Jul 2004 07:56:07 +0000 Subject: 2004-07-01 Paolo Bonzini * Makefile.def (build_modules): Add bison, byacc, flex, m4, texinfo. (flags_to_pass): Add FLEX. * Makefile.tpl (BUILD_DIR_PREFIX, BASE_EXPORTS): New. (BUILD_EXPORTS, HOST_EXPORTS, BASE_TARGET_EXPORTS): Include it. (DEFAULT_YACC, USUAL_YACC, DEFAULT_LEX, USUAL_LEX, DEFAULT_M4, DEFAULT_MAKEINFO): Remove. (CONFIGURED_YACC, CONFIGURED_FLEX, CONFIGURED_BISON, CONFIGURED_LEX, CONFIGURED_M4, CONFIGURED_MAKEINFO): Substitute. (YACC, FLEX, BISON, LEX, M4, MAKEINFO): Define to look into objdir or else use configured tool. (all-build): New. (all): Depend on it. (Build module dependencies): Add. * Makefile.in: Regenerate. * configure.in: Better support for multiple build modules, matching what is done for host/target modules. Do not look for "plausible" locations of build tools if Canadian cross. Use autoconf's AC_PROG_CC to find a C compiler. Define BUILD_DIR_PREFIX. Look for flex, makeinfo and m4. * configure: Regenerate. --- Makefile.tpl | 101 ++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 65 insertions(+), 36 deletions(-) (limited to 'Makefile.tpl') diff --git a/Makefile.tpl b/Makefile.tpl index 982620d53..014aa879c 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -113,11 +113,23 @@ BUILD_SUBDIR = @build_subdir@ # This is set by the configure script to the arguments to use when configuring # directories built for the build system. BUILD_CONFIGARGS = @build_configargs@ + +# This is the list of variables to export in the environment when +# configuring any subdirectory. It must also be exported whenever +# recursing into a build directory in case that directory's Makefile +# re-runs configure. +BASE_EXPORTS = \ + FLEX="$(FLEX)"; export FLEX; \ + LEX="$(LEX)"; export LEX; \ + BISON="$(BISON)"; export BISON; \ + YACC="$(YACC)"; export YACC; \ + M4="$(M4)"; export M4; \ + MAKEINFO="$(MAKEINFO)"; export MAKEINFO; + # This is the list of variables to export in the environment when -# configuring subdirectories for the build system. It must also be -# exported whenever recursing into a build directory in case that -# directory's Makefile re-runs configure. +# configuring subdirectories for the build system. BUILD_EXPORTS = \ + $(BASE_EXPORTS) \ AR="$(AR_FOR_BUILD)"; export AR; \ AS="$(AS_FOR_BUILD)"; export AS; \ CC="$(CC_FOR_BUILD)"; export CC; \ @@ -140,10 +152,9 @@ SUBDIRS = @configdirs@ # directories built for the host system. HOST_CONFIGARGS = @host_configargs@ # This is the list of variables to export in the environment when -# configuring subdirectories for the host system. It must also be -# exported whenever recursing into a host directory in case that -# directory's Makefile re-runs configure. +# configuring subdirectories for the host system. HOST_EXPORTS = \ + $(BASE_EXPORTS) \ CC="$(CC)"; export CC; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \ CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ @@ -179,10 +190,9 @@ TARGET_SUBDIR = @target_subdir@ # directories built for the target. TARGET_CONFIGARGS = @target_configargs@ # This is the list of variables to export in the environment when -# configuring subdirectories for the host system. It must also be -# exported whenever recursing into a host directory in case that -# directory's Makefile re-runs configure. +# configuring subdirectories for the host system. BASE_TARGET_EXPORTS = \ + $(BASE_EXPORTS) \ AR="$(AR_FOR_TARGET)"; export AR; \ AS="$(AS_FOR_TARGET)"; export AS; \ CC="$(CC_FOR_TARGET)"; export CC; \ @@ -233,47 +243,55 @@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ CXX_FOR_BUILD = $(CXX) +# Path to the build directory for a Canadian cross, empty otherwise. +BUILD_DIR_PREFIX = @BUILD_DIR_PREFIX@ + # Special variables passed down in EXTRA_GCC_FLAGS. They are defined # here so that they can be overridden by Makefile fragments. BUILD_PREFIX = @BUILD_PREFIX@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ -BISON=@BISON@ -USUAL_BISON = `if [ -f $$r/bison/bison ] ; then \ - echo $$r/bison/bison -L $$s/bison/ ; \ +CONFIGURED_BISON = @CONFIGURED_BISON@ +BISON = `if [ -f $$r/$(BUILD_DIR_PREFIX)/bison/bison ] ; then \ + echo $$r/$(BUILD_DIR_PREFIX)/bison/bison -L $$s/bison/ ; \ else \ - echo bison ; \ + echo ${CONFIGURED_BISON} ; \ fi` -DEFAULT_YACC = @DEFAULT_YACC@ -YACC=@YACC@ -USUAL_YACC = `if [ -f $$r/bison/bison ] ; then \ - echo $$r/bison/bison -y -L $$s/bison/ ; \ - elif [ -f $$r/byacc/byacc ] ; then \ - echo $$r/byacc/byacc ; \ +CONFIGURED_YACC = @CONFIGURED_YACC@ +YACC = `if [ -f $$s/$(BUILD_DIR_PREFIX)/bison/bison ] ; then \ + echo $$r/$(BUILD_DIR_PREFIX)/bison/bison -y -L $$s/bison/ ; \ + elif [ -f $$s/$(BUILD_DIR_PREFIX)/byacc/byacc ] ; then \ + echo $$r/$(BUILD_DIR_PREFIX)/byacc/byacc ; \ else \ - echo ${DEFAULT_YACC} ; \ + echo ${CONFIGURED_YACC} ; \ fi` -DEFAULT_LEX = @DEFAULT_LEX@ -LEX=@LEX@ -USUAL_LEX = `if [ -f $$r/flex/flex ] ; \ - then echo $$r/flex/flex ; \ - else echo ${DEFAULT_LEX} ; fi` +CONFIGURED_FLEX = @CONFIGURED_FLEX@ +FLEX = `if [ -f $$r/$(BUILD_DIR_PREFIX)/flex/flex ] ; \ + then echo $$r/$(BUILD_DIR_PREFIX)/flex/flex ; \ + else echo ${CONFIGURED_FLEX} ; fi` + +CONFIGURED_LEX = @CONFIGURED_LEX@ +LEX = `if [ -f $$r/$(BUILD_DIR_PREFIX)/flex/flex ] ; \ + then echo $$r/$(BUILD_DIR_PREFIX)/flex/flex ; \ + else echo ${CONFIGURED_LEX} ; fi` -DEFAULT_M4 = @DEFAULT_M4@ -M4 = `if [ -f $$r/m4/m4 ] ; \ - then echo $$r/m4/m4 ; \ - else echo ${DEFAULT_M4} ; fi` +CONFIGURED_M4 = @CONFIGURED_M4@ +M4 = `if [ -f $$r/$(BUILD_DIR_PREFIX)/m4/m4 ] ; \ + then echo $$r/$(BUILD_DIR_PREFIX)/m4/m4 ; \ + else echo ${CONFIGURED_M4} ; fi` # For an installed makeinfo, we require it to be from texinfo 4.2 or -# higher, else we use the "missing" dummy. -MAKEINFO=@MAKEINFO@ -USUAL_MAKEINFO = `if [ -f $$r/texinfo/makeinfo/makeinfo ] ; \ - then echo $$r/texinfo/makeinfo/makeinfo ; \ - else if (makeinfo --version \ +# higher, else we use the "missing" dummy. We also pass the subdirectory +# makeinfo even if only the Makefile is there, because Texinfo builds its +# manual when made, and it requires its own version. +CONFIGURED_MAKEINFO = @CONFIGURED_MAKEINFO@ +MAKEINFO = `if [ -f $$r/$(BUILD_DIR_PREFIX)/texinfo/makeinfo/Makefile ] ; \ + then echo $$r/$(BUILD_DIR_PREFIX)/texinfo/makeinfo/makeinfo ; \ + else if (${CONFIGURED_MAKEINFO} --version \ | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \ - then echo makeinfo; else echo $$s/missing makeinfo; fi; fi` + then echo ${CONFIGURED_MAKEINFO}; else echo $$s/missing makeinfo; fi; fi` # This just becomes part of the MAKEINFO definition passed down to # sub-makes. It lets flags be given on the command line while still @@ -577,8 +595,13 @@ configure-target: [+ # The target built for a native non-bootstrap build. .PHONY: all -all: @all_build_modules@ all-host all-target +all: all-build all-host all-target +.PHONY: all-build +all-build: [+ + FOR build_modules +] \ + maybe-all-build-[+module+][+ + ENDFOR build_modules +] .PHONY: all-host all-host: maybe-all-gcc [+ FOR host_modules +] \ @@ -1642,6 +1665,12 @@ profiledbootstrap: all-bootstrap configure-gcc # are specified by depending on a 'maybe-' target. If you're not sure, # it's safer to use a soft dependency. +# Build modules +all-build-bison: maybe-all-build-texinfo +all-build-flex: maybe-all-build-texinfo +all-build-libiberty: maybe-all-build-texinfo +all-build-m4: maybe-all-build-libiberty maybe-all-build-texinfo + # Host modules specific to gcc. # GCC needs to identify certain tools. # GCC also needs the information exported by the intl configure script. -- cgit v1.2.3