# HG changeset patch # User peter1138 # Date 1151565564 0 # Node ID a83fac319c4e2d6368fe4751b38143a750ce98ff # Parent a507fc64d74bf6c44728e133b9c653395d9c2155 (svn r5426) - Makefile: Make the configure script work properly for setting target compilers; Set CC_TARGET / CXX_TARGET up the same way as CC_HOST / CXX_HOST, and add or fix their options within the configure script. In the Makefile, instead of overriding CC / CXX with the target compilers if they are set, set the target compilers with the default compilers if none are set (bit of a mouthful), and use the target compilers explicitly. diff -r a507fc64d74b -r a83fac319c4e Makefile --- a/Makefile Thu Jun 29 05:55:27 2006 +0000 +++ b/Makefile Thu Jun 29 07:19:24 2006 +0000 @@ -290,21 +290,22 @@ endif # Check if we have a new target -ifdef CXX_TARGET -CXX = $(CXX_TARGET) +ifndef CXX_TARGET +CXX_TARGET = $(CXX_HOST) endif # Check if CC_HOST is defined. If not, it is CC ifndef CC_HOST CC_HOST = $(CC) endif + ifndef CFLAGS_HOST CFLAGS_HOST = $(BASECFLAGS) endif # Check if we have a new target -ifdef CC_TARGET -CC = $(CC_TARGET) +ifndef CC_TARGET +CC_TARGET = $(CC_HOST) endif CC_VERSION = $(shell $(CC) -dumpversion | cut -c 1,3) @@ -859,7 +860,7 @@ # OSX links in os/macosx/Makefile to handle universal binaries better $(TTD): $(OBJS) $(MAKE_CONFIG) @echo '===> Linking $@' - $(Q)$(CXX) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@ + $(Q)$(CXX_TARGET) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@ endif $(STRGEN): strgen/strgen.c endian_host.h @@ -1039,30 +1040,30 @@ .deps/%.d: %.c $(MAKE_CONFIG) table/strings.h endian_target.h @echo '===> DEP $<' - $(Q)$(CC) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ + $(Q)$(CC_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ .deps/%.d: %.cpp $(MAKE_CONFIG) table/strings.h endian_target.h @echo '===> DEP $<' - $(Q)$(CXX) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ + $(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ .deps/%.d: %.m $(MAKE_CONFIG) table/strings.h endian_target.h @echo '===> DEP $<' - $(Q)$(CC) $(OBJCFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ + $(Q)$(CC_TARGET) $(OBJCFLAGS) $(CDEFS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@ ifndef MACOSX_BUILD # OSX uses os/macosx/Makefile to compile files %.o: %.c $(MAKE_CONFIG) @echo '===> Compiling $<' - $(Q)$(CC) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< + $(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< %.o: %.cpp $(MAKE_CONFIG) @echo '===> Compiling $<' - $(Q)$(CXX) $(CFLAGS) $(CDEFS) -c -o $@ $< + $(Q)$(CXX_TARGET) $(CFLAGS) $(CDEFS) -c -o $@ $< %.o: %.m $(MAKE_CONFIG) @echo '===> Compiling $<' - $(Q)$(CC) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< + $(Q)$(CC_TARGET) $(CC_CFLAGS) $(CFLAGS) $(CDEFS) -c -o $@ $< endif %.o: %.rc diff -r a507fc64d74b -r a83fac319c4e configure --- a/configure Thu Jun 29 05:55:27 2006 +0000 +++ b/configure Thu Jun 29 07:19:24 2006 +0000 @@ -17,6 +17,7 @@ echo " --target-cc Sets the target-compiler [\$CC]" echo " --target-cxx Sets the C++ target-compiler []" echo " --host-cc Sets the host-compiler [\$CC]" + echo " --host-cxx Sets the C++ host-compiler []" echo " --os Sets the OS. Listens to: [detected]" echo " UNIX, OSX, FREEBSD, MORPHOS" echo " BEOS, SUNOS, CYGWIN, MINGW" @@ -85,17 +86,23 @@ ITEM="CC_TARGET" ;; --target-cxx=*) - TARGET_CXX=`awk 'BEGIN { FS="="; $0="'"$n"'"; print $2;}'` + handle "CXX_TARGET" "$n" ;; --target-cxx) - SITEM="TARGET_CXX" + SITEM="CXX_TARGET" ;; --host-cc=*) - handle CC_HOST "$n" + handle "CC_HOST" "$n" ;; --host-cc) ITEM="CC_HOST" ;; + --host-cxx=*) + handle "CXX_HOST" "$n" + ;; + --host-cxx) + ITEM="CXX_HOST" + ;; --host-cflags=*) handle CFLAGS_HOST "$n" ;; @@ -182,7 +189,7 @@ --libpng-config=*) handle LIBPNG_CONFIG "$n" ;; - --lib-png-config) + --libpng-config) ITEM="LIBPNG_CONFIG" ;; @@ -268,15 +275,8 @@ . Makefile.run rm -f Makefile.run -# Makefile.config currently doesn't support custom CXX, so, we add the line -# ourself! - -if ! test -z "$TARGET_CXX" -then - echo "CXX=$TARGET_CXX" >> Makefile.config -fi - -# Same for RELEASE (read: REVISION) +# Makefile.config currently doesn't support custom RELEASE (revision), so, we add the line +# yourself! if ! test -z "$RELEASE" then