source: rtems/automake/compile.am @ 8e4cd5a

4.104.114.84.95
Last change on this file since 8e4cd5a was 29d82b25, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/01/02 at 08:01:04

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

  • automake/compile.am: Remove LDFLAGS_INCOMPLETE. Remove LDFLAGS. Add CCAS, CCASCOMPILE. Remove compilation rules for *.cpp, *.cxx, *.C. Use CCASCOMPILE to compile *.S. Add -pg to RTEMS_CFLAGS_PROFILE_V.
  • Property mode set to 100644
File size: 6.0 KB
Line 
1##
2## $Id$
3##
4
5## -------------------------------------------------------------------------
6## NOTE: This file is rather immature and has to be considered to be
7## almost experimental.
8##
9## Expect frequent changes -- It deserves to be cleaned up :(
10## -------------------------------------------------------------------------
11
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
47GCCSPECS = $(GCC_SPECS) $(RTEMS_BSP_SPECS)
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
54DEFS = @DEFS@
55
56CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) \
57   $(DEFINES) $(XCPPFLAGS) $(CPPFLAGS_GCC)
58CFLAGS   = @CFLAGS@ $(CPU_CFLAGS) $(XCFLAGS)
59CXXFLAGS = @CXXFLAGS@ $(CPU_CFLAGS) $(XCXXFLAGS)
60ASFLAGS  = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
61
62LINK_LIBS = $(LD_LIBS)
63
64# profile flag; use gprof(1)
65CFLAGS_PROFILE_V=-pg
66CXXFLAGS_PROFILE_V=-pg
67LDFLAGS_PROFILE_V =
68
69#
70# Client compiler and support tools
71#
72
73#
74# How to compile stuff into ${ARCH} subdirectory
75#
76
77COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
78        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
79CCLD = $(CC)
80LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
81        $(AM_LDFLAGS) $(LDFLAGS) -o $@
82
83CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
84        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
85CXXLD = $(CXX)
86CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
87        $(AM_LDFLAGS) $(LDFLAGS) -o $@
88
89CCAS = $(CC)
90CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
91
92# OBSOLETE: Don't use
93AS = $(CC)
94ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS)
95
96${ARCH}/%.o: %.c
97        test -d $(ARCH) || mkdir $(ARCH)
98        ${COMPILE} -o $@ -c $<
99
100${ARCH}/%.o: %.cc
101        test -d $(ARCH) || mkdir $(ARCH)
102        ${CXXCOMPILE} -o $@ -c $<
103
104${ARCH}/%.o: %.S
105        test -d $(ARCH) || mkdir $(ARCH)
106        ${CCASCOMPILE} -DASM -o $@ -c $<
107
108# Dependency files for use by gmake
109# NOTE: we don't put them into $(ARCH)
110#       so that 'make clean' doesn't blow it away
111
112DEPEND=Depends-${ARCH}
113
114CLEAN_DEPEND=$(DEPEND).tmp
115CLOBBER_DEPEND=$(DEPEND)
116
117# We deliberately don't have anything depend on the
118# $(DEPEND) file; otherwise it will get rebuilt even
119# on 'make clean'
120#
121
122## HACK: Specific to gcc
123## FIXME: The approach below is known to be conceptionally broken.
124depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
125##       Use gcc -M to generate dependencies
126##       Replace foo.o with $(ARCH)/foo.o
127##       Replace $(ARCH) value with string $(ARCH)
128##           so that it will for debug and profile cases
129        $(COMPILE) -M   $^    |  \
130        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
131            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
132        mv $(DEPEND).tmp $(DEPEND)
133depend: depend-am
134
135# pull in dependencies if they exist 
136ifeq (${DEPEND},$(wildcard ${DEPEND}))
137include ${DEPEND}
138@ENDIF@
139
140
141# spell out all the LINK_FILE's, rather than using -lbsp, so
142#  that $(LINK_FILES) can be a dependency
143
144LINK_OBJS = \
145    $(OBJS) \
146    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
147
148LINK_FILES =\
149    $(START_FILE) \
150    $(OBJS) \
151    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
152
153if RTEMS_USE_GCC
154## gcc >= 2.8
155define make-rel
156        $(LINK) -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) $^
157endef
158else
159## non-gcc
160define make-rel
161        $(LINK) $(XLDFLAGS) $^
162endef
163endif
164
165## -------------------------------------------------------------------------
166
167## translate VARIANT into VARIANT_V
168VARIANT = OPTIMIZE
169
170VARIANT_OPTIMIZE_V = OPTIMIZE
171VARIANT_DEBUG_V = DEBUG
172VARIANT_PROFILE_V = PROFILE
173VARIANT_optimize_V = OPTIMIZE
174VARIANT_debug_V = DEBUG
175VARIANT_profile_V = PROFILE
176
177VARIANT_V = $(VARIANT_$(VARIANT)_V)
178
179## Setup the variant build subdirectory
180ARCH_OPTIMIZE_V = o-optimize
181ARCH_DEBUG_V = o-debug
182ARCH_PROFILE_V = o-profile
183
184ARCH__V = $(ARCH_OPTIMIZE_V)
185ARCH = $(ARCH_$(VARIANT_V)_V)
186
187## Setup the library suffix
188LIBSUFFIX_OPTIMIZE_V =
189LIBSUFFIX_DEBUG_V = _g
190LIBSUFFIX_PROFILE_V = _p
191LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
192
193LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
194LIBSUFFIX_VA = $(LIB_VARIANT).a
195
196## These are supposed to be set in make/custom/<bsp>.cfg
197## CFLAGS_OPTIMIZE_V =
198## CFLAGS_DEBUG_V =
199## CFLAGS_PROFILE_V =
200CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
201
202## ------------------------------------------------------------------------
203## Setup hard-coded flags
204if RTEMS_USE_GCC
205## gcc >= gcc-2.8
206RTEMS_CFLAGS_OPTIMIZE_V =
207RTEMS_CFLAGS_DEBUG_V = -qrtems_debug -Wno-unused
208RTEMS_CFLAGS_PROFILE_V = -pg
209
210## non-gcc
211## We can't guess what flags might be required here.
212## Pass the values from the environment if you want to apply them.
213endif
214RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
215
216## -------------------------------------------------------------------------
217
218CC = @CC@ $(GCCSPECS)
219CXX = @CXX@ $(GCCSPECS)
220CPP = @CPP@ $(GCCSPECS)
221
222LD = @LD@
223OBJCOPY = @OBJCOPY@
224NM = @NM@
225SIZE = @SIZE@
226STRIP = @STRIP@
227
228
229##
230AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
231
232AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
233AM_CXXFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
Note: See TracBrowser for help on using the repository browser.