Changeset - r6523:c1052c027a20
[Not reviewed]
master
0 2 0
truelight - 18 years ago 2007-04-21 13:19:43
truelight@openttd.org
(svn r9710) -Add: added support for GCC 2.95. This makes MorphOS target alive again. With a big thanks to tokai and Rubidium!!
2 files changed with 24 insertions and 0 deletions:
0 comments (0 inline, 0 general)
Makefile.src.in
Show inline comments
 
@@ -25,12 +25,13 @@ OS           = !!OS!!
 
STAGE        = !!STAGE!!
 
MAKEDEPEND   = !!MAKEDEPEND!!
 
CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!!
 
SORT         = !!SORT!!
 
REVISION     = !!REVISION!!
 
AWK          = !!AWK!!
 
GCC295       = !!GCC295!!
 
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
 
CONFIG_CACHE_LINKER   = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
 
CONFIG_CACHE_ENDIAN   = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!!
 
CONFIG_CACHE_SOURCE   = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_SOURCE!!
 
CONFIG_CACHE_VERSION  = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_VERSION!!
 

	
 
@@ -48,12 +49,23 @@ RES      := $(shell mkdir -p $(BIN_DIR) 
 

	
 
# Make sure endian_target.h is reasable as if it was in the src/ dir
 
CFLAGS += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR)
 

	
 
ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
 

	
 
# This 'sed' basicly just removes 'const' from the line if it is a 2+D array
 
# For more information, please check:
 
#  http://maillist.openttd.org/pipermail/devs/2007-April/000284.html
 
#  http://maillist.openttd.org/pipermail/devs/2007-February/000248.html
 
GCC295_FIX=sed -r 's/^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$/\1\2 \4\6\8\9/g'
 
# This 'sed' removes the 3rd '4' in the # lines of the -E output of
 
#  gcc 2.95.3 and lower, as it should indicate that it is a C-linkage, but the
 
#  compiler can't handle that information (just don't ask). So we remove it
 
#  and then it compiles happily and without bitching :)
 
GCC295_FIX_2=sed -e 's|\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$|\1|g'
 

	
 
# Check if we want to show what we are doing
 
ifdef VERBOSE
 
	Q =
 
	E = @true
 
else
 
	Q = @
 
@@ -207,13 +219,17 @@ endif
 
$(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
 
	$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
 
	$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $<
 

	
 
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
 
	$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
 
ifeq ($(GCC295), 1)
 
	$(Q)$(CXX_HOST) -E $(CFLAGS) $< | $(GCC295_FIX) | $(GCC295_FIX_2) | $(CXX_HOST) $(CFLAGS) -c -o $@ -x c++ -
 
else
 
	$(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $<
 
endif
 

	
 
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
 
	$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
 
	$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
 

	
 
$(OBJS_RC): %.o: $(SRC_DIR)/%.rc $(FILE_DEP)
config.lib
Show inline comments
 
@@ -670,12 +670,19 @@ make_cflags_and_ldflags() {
 
		CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
 
		CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
 

	
 
		CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
 
	fi
 

	
 
	gcc295=""
 
	if [ "$cc_version" = 29 ]; then
 
		# Make sure we mark GCC 2.95 flag for Makefile.src.in, as we
 
		#  need a lovely hack there to make it compile correctly.
 
		gcc295="1"
 
	fi
 

	
 
	if [ $cc_version -ge 30 ]; then
 
		CFLAGS="$CFLAGS -W -Wno-unused-parameter"
 
	fi
 

	
 
	if [ $cc_version -ge 34 ]; then
 
		CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition"
 
@@ -1850,12 +1857,13 @@ make_sed() {
 
		s#!!OBJS_RC!!#$OBJS_RC#g;
 
		s#!!SRCS!!#$SRCS#g;
 
		s#!!OS!!#$os#g;
 
		s#!!CONFIGURE_FILES!!#$CONFIGURE_FILES#g;
 
		s#!!REVISION!!#$revision#g;
 
		s#!!AWK!!#$awk#g;
 
		s#!!GCC295!!#$gcc295#g;
 
		s#!!ENABLE_INSTALL!!#$enable_install#g;
 
	"
 
}
 

	
 
generate_main() {
 
	STAGE="[MAIN]"
0 comments (0 inline, 0 general)