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

4.104.114.84.95
Last change on this file since 1f64ebf was 86f12bc, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/19/02 at 17:05:34

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

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