source: rtems/automake/compile.am @ a9f1a11

4.104.114.84.9
Last change on this file since a9f1a11 was a9f1a11, checked in by Ralf Corsepius <ralf.corsepius@…>, on Nov 8, 2002 at 5:58:26 PM

2002-11-08 Ralf Corsepius <corsepiu@…>

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