source: rtems/automake/compile.am @ f04c916

4.104.114.84.95
Last change on this file since f04c916 was f04c916, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/06/02 at 11:21:57

2002-12-06 Ralf Corsepius <corsepiu@…>

  • automake/compile.am: Remove hard-coded *_PROFILE_V. Add autoconf-supplied CPU_CFLAGS, CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V. Remove CPPFLAGS_GCC.
  • Property mode set to 100644
File size: 6.0 KB
RevLine 
[7294718f]1##
2## $Id$
3##
[03d5706]4
5## -------------------------------------------------------------------------
[1ea70d78]6## NOTE: This file is rather immature and has to be considered to be
7## almost experimental.
[03d5706]8##
[1ea70d78]9## Expect frequent changes -- It deserves to be cleaned up :(
[03d5706]10## -------------------------------------------------------------------------
11
[1ea70d78]12## The section below is based on make/compilers/gcc-target-default.cfg
13## used in former versions of RTEMS.
14
15##
16## Set up the flags for the toolchains:
17##
18## We are considering 3 different building schemes here:
19## * Using gcc's being able to accept -specs (aka gcc-2.8 building scheme)
20## * Using gcc's not being able to accept -specs (aka gcc-2.7.2 building
21##   scheme)
22## * Using third party toolchains (aka non-gcc building scheme)
23##
24## Automake conditionals in use:
25## RTEMS_USE_GCC     .. if we are using GCC
26
27## NOTES:
28## * The gcc-2.8 building scheme is the nominal building scheme and
29##   is actively supported.
30## * The non-gcc building scheme requires manually setting up environment
31##   variables and is hardly tested at all
32
33## CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
34## would want the corresponding macros to be set to.
35##
36## CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set by the
37## 'VARIANT=<OPTIMIZE|DEBUG|PROFILE>' targets to their _V values.
38
39## XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
40## are used to add flags from the shell
41## cf. make.info ("Implicit rules/variables" for details)
42
43if RTEMS_USE_GCC
44## All the stuff below is specific to gcc
45
46## gcc >= 2.8.x
[560aae24]47GCCSPECS = $(GCC_SPECS) $(RTEMS_BSP_SPECS)
[1ea70d78]48else
49## fall back to the old style compilers/*.cfg
50## CONFIG.CC is supposed to be provided by <BSP>.cfg
51include $(CONFIG.CC)
52endif # RTEMS_USE_GCC
53
[03d5706]54DEFS = @DEFS@
55
[a34b245]56CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) \
[f04c916]57   $(DEFINES) $(XCPPFLAGS)
[8a2e2aaa]58CFLAGS   = @CFLAGS@ $(CPU_CFLAGS) $(XCFLAGS)
59CXXFLAGS = @CXXFLAGS@ $(CPU_CFLAGS) $(XCXXFLAGS)
[a34b245]60ASFLAGS  = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
[1ea70d78]61
[978f59a]62LINK_LIBS = $(LD_LIBS)
[1ea70d78]63
64#
65# Client compiler and support tools
66#
67
68#
69# How to compile stuff into ${ARCH} subdirectory
70#
71
[bfba54e]72COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
73        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
[a34b245]74CCLD = $(CC)
75LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
76        $(AM_LDFLAGS) $(LDFLAGS) -o $@
[bfba54e]77
78CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
79        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
[ba748523]80CXXLD = $(CXX)
[a34b245]81CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
82        $(AM_LDFLAGS) $(LDFLAGS) -o $@
83
[29d82b25]84CCAS = $(CC)
85CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
86
87# OBSOLETE: Don't use
[a34b245]88AS = $(CC)
[ba748523]89ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS)
[bfba54e]90
[1ea70d78]91${ARCH}/%.o: %.c
[35b2275]92        test -d $(ARCH) || mkdir $(ARCH)
[bfba54e]93        ${COMPILE} -o $@ -c $<
[1ea70d78]94
95${ARCH}/%.o: %.cc
[35b2275]96        test -d $(ARCH) || mkdir $(ARCH)
[bfba54e]97        ${CXXCOMPILE} -o $@ -c $<
[1ea70d78]98
99${ARCH}/%.o: %.S
[35b2275]100        test -d $(ARCH) || mkdir $(ARCH)
[29d82b25]101        ${CCASCOMPILE} -DASM -o $@ -c $<
[1ea70d78]102
103# Dependency files for use by gmake
104# NOTE: we don't put them into $(ARCH)
105#       so that 'make clean' doesn't blow it away
106
107DEPEND=Depends-${ARCH}
108
109CLEAN_DEPEND=$(DEPEND).tmp
110CLOBBER_DEPEND=$(DEPEND)
111
112# We deliberately don't have anything depend on the
113# $(DEPEND) file; otherwise it will get rebuilt even
114# on 'make clean'
115#
116
117## HACK: Specific to gcc
118## FIXME: The approach below is known to be conceptionally broken.
119depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
120##       Use gcc -M to generate dependencies
121##       Replace foo.o with $(ARCH)/foo.o
122##       Replace $(ARCH) value with string $(ARCH)
123##           so that it will for debug and profile cases
[ba748523]124        $(COMPILE) -M   $^    |  \
[1ea70d78]125        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
126            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
127        mv $(DEPEND).tmp $(DEPEND)
128depend: depend-am
129
[372e4e2]130# pull in dependencies if they exist 
131ifeq (${DEPEND},$(wildcard ${DEPEND}))
132include ${DEPEND}
133@ENDIF@
134
135
[1ea70d78]136# spell out all the LINK_FILE's, rather than using -lbsp, so
137#  that $(LINK_FILES) can be a dependency
138
139LINK_OBJS = \
140    $(OBJS) \
141    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
142
143LINK_FILES =\
144    $(START_FILE) \
145    $(OBJS) \
[c274328b]146    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
147
[1ea70d78]148if RTEMS_USE_GCC
149## gcc >= 2.8
150define make-rel
[a34b245]151        $(LINK) -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) $^
[1ea70d78]152endef
153else
154## non-gcc
155define make-rel
[a34b245]156        $(LINK) $(XLDFLAGS) $^
[1ea70d78]157endef
158endif
159
160## -------------------------------------------------------------------------
161
162## translate VARIANT into VARIANT_V
163VARIANT = OPTIMIZE
164
165VARIANT_OPTIMIZE_V = OPTIMIZE
166VARIANT_DEBUG_V = DEBUG
167VARIANT_PROFILE_V = PROFILE
168VARIANT_optimize_V = OPTIMIZE
169VARIANT_debug_V = DEBUG
170VARIANT_profile_V = PROFILE
171
172VARIANT_V = $(VARIANT_$(VARIANT)_V)
173
174## Setup the variant build subdirectory
175ARCH_OPTIMIZE_V = o-optimize
176ARCH_DEBUG_V = o-debug
177ARCH_PROFILE_V = o-profile
178
179ARCH__V = $(ARCH_OPTIMIZE_V)
180ARCH = $(ARCH_$(VARIANT_V)_V)
181
182## Setup the library suffix
183LIBSUFFIX_OPTIMIZE_V =
184LIBSUFFIX_DEBUG_V = _g
185LIBSUFFIX_PROFILE_V = _p
186LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
187
188LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
189LIBSUFFIX_VA = $(LIB_VARIANT).a
190
191## These are supposed to be set in make/custom/<bsp>.cfg
[f04c916]192CPU_CFLAGS = @CPU_CFLAGS@
193CFLAGS_OPTIMIZE_V = @CFLAGS_OPTIMIZE_V@
194CFLAGS_DEBUG_V = @CFLAGS_DEBUG_V@
195CFLAGS_PROFILE_V = @CFLAGS_PROFILE_V@
[1ea70d78]196CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
197
198## ------------------------------------------------------------------------
199## Setup hard-coded flags
200if RTEMS_USE_GCC
201## gcc >= gcc-2.8
202RTEMS_CFLAGS_OPTIMIZE_V =
203RTEMS_CFLAGS_DEBUG_V = -qrtems_debug -Wno-unused
[29d82b25]204RTEMS_CFLAGS_PROFILE_V = -pg
[978f59a]205
[1ea70d78]206## non-gcc
207## We can't guess what flags might be required here.
208## Pass the values from the environment if you want to apply them.
209endif
210RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
211
212## -------------------------------------------------------------------------
213
[509f8351]214CC = @CC@ $(GCCSPECS)
215CXX = @CXX@ $(GCCSPECS)
[560aae24]216CPP = @CPP@ $(GCCSPECS)
217
[4dc2e9a]218LD = @LD@
[63b24d29]219OBJCOPY = @OBJCOPY@
220NM = @NM@
221SIZE = @SIZE@
222STRIP = @STRIP@
[1ea70d78]223
[03d5706]224##
[bfba54e]225AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
[1ea70d78]226
[bfba54e]227AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
228AM_CXXFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
Note: See TracBrowser for help on using the repository browser.