source: rtems/automake/compile.am @ 16735ca

4.104.114.84.9
Last change on this file since 16735ca was 16735ca, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jan 21, 2003 at 1:40:05 PM

2003-01-21 Ralf Corsepius <corsepiu@…>

  • automake/compile.am: Remove CLEAN_DEPEND (Unused). Remove CLOBBER_DEPEND (Unused).
  • Property mode set to 100644
File size: 5.8 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)
58CXXFLAGS = @RTEMS_CXXFLAGS@ $(XCXXFLAGS)
59ASFLAGS  = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
60
61LINK_LIBS = $(LD_LIBS)
62
63#
64# Client compiler and support tools
65#
66
67#
68# How to compile stuff into ${ARCH} subdirectory
69#
70
71COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
72        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
73CCLD = $(CC)
74LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
75        $(AM_LDFLAGS) $(LDFLAGS) -o $@
76
77CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
78        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
79CXXLD = $(CXX)
80CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
81        $(AM_LDFLAGS) $(LDFLAGS) -o $@
82
83CCAS = $(CC)
84CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
85
86# OBSOLETE: Don't use
87AS = $(CC)
88ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS)
89
90${ARCH}/%.o: %.c
91        ${COMPILE} -o $@ -c $<
92
93${ARCH}/%.o: %.cc
94        ${CXXCOMPILE} -o $@ -c $<
95
96${ARCH}/%.o: %.S
97        ${CCASCOMPILE} -DASM -o $@ -c $<
98
99# Dependency files for use by gmake
100# NOTE: we don't put them into $(ARCH)
101#       so that 'make clean' doesn't blow it away
102
103DEPEND=Depends-${ARCH}
104
105# We deliberately don't have anything depend on the
106# $(DEPEND) file; otherwise it will get rebuilt even
107# on 'make clean'
108#
109
110## HACK: Specific to gcc
111## FIXME: The approach below is known to be conceptionally broken.
112depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
113##       Use gcc -M to generate dependencies
114##       Replace foo.o with $(ARCH)/foo.o
115##       Replace $(ARCH) value with string $(ARCH)
116##           so that it will for debug and profile cases
117        $(COMPILE) -M   $^    |  \
118        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
119            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
120        mv $(DEPEND).tmp $(DEPEND)
121depend: depend-am
122
123# pull in dependencies if they exist 
124ifeq (${DEPEND},$(wildcard ${DEPEND}))
125include ${DEPEND}
126@ENDIF@
127
128
129# spell out all the LINK_FILE's, rather than using -lbsp, so
130#  that $(LINK_FILES) can be a dependency
131
132LINK_OBJS = \
133    $(OBJS) \
134    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
135
136LINK_FILES =\
137    $(START_FILE) \
138    $(OBJS) \
139    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
140
141if RTEMS_USE_GCC
142## gcc >= 2.8
143define make-rel
144        $(LINK) -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) $^
145endef
146else
147## non-gcc
148define make-rel
149        $(LINK) $(XLDFLAGS) $^
150endef
151endif
152
153## -------------------------------------------------------------------------
154
155## translate VARIANT into VARIANT_V
156VARIANT = OPTIMIZE
157
158VARIANT_OPTIMIZE_V = OPTIMIZE
159VARIANT_DEBUG_V = DEBUG
160VARIANT_PROFILE_V = PROFILE
161VARIANT_optimize_V = OPTIMIZE
162VARIANT_debug_V = DEBUG
163VARIANT_profile_V = PROFILE
164
165VARIANT_V = $(VARIANT_$(VARIANT)_V)
166
167## Setup the variant build subdirectory
168ARCH_OPTIMIZE_V = o-optimize
169ARCH_DEBUG_V = o-debug
170ARCH_PROFILE_V = o-profile
171
172ARCH__V = $(ARCH_OPTIMIZE_V)
173ARCH = $(ARCH_$(VARIANT_V)_V)
174
175## Setup the library suffix
176LIBSUFFIX_OPTIMIZE_V =
177LIBSUFFIX_DEBUG_V = _g
178LIBSUFFIX_PROFILE_V = _p
179LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
180
181LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
182LIBSUFFIX_VA = $(LIB_VARIANT).a
183
184## These are supposed to be set in make/custom/<bsp>.cfg
185CPU_CFLAGS = @CPU_CFLAGS@
186CFLAGS_OPTIMIZE_V = @CFLAGS_OPTIMIZE_V@
187CFLAGS_DEBUG_V = @CFLAGS_DEBUG_V@
188CFLAGS_PROFILE_V = @CFLAGS_PROFILE_V@
189CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
190
191## ------------------------------------------------------------------------
192## Setup hard-coded flags
193if RTEMS_USE_GCC
194## gcc >= gcc-2.8
195RTEMS_CFLAGS_OPTIMIZE_V =
196RTEMS_CFLAGS_DEBUG_V = -qrtems_debug -Wno-unused
197RTEMS_CFLAGS_PROFILE_V = -pg
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)
Note: See TracBrowser for help on using the repository browser.