URL
https://opencores.org/ocsvn/or1k_old/or1k_old/trunk
Subversion Repositories or1k_old
[/] [or1k_old/] [trunk/] [rtems-20020807/] [automake/] [compile.am] - Rev 1782
Compare with Previous | Blame | View Log
#### compile.am,v 1.18 2002/07/22 09:17:40 ralf Exp#### -------------------------------------------------------------------------## NOTE: This file is rather immature and has to be considered to be## almost experimental.#### Expect frequent changes -- It deserves to be cleaned up :(## -------------------------------------------------------------------------## The section below is based on make/compilers/gcc-target-default.cfg## used in former versions of RTEMS.#### Set up the flags for the toolchains:#### 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 not being able to accept -specs (aka gcc-2.7.2 building## scheme)## * Using third party toolchains (aka non-gcc building scheme)#### Automake conditionals in use:## RTEMS_USE_GCC .. if we are using GCC## NOTES:## * The gcc-2.8 building scheme is the nominal building scheme and## is actively supported.## * The non-gcc building scheme requires manually setting up environment## variables and is hardly tested at all## CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we## would want the corresponding macros to be set to.#### CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set by the## 'VARIANT=<OPTIMIZE|DEBUG|PROFILE>' targets to their _V values.## XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS## are used to add flags from the shell## cf. make.info ("Implicit rules/variables" for details)if RTEMS_USE_GCC## All the stuff below is specific to gccCFLAGS_DEFAULT=-g -Wall## gcc >= 2.8.xGCCSPECS = $(GCC_SPECS) $(RTEMS_BSP_SPECS)else## fall back to the old style compilers/*.cfg## CONFIG.CC is supposed to be provided by <BSP>.cfginclude $(CONFIG.CC)endif # RTEMS_USE_GCCDEFS = @DEFS@CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) \$(DEFINES) $(XCPPFLAGS) $(CPPFLAGS_GCC)CFLAGS = $(CFLAGS_DEFAULT) $(CPU_CFLAGS) $(XCFLAGS)CXXFLAGS = $(CFLAGS_DEFAULT) $(CPU_CFLAGS) $(XCXXFLAGS)ASFLAGS = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)LINK_LIBS = $(LD_LIBS)## FIXME: This doesn't seem to be correct# when debugging, optimize flag: typically empty# some compilers do allow optimization with their "-g"CFLAGS_DEBUG_OPTIMIZE_V=-gCXXFLAGS_DEBUG_OPTIMIZE_V=-gLDFLAGS_DEBUG_V =# profile flag; use gprof(1)CFLAGS_PROFILE_V=-pgCXXFLAGS_PROFILE_V=-pgLDFLAGS_PROFILE_V =# List of library paths without -LLD_PATHS= $(PROJECT_RELEASE)/lib# ld flag for incomplete linkLDFLAGS_INCOMPLETE = -r# ld flags for profiling, debuggingLDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)## Client compiler and support tools### How to compile stuff into ${ARCH} subdirectory#COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)CCLD = $(CC)LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \$(AM_LDFLAGS) $(LDFLAGS) -o $@CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)CXXLD = $(CXX)CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \$(AM_LDFLAGS) $(LDFLAGS) -o $@AS = $(CC)ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS)${ARCH}/%.o: %.ctest -d $(ARCH) || mkdir $(ARCH)${COMPILE} -o $@ -c $<${ARCH}/%.o: %.cctest -d $(ARCH) || mkdir $(ARCH)${CXXCOMPILE} -o $@ -c $<${ARCH}/%.o: %.cpptest -d $(ARCH) || mkdir $(ARCH)${CXXCOMPILE} -o $@ -c $<${ARCH}/%.o: %.cxxtest -d $(ARCH) || mkdir $(ARCH)${CXXCOMPILE} -o $@ -c $<${ARCH}/%.o: %.Ctest -d $(ARCH) || mkdir $(ARCH)${CXXCOMPILE} -o $@ -c $<${ARCH}/%.o: %.Stest -d $(ARCH) || mkdir $(ARCH)${ASCOMPILE} -DASM -o $@ -c $<# Make foo.rel from foo.o${ARCH}/%.rel: ${ARCH}/%.otest -d $(ARCH) || mkdir $(ARCH)${make-rel}# Dependency files for use by gmake# NOTE: we don't put them into $(ARCH)# so that 'make clean' doesn't blow it awayDEPEND=Depends-${ARCH}CLEAN_DEPEND=$(DEPEND).tmpCLOBBER_DEPEND=$(DEPEND)# We deliberately don't have anything depend on the# $(DEPEND) file; otherwise it will get rebuilt even# on 'make clean'### HACK: Specific to gcc## FIXME: The approach below is known to be conceptionally broken.depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)## Use gcc -M to generate dependencies## Replace foo.o with $(ARCH)/foo.o## Replace $(ARCH) value with string $(ARCH)## so that it will for debug and profile cases$(COMPILE) -M $^ | \sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \-e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmpmv $(DEPEND).tmp $(DEPEND)depend: depend-am# pull in dependencies if they existifeq (${DEPEND},$(wildcard ${DEPEND}))include ${DEPEND}@ENDIF@# spell out all the LINK_FILE's, rather than using -lbsp, so# that $(LINK_FILES) can be a dependencyLINK_OBJS = \$(OBJS) \$(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)LINK_FILES =\$(START_FILE) \$(OBJS) \$(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)if RTEMS_USE_GCC## gcc >= 2.8define make-rel$(LINK) -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) $^endefelse## non-gccdefine make-rel$(LINK) $(XLDFLAGS) $^endefendif## -------------------------------------------------------------------------## translate VARIANT into VARIANT_VVARIANT = OPTIMIZEVARIANT_OPTIMIZE_V = OPTIMIZEVARIANT_DEBUG_V = DEBUGVARIANT_PROFILE_V = PROFILEVARIANT_optimize_V = OPTIMIZEVARIANT_debug_V = DEBUGVARIANT_profile_V = PROFILEVARIANT_V = $(VARIANT_$(VARIANT)_V)## Setup the variant build subdirectoryARCH_OPTIMIZE_V = o-optimizeARCH_DEBUG_V = o-debugARCH_PROFILE_V = o-profileARCH__V = $(ARCH_OPTIMIZE_V)ARCH = $(ARCH_$(VARIANT_V)_V)## Setup the library suffixLIBSUFFIX_OPTIMIZE_V =LIBSUFFIX_DEBUG_V = _gLIBSUFFIX_PROFILE_V = _pLIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)LIBSUFFIX_VA = $(LIB_VARIANT).a## These are supposed to be set in make/custom/<bsp>.cfg## CFLAGS_OPTIMIZE_V =## CFLAGS_DEBUG_V =## CFLAGS_PROFILE_V =CFLAGS__V = $(CFLAGS_OPTIMIZE_V)## ------------------------------------------------------------------------## Setup hard-coded flagsif RTEMS_USE_GCC## gcc >= gcc-2.8RTEMS_CFLAGS_OPTIMIZE_V =RTEMS_CFLAGS_DEBUG_V = -qrtems_debug -Wno-unusedRTEMS_CFLAGS_PROFILE_V =## non-gcc## We can't guess what flags might be required here.## Pass the values from the environment if you want to apply them.endifRTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)## -------------------------------------------------------------------------CC = @CC@ $(GCCSPECS)CXX = @CXX@ $(GCCSPECS)CPP = @CPP@ $(GCCSPECS)LD = @LD@OBJCOPY = @OBJCOPY@NM = @NM@SIZE = @SIZE@STRIP = @STRIP@##AM_CPPFLAGS = $(RTEMS_CPPFLAGS)AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)AM_CXXFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
