Part of automake VI patch from Ralf Corsepius <corsepiu@faw.uni-ulm.de>:

> 2) rtems-rc-19990131-1.diff
>
> Rework of compilers/*.cfg files (esp. gcc-target-default.cfg) to adapt
> the flags/makefile variables to automake and make standards (cf.
> make.info - implicit rules/variables).
>
> This patch is rather risky and may probably break things, but is an
> essential step towards automake.
>
> FWIW: It also reverts the i386-ASMFLAGS/ASFLAGS-patch, which was wrong,
> as I had to experience ;-.
This commit is contained in:
Joel Sherrill
1999-02-18 17:55:49 +00:00
parent 011677f8fc
commit a110b68252
6 changed files with 59 additions and 105 deletions

View File

@@ -4,10 +4,6 @@
# $Id$
#
CPPFLAGS=$(CFLAGS) $(XCPPFLAGS)
CPLUS_CPPFLAGS=$(CFLAGS) $(XCPPFLAGS)
##
# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
# would want the corresponding macros to be set to.
@@ -17,6 +13,14 @@ CPLUS_CPPFLAGS=$(CFLAGS) $(XCPPFLAGS)
#
# default flags
# XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
# are used to add flags from the shell
# cf. make.info ("Implicit rules/variables" for details)
CPPFLAGS = $(CPU_DEFINES) $(DEFINES) $(XCPPFLAGS)
CFLAGS = $(CPU_CFLAGS) -g -Wall -ansi -fasm $(XCFLAGS)
CXXFLAGS = $(CPU_CFLAGS) -g -Wall -ansi -fasm $(XCXXFLAGS)
ASFLAGS = $(CPU_ASFLAGS) $(XASFLAGS)
# We only include the header files for networking if it is enabled.
INCLUDE_NETWORKING_yes_V = -I$(PROJECT_INCLUDE)/networking
@@ -30,27 +34,19 @@ RTEMS_LIBC_INCLUDES := -I$(RTEMS_LIBC_DIR)/include
endif
# Used for posix bsps
CFLAGS_DEFAULT = $(CPU_DEFINES) $(CPU_CFLAGS) -Wall -ansi -fasm -g \
-I$(PROJECT_INCLUDE) \
$(INCLUDE_NETWORKING) \
$(RTEMS_LIBC_INCLUDES) $(DEFINES)
ASMFLAGS=$(CPU_DEFINES) $(CPU_CFLAGS) -g \
-I$(PROJECT_INCLUDE) \
$(RTEMS_LIBC_INCLUDES) $(DEFINES)
CPPFLAGS += \
-I$(PROJECT_INCLUDE) $(INCLUDE_NETWORKING) \
$(RTEMS_LIBC_INCLUDES)
else
# Used for embedded bsps
# Ask gcc where it finds its own include files
GCC_INCLUDE=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=include $(GCCSED))
CFLAGS_DEFAULT = $(CPU_DEFINES) $(CPU_CFLAGS) -Wall -ansi -fasm -g \
-nostdinc -I$(PROJECT_INCLUDE) \
$(INCLUDE_NETWORKING) \
-I$(RTEMS_LIBC_DIR)/include -I$(GCC_INCLUDE) $(DEFINES)
ASMFLAGS=$(CPU_DEFINES) $(CPU_CFLAGS) -g \
-nostdinc -I$(PROJECT_INCLUDE) \
-I$(RTEMS_LIBC_DIR)/include -I$(GCC_INCLUDE) $(DEFINES)
CPPFLAGS += -nostdinc \
-I$(PROJECT_INCLUDE) $(INCLUDE_NETWORKING) \
-I$(GCC_INCLUDE) \
-I$(RTEMS_LIBC_DIR)/sys-include \
-I$(RTEMS_LIBC_DIR)/include
endif
# default location of Standard C Library
@@ -98,7 +94,7 @@ endif
# when debugging, optimize flag: typically empty
# some compilers do allow optimization with their "-g"
#CFLAGS_DEBUG_OPTIMIZE_V=
CFLAGS_DEBUG_OPTIMIZE_V=-g
# profile flag; use gprof(1)
CFLAGS_PROFILE_V=-pg
@@ -107,10 +103,10 @@ CFLAGS_PROFILE_V=-pg
CFLAGS_OPTIMIZE=$(CFLAGS_OPTIMIZE_V)
# dynamic libraries
CFLAGS_DYNAMIC_V=-fpic
#CFLAGS_DYNAMIC_V=-fpic
#ASFLAGS_DYNAMIC_V=
CFLAGS=$(CFLAGS_DEFAULT) $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
CFLAGS += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
# List of library paths without -L
LD_PATHS= $(PROJECT_RELEASE)/lib
@@ -156,10 +152,8 @@ CLOBBER_CC =
CPP=$(CC) -E -ansi -w -Wp,-$$
# flags set by cc when running cpp
CPP_CC_FLAGS=-D__STDC__
ASFLAGS= $(CPU_ASFLAGS)
ASM4FLAGS := -I $(PROJECT_INCLUDE)
# NOTE: CPP_CC_FLAGS does not seem to be used anywhere
# CPP_CC_FLAGS=-D__STDC__
# egrep regexp to ignore symbol table entries in ar archives.
# Only used to make sure we skip them when coalescing libraries.
@@ -173,14 +167,15 @@ ARFLAGS=ruv
# NOTE: Obsolete, use $(RANLIB) instead, MKLIB may disappear soon
MKLIB=$(RANLIB)
#
# How to compile stuff into ${ARCH} subdirectory
#
# NOTE: we override COMPILE.c
#
COMPILE.c=$(CC) $(CFLAGS) $(XCFLAGS) -c
COMPILE.cc=$(CXX) $(CFLAGS) $(CXXFLAGS) $(XCFLAGS) -c
COMPILE.c=$(CC) $(CPPFLAGS) $(CFLAGS) -c
COMPILE.cc=$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c
${ARCH}/%.o: %.c
${COMPILE.c} -o $@ $<
@@ -191,26 +186,9 @@ ${ARCH}/%.o: %.cc
# strip out C++ style comments.
${ARCH}/%.o: %.S
sed -e 's/\/\/.*$$//' < $< | \
$(CPP) $(ASMFLAGS) -I. -I$(srcdir) -DASM - >$(ARCH)/$*.i
$(CPP) $(CPPFLAGS) -I. -I$(srcdir) -DASM - >$(ARCH)/$*.i
$(AS) $(ASFLAGS) -o $@ $(ARCH)/$*.i
# Specify our own default rule for this to prevent having CFLAGS and
# CPPFLAGS being passed to linker
#
#
# NOTE (Ralf): Having this rule is a bug, IMO.
# I have only kept it for the moment because some (broken) Makefiles
# might need it.
#
# ${ARCH}/%: ${ARCH}/%.o
# ${CC} ${LDFLAGS} -o $@ $@.o ${LD_LIBS}
#
# Anyway, the rule above is wrong. The one below should be correct
# (But this one should also not be necessary. If something breaks now,
# have a look at the Makefile or custom/*.cfg :-)
# $(ARCH)/%.exe: $(ARCH)/%.o
# $(make-exe)
# Make foo.rel from foo.o
${ARCH}/%.rel: ${ARCH}/%.o
${LD} $(LDFLAGS_INCOMPLETE) -o $@ $^