source: rtems/automake/compile.am @ f442116c

4.104.114.84.95
Last change on this file since f442116c was f442116c, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/12/02 at 16:06:22

2002-12-12 Ralf Corsepius <corsepiu@…>

  • automake/compile.am: Remove creating $(ARCH) in compilation rules.
  • Property mode set to 100644
File size: 5.8 KB
RevLine 
[7294718f]1##
2## $Id$
3##
[03d5706]4
5## -------------------------------------------------------------------------
[1ea70d78]6## NOTE: This file is rather immature and has to be considered to be
7## almost experimental.
[03d5706]8##
[1ea70d78]9## Expect frequent changes -- It deserves to be cleaned up :(
[03d5706]10## -------------------------------------------------------------------------
11
[1ea70d78]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
[560aae24]47GCCSPECS = $(GCC_SPECS) $(RTEMS_BSP_SPECS)
[1ea70d78]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
[03d5706]54DEFS = @DEFS@
55
[baa8dd7c]56CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) $(DEFINES) $(XCPPFLAGS)
57CFLAGS   = @RTEMS_CFLAGS@ $(XCFLAGS)
58CXXFLAGS = @RTEMS_CXXFLAGS@ $(XCXXFLAGS)
[a34b245]59ASFLAGS  = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
[1ea70d78]60
[978f59a]61LINK_LIBS = $(LD_LIBS)
[1ea70d78]62
63#
64# Client compiler and support tools
65#
66
67#
68# How to compile stuff into ${ARCH} subdirectory
69#
70
[bfba54e]71COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
72        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
[a34b245]73CCLD = $(CC)
74LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
75        $(AM_LDFLAGS) $(LDFLAGS) -o $@
[bfba54e]76
77CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
78        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
[ba748523]79CXXLD = $(CXX)
[a34b245]80CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
81        $(AM_LDFLAGS) $(LDFLAGS) -o $@
82
[29d82b25]83CCAS = $(CC)
84CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
85
86# OBSOLETE: Don't use
[a34b245]87AS = $(CC)
[ba748523]88ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS)
[bfba54e]89
[1ea70d78]90${ARCH}/%.o: %.c
[bfba54e]91        ${COMPILE} -o $@ -c $<
[1ea70d78]92
93${ARCH}/%.o: %.cc
[bfba54e]94        ${CXXCOMPILE} -o $@ -c $<
[1ea70d78]95
96${ARCH}/%.o: %.S
[29d82b25]97        ${CCASCOMPILE} -DASM -o $@ -c $<
[1ea70d78]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
105CLEAN_DEPEND=$(DEPEND).tmp
106CLOBBER_DEPEND=$(DEPEND)
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
113## HACK: Specific to gcc
114## FIXME: The approach below is known to be conceptionally broken.
115depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
116##       Use gcc -M to generate dependencies
117##       Replace foo.o with $(ARCH)/foo.o
118##       Replace $(ARCH) value with string $(ARCH)
119##           so that it will for debug and profile cases
[ba748523]120        $(COMPILE) -M   $^    |  \
[1ea70d78]121        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
122            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
123        mv $(DEPEND).tmp $(DEPEND)
124depend: depend-am
125
[372e4e2]126# pull in dependencies if they exist 
127ifeq (${DEPEND},$(wildcard ${DEPEND}))
128include ${DEPEND}
129@ENDIF@
130
131
[1ea70d78]132# spell out all the LINK_FILE's, rather than using -lbsp, so
133#  that $(LINK_FILES) can be a dependency
134
135LINK_OBJS = \
136    $(OBJS) \
137    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
138
139LINK_FILES =\
140    $(START_FILE) \
141    $(OBJS) \
[c274328b]142    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
143
[1ea70d78]144if RTEMS_USE_GCC
145## gcc >= 2.8
146define make-rel
[a34b245]147        $(LINK) -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) $^
[1ea70d78]148endef
149else
150## non-gcc
151define make-rel
[a34b245]152        $(LINK) $(XLDFLAGS) $^
[1ea70d78]153endef
154endif
155
156## -------------------------------------------------------------------------
157
158## translate VARIANT into VARIANT_V
159VARIANT = OPTIMIZE
160
161VARIANT_OPTIMIZE_V = OPTIMIZE
162VARIANT_DEBUG_V = DEBUG
163VARIANT_PROFILE_V = PROFILE
164VARIANT_optimize_V = OPTIMIZE
165VARIANT_debug_V = DEBUG
166VARIANT_profile_V = PROFILE
167
168VARIANT_V = $(VARIANT_$(VARIANT)_V)
169
170## Setup the variant build subdirectory
171ARCH_OPTIMIZE_V = o-optimize
172ARCH_DEBUG_V = o-debug
173ARCH_PROFILE_V = o-profile
174
175ARCH__V = $(ARCH_OPTIMIZE_V)
176ARCH = $(ARCH_$(VARIANT_V)_V)
177
178## Setup the library suffix
179LIBSUFFIX_OPTIMIZE_V =
180LIBSUFFIX_DEBUG_V = _g
181LIBSUFFIX_PROFILE_V = _p
182LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
183
184LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
185LIBSUFFIX_VA = $(LIB_VARIANT).a
186
187## These are supposed to be set in make/custom/<bsp>.cfg
[f04c916]188CPU_CFLAGS = @CPU_CFLAGS@
189CFLAGS_OPTIMIZE_V = @CFLAGS_OPTIMIZE_V@
190CFLAGS_DEBUG_V = @CFLAGS_DEBUG_V@
191CFLAGS_PROFILE_V = @CFLAGS_PROFILE_V@
[1ea70d78]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
[29d82b25]200RTEMS_CFLAGS_PROFILE_V = -pg
[978f59a]201
[1ea70d78]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
[509f8351]210CC = @CC@ $(GCCSPECS)
211CXX = @CXX@ $(GCCSPECS)
[560aae24]212CPP = @CPP@ $(GCCSPECS)
213
[4dc2e9a]214LD = @LD@
[63b24d29]215OBJCOPY = @OBJCOPY@
216NM = @NM@
217SIZE = @SIZE@
218STRIP = @STRIP@
[1ea70d78]219
[03d5706]220##
[bfba54e]221AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
[baa8dd7c]222AM_CFLAGS =
223AM_CXXFLAGS =
224AM_CCASFLAGS = $(CPU_CFLAGS) $(RTEMS_CPPFLAGS) $(RTEMS_CCASFLAGS)
Note: See TracBrowser for help on using the repository browser.