##
|
##
|
## compile.am,v 1.4 2002/07/26 12:51:02 ralf Exp
|
## compile.am,v 1.4 2002/07/26 12:51:02 ralf Exp
|
##
|
##
|
|
|
## -------------------------------------------------------------------------
|
## -------------------------------------------------------------------------
|
## NOTE: This file is rather immature and has to be considered to be
|
## NOTE: This file is rather immature and has to be considered to be
|
## almost experimental.
|
## almost experimental.
|
##
|
##
|
## Expect frequent changes -- It deserves to be cleaned up :(
|
## Expect frequent changes -- It deserves to be cleaned up :(
|
## -------------------------------------------------------------------------
|
## -------------------------------------------------------------------------
|
|
|
## The section below is based on make/compilers/gcc-target-default.cfg
|
## The section below is based on make/compilers/gcc-target-default.cfg
|
## used in former versions of RTEMS.
|
## used in former versions of RTEMS.
|
|
|
##
|
##
|
## Set up the flags for the toolchains:
|
## Set up the flags for the toolchains:
|
##
|
##
|
## We are considering 3 different building schemes here:
|
## We are considering 3 different building schemes here:
|
## * Using gcc's being able to accept -specs (aka gcc-2.8 building scheme)
|
## * Using gcc's being able to accept -specs (aka gcc-2.8 building scheme)
|
## * Using gcc's not being able to accept -specs (aka gcc-2.7.2 building
|
## * Using gcc's not being able to accept -specs (aka gcc-2.7.2 building
|
## scheme)
|
## scheme)
|
## * Using third party toolchains (aka non-gcc building scheme)
|
## * Using third party toolchains (aka non-gcc building scheme)
|
##
|
##
|
## Automake conditionals in use:
|
## Automake conditionals in use:
|
## RTEMS_USE_GCC .. if we are using GCC
|
## RTEMS_USE_GCC .. if we are using GCC
|
|
|
## NOTES:
|
## NOTES:
|
## * The gcc-2.8 building scheme is the nominal building scheme and
|
## * The gcc-2.8 building scheme is the nominal building scheme and
|
## is actively supported.
|
## is actively supported.
|
## * The non-gcc building scheme requires manually setting up environment
|
## * The non-gcc building scheme requires manually setting up environment
|
## variables and is hardly tested at all
|
## variables and is hardly tested at all
|
|
|
## CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
|
## CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
|
## would want the corresponding macros to be set to.
|
## would want the corresponding macros to be set to.
|
##
|
##
|
## CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set by the
|
## CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set by the
|
## 'VARIANT=' targets to their _V values.
|
## 'VARIANT=' targets to their _V values.
|
|
|
## XCPPFLAGS, XCFLAGS, XASFLAGS
|
## XCPPFLAGS, XCFLAGS, XASFLAGS
|
## are used to add flags from the shell
|
## are used to add flags from the shell
|
## cf. make.info ("Implicit rules/variables" for details)
|
## cf. make.info ("Implicit rules/variables" for details)
|
|
|
if RTEMS_USE_GCC
|
if RTEMS_USE_GCC
|
## All the stuff below is specific to gcc
|
## All the stuff below is specific to gcc
|
|
|
CFLAGS_DEFAULT=-g -Wall
|
CFLAGS_DEFAULT=-g -Wall
|
## gcc >= 2.8.x
|
## gcc >= 2.8.x
|
GCCSPECS = $(GCC_SPECS)
|
GCCSPECS = $(GCC_SPECS)
|
else
|
else
|
## fall back to the old style compilers/*.cfg
|
## fall back to the old style compilers/*.cfg
|
## CONFIG.CC is supposed to be provided by .cfg
|
## CONFIG.CC is supposed to be provided by .cfg
|
include $(CONFIG.CC)
|
include $(CONFIG.CC)
|
endif # RTEMS_USE_GCC
|
endif # RTEMS_USE_GCC
|
|
|
DEFS = @DEFS@
|
DEFS = @DEFS@
|
|
|
CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) \
|
CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) \
|
$(DEFINES) $(XCPPFLAGS) $(CPPFLAGS_GCC)
|
$(DEFINES) $(XCPPFLAGS) $(CPPFLAGS_GCC)
|
CFLAGS = $(CFLAGS_DEFAULT) $(CPU_CFLAGS) $(XCFLAGS)
|
CFLAGS = $(CFLAGS_DEFAULT) $(CPU_CFLAGS) $(XCFLAGS)
|
ASFLAGS = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
|
ASFLAGS = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
|
|
|
## FIXME: This doesn't seem to be correct
|
## FIXME: This doesn't seem to be correct
|
# when debugging, optimize flag: typically empty
|
# when debugging, optimize flag: typically empty
|
# some compilers do allow optimization with their "-g"
|
# some compilers do allow optimization with their "-g"
|
CFLAGS_DEBUG_OPTIMIZE_V=-g
|
CFLAGS_DEBUG_OPTIMIZE_V=-g
|
|
|
# profile flag; use gprof(1)
|
# profile flag; use gprof(1)
|
CFLAGS_PROFILE_V=-pg
|
CFLAGS_PROFILE_V=-pg
|
|
|
#
|
#
|
# How to compile stuff into ${ARCH} subdirectory
|
# How to compile stuff into ${ARCH} subdirectory
|
#
|
#
|
|
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
CCLD = $(CC)
|
CCLD = $(CC)
|
|
|
CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
|
CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
|
|
|
${ARCH}/%.$(OBJEXT): %.c
|
${ARCH}/%.$(OBJEXT): %.c
|
${COMPILE} -o $@ -c $<
|
${COMPILE} -o $@ -c $<
|
|
|
${ARCH}/%.$(OBJEXT): %.S
|
${ARCH}/%.$(OBJEXT): %.S
|
${CCASCOMPILE} -o $@ -c $<
|
${CCASCOMPILE} -o $@ -c $<
|
|
|
# Make foo.rel from foo.$(OBJEXT)
|
# Make foo.rel from foo.$(OBJEXT)
|
${ARCH}/%.rel: ${ARCH}/%.$(OBJEXT)
|
${ARCH}/%.rel: ${ARCH}/%.$(OBJEXT)
|
${make-rel}
|
${make-rel}
|
|
|
# Dependency files for use by gmake
|
# Dependency files for use by gmake
|
# NOTE: we don't put them into $(ARCH)
|
# NOTE: we don't put them into $(ARCH)
|
# so that 'make clean' doesn't blow it away
|
# so that 'make clean' doesn't blow it away
|
|
|
DEPEND=Depends-${ARCH}
|
DEPEND=Depends-${ARCH}
|
|
|
CLEAN_DEPEND=$(DEPEND).tmp
|
CLEAN_DEPEND=$(DEPEND).tmp
|
CLOBBER_DEPEND=$(DEPEND)
|
CLOBBER_DEPEND=$(DEPEND)
|
|
|
# We deliberately don't have anything depend on the
|
# We deliberately don't have anything depend on the
|
# $(DEPEND) file; otherwise it will get rebuilt even
|
# $(DEPEND) file; otherwise it will get rebuilt even
|
# on 'make clean'
|
# on 'make clean'
|
#
|
#
|
|
|
## HACK: Specific to gcc
|
## HACK: Specific to gcc
|
## FIXME: The approach below is known to be conceptionally broken.
|
## FIXME: The approach below is known to be conceptionally broken.
|
depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
|
depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
|
## Use gcc -M to generate dependencies
|
## Use gcc -M to generate dependencies
|
## Replace foo.$(OBJEXT) with $(ARCH)/foo.$(OBJEXT)
|
## Replace foo.$(OBJEXT) with $(ARCH)/foo.$(OBJEXT)
|
## Replace $(ARCH) value with string $(ARCH)
|
## Replace $(ARCH) value with string $(ARCH)
|
## so that it will for debug and profile cases
|
## so that it will for debug and profile cases
|
$(COMPILE) -M $^ | \
|
$(COMPILE) -M $^ | \
|
sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
|
sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
|
-e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmp
|
-e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmp
|
mv $(DEPEND).tmp $(DEPEND)
|
mv $(DEPEND).tmp $(DEPEND)
|
depend: depend-am
|
depend: depend-am
|
|
|
# pull in dependencies if they exist
|
# pull in dependencies if they exist
|
ifeq (${DEPEND},$(wildcard ${DEPEND}))
|
ifeq (${DEPEND},$(wildcard ${DEPEND}))
|
include ${DEPEND}
|
include ${DEPEND}
|
@ENDIF@
|
@ENDIF@
|
|
|
## -------------------------------------------------------------------------
|
## -------------------------------------------------------------------------
|
|
|
## translate VARIANT into VARIANT_V
|
## translate VARIANT into VARIANT_V
|
VARIANT = OPTIMIZE
|
VARIANT = OPTIMIZE
|
|
|
VARIANT_OPTIMIZE_V = OPTIMIZE
|
VARIANT_OPTIMIZE_V = OPTIMIZE
|
VARIANT_DEBUG_V = DEBUG
|
VARIANT_DEBUG_V = DEBUG
|
VARIANT_PROFILE_V = PROFILE
|
VARIANT_PROFILE_V = PROFILE
|
VARIANT_optimize_V = OPTIMIZE
|
VARIANT_optimize_V = OPTIMIZE
|
VARIANT_debug_V = DEBUG
|
VARIANT_debug_V = DEBUG
|
VARIANT_profile_V = PROFILE
|
VARIANT_profile_V = PROFILE
|
|
|
VARIANT_V = $(VARIANT_$(VARIANT)_V)
|
VARIANT_V = $(VARIANT_$(VARIANT)_V)
|
|
|
## Setup the variant build subdirectory
|
## Setup the variant build subdirectory
|
ARCH_OPTIMIZE_V = o-optimize
|
ARCH_OPTIMIZE_V = o-optimize
|
ARCH_DEBUG_V = o-debug
|
ARCH_DEBUG_V = o-debug
|
ARCH_PROFILE_V = o-profile
|
ARCH_PROFILE_V = o-profile
|
|
|
ARCH__V = $(ARCH_OPTIMIZE_V)
|
ARCH__V = $(ARCH_OPTIMIZE_V)
|
ARCH = $(ARCH_$(VARIANT_V)_V)
|
ARCH = $(ARCH_$(VARIANT_V)_V)
|
|
|
## Setup the library suffix
|
## Setup the library suffix
|
LIBSUFFIX_OPTIMIZE_V =
|
LIBSUFFIX_OPTIMIZE_V =
|
LIBSUFFIX_DEBUG_V = _g
|
LIBSUFFIX_DEBUG_V = _g
|
LIBSUFFIX_PROFILE_V = _p
|
LIBSUFFIX_PROFILE_V = _p
|
LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
|
LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
|
|
|
LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
|
LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
|
LIBSUFFIX_VA = $(LIB_VARIANT).a
|
LIBSUFFIX_VA = $(LIB_VARIANT).a
|
|
|
## These are supposed to be set in make/custom/.cfg
|
## These are supposed to be set in make/custom/.cfg
|
## CFLAGS_OPTIMIZE_V =
|
## CFLAGS_OPTIMIZE_V =
|
## CFLAGS_DEBUG_V =
|
## CFLAGS_DEBUG_V =
|
## CFLAGS_PROFILE_V =
|
## CFLAGS_PROFILE_V =
|
CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
|
CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
|
|
|
## ------------------------------------------------------------------------
|
## ------------------------------------------------------------------------
|
## Setup hard-coded flags
|
## Setup hard-coded flags
|
if RTEMS_USE_GCC
|
if RTEMS_USE_GCC
|
## gcc >= gcc-2.8
|
## gcc >= gcc-2.8
|
RTEMS_CFLAGS_OPTIMIZE_V =
|
RTEMS_CFLAGS_OPTIMIZE_V =
|
RTEMS_CFLAGS_DEBUG_V = -Wno-unused
|
RTEMS_CFLAGS_DEBUG_V = -Wno-unused
|
RTEMS_CFLAGS_PROFILE_V =
|
RTEMS_CFLAGS_PROFILE_V =
|
|
|
## non-gcc
|
## non-gcc
|
## We can't guess what flags might be required here.
|
## We can't guess what flags might be required here.
|
## Pass the values from the environment if you want to apply them.
|
## Pass the values from the environment if you want to apply them.
|
endif
|
endif
|
RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
|
RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
|
|
|
## -------------------------------------------------------------------------
|
## -------------------------------------------------------------------------
|
|
|
CC = @CC@ $(GCCSPECS)
|
CC = @CC@ $(GCCSPECS)
|
CPP = @CPP@ $(GCCSPECS)
|
CPP = @CPP@ $(GCCSPECS)
|
|
|
##
|
##
|
AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
|
AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
|
|
|
AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
|
AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
|
|
|
# AM_CFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CFLAGS)
|
# AM_CFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CFLAGS)
|
AM_CCASFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
|
AM_CCASFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
|
|
|