On Wed, Dec 12, 2012 at 11:32 PM, Paolo Bonzini <bonz...@gnu.org> wrote: > Il 13/12/2012 00:23, H.J. Lu ha scritto: >> On Wed, Dec 12, 2012 at 3:01 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >>> On Wed, Dec 12, 2012 at 2:13 PM, Paolo Bonzini <bonz...@gnu.org> wrote: >>>> Il 12/12/2012 19:11, H.J. Lu ha scritto: >>>>>>>>> >>>>>>>>> in RAW_CXX_TARGET_EXPORTS. There is no need to do anything. >>>>>>> >>>>>>> Nope, if you remove this you get the wrong definition of CC and CXX from >>>>>>> EXTRA_TARGET_FLAGS. Instead, you need to add RAW_CXX_FOR_TARGET to >>>>>>> AM_MAKEFLAGS and EXTRA_TARGET_FLAGS. >>>>>>> >>>>> We have set CXX and CXX_FOR_TARGET before EXTRA_TARGET_FLAGS >>>>> is used: >>>>> >>>>> RAW_CXX_TARGET_EXPORTS = \ >>>>> $(BASE_TARGET_EXPORTS) \ >>>>> CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ >>>>> CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; >>>>> export CXX; >>>>> >>>>> Shouldn't we the right CXX and CXX_FOR_TARGET? >>>> >>>> The purpose of EXTRA_TARGET_FLAGS is to forward any *_FOR_TARGET >>>> variable passed on the command line to the toplevel Makefile. >>>> >>> >>> We don't pass down RAW_CXX_FOR_TARGET from toplevel >>> Makefile. If one wants to change RAW_CXX_FOR_TARGET >>> from command line, he/she should do >>> >>> # make RAW_CXX_FOR_TARGET=xxx >>> >>> and RAW_CXX_TARGET_EXPORTS should handle it properly. > > NORMAL_TARGET_EXPORTS and RAW_CXX_TARGET_EXPORTS is (mostly) for > configure time. Makefiles do not use the environment variables, so you > need EXTRA_TARGET_FLAGS (and more generally the args argument to the > "all" macro) instead. > >> >> Also there are: >> >> # ------------------------------ >> # Special directives to GNU Make >> # ------------------------------ >> >> # Don't pass command-line variables to submakes. >> .NOEXPORT: >> MAKEOVERRIDES= >> >> in toplevel Makefile. How does >> >> # make *_FOR_TARGET=xxxx >> >> work at toplevel? > > That's what I'm trying to say: the purpose of EXTRA_TARGET_FLAGS is to > forward any *_FOR_TARGET>> variable passed on the command line to the > toplevel Makefile. > > Paolo
This patch allows me to override RAW_CXX_FOR_TARGET from command-line at toplevel. -- H.J. --- 2012-12-17 H.J. Lu <hongjiu...@intel.com> * Makefile.tpl (CXX_FOR_TARGET_FLAG_TO_PASS): Add "RAW_CXX_FOR_TARGET=$(RAW_CXX_FOR_TARGET)" if we are building libstdc++-v3. (target_modules): Remove 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'. * Makefile.in: Regenerated. diff --git a/Makefile.tpl b/Makefile.tpl index 5cdc119..c0e0106 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -574,6 +574,7 @@ CXX_FOR_TARGET_FLAG_TO_PASS = \ # really work, for C++ host programs can't depend on the current-stage # C++ target library. CXX_FOR_TARGET_FLAG_TO_PASS = \ + "RAW_CXX_FOR_TARGET=$(RAW_CXX_FOR_TARGET)" \ $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi) @endif target-libstdc++-v3 @@ -1281,7 +1282,7 @@ maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+] [+ all prefix="target-" subdir="$(TARGET_SUBDIR)" exports="$(RAW_CXX_TARGET_EXPORTS)" - args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +] + args="$(EXTRA_TARGET_FLAGS)" +] [+ ELSE +] [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" check_multilibs=true @@ -1313,11 +1314,7 @@ ELSE normal_cxx +] $(NORMAL_TARGET_EXPORTS) \[+ ENDIF raw_cxx +] (cd $(TARGET_SUBDIR)/[+module+] && \ - $(MAKE) $(TARGET_FLAGS_TO_PASS) [+ - IF raw_cxx - +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ - ENDIF raw_cxx - +] [+extra_make_flags+] check) + $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] check) [+ ENDIF no_check +] @endif target-[+module+]