source: rtems/c/src/automake/compile.am @ 9480bb42

4.104.114.84.95
Last change on this file since 9480bb42 was 9480bb42, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/15/04 at 04:30:28

2004-01-15 Ralf Corsepius <corsepiu@…>

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