source: rtems/automake/compile.am @ 1cd9dfc

4.104.114.84.95
Last change on this file since 1cd9dfc was 1cd9dfc, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/16/03 at 09:11:40

2003-05-16 Ralf Corsepius <corsepiu@…>

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