source: rtems/c/src/exec/automake/compile.am @ 6ba9c27

4.104.114.84.95
Last change on this file since 6ba9c27 was 5261406, checked in by Ralf Corsepius <ralf.corsepius@…>, on 06/27/02 at 12:18:24

2002-06-27 Ralf Corsepius <corsepiu@…>

  • aclocal/prog-ccas.m4: New.
  • aclocal/canonicalize-tools.m4: Remove AS, OBJCOPY, NM, SIZE, STRIP. RTEMS_GCC_PRINT
  • aclocal/check-multiprocessing.m4: Fix typo.
  • automake/compile.am: Remove CXX support. Replace AS by CCAS. Remove LINK_LIBS, LINK_OBJS, LINK_FILES.
  • Property mode set to 100644
File size: 5.5 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, 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)
60ASFLAGS  = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
61
62## FIXME: This doesn't seem to be correct
63# when debugging, optimize flag: typically empty
64# some compilers do allow optimization with their "-g"
65CFLAGS_DEBUG_OPTIMIZE_V=-g
66LDFLAGS_DEBUG_V =
67
68# profile flag; use gprof(1)
69CFLAGS_PROFILE_V=-pg
70LDFLAGS_PROFILE_V =
71
72# List of library paths without -L
73LD_PATHS= $(PROJECT_RELEASE)/lib
74
75# ld flag for incomplete link
76LDFLAGS_INCOMPLETE = -r
77
78# ld flags for profiling, debugging
79LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
80
81#
82# How to compile stuff into ${ARCH} subdirectory
83#
84
85COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
86        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
87CCLD = $(CC)
88LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
89        $(AM_LDFLAGS) $(LDFLAGS) -o $@
90
91CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
92
93${ARCH}/%.o: %.c
94        ${COMPILE} -o $@ -c $<
95
96${ARCH}/%.o: %.S
97        ${CCASCOMPILE} -o $@ -c $<
98
99# Make foo.rel from foo.o
100${ARCH}/%.rel: ${ARCH}/%.o
101        ${make-rel}
102
103# Dependency files for use by gmake
104# NOTE: we don't put them into $(ARCH)
105#       so that 'make clean' doesn't blow it away
106
107DEPEND=Depends-${ARCH}
108
109CLEAN_DEPEND=$(DEPEND).tmp
110CLOBBER_DEPEND=$(DEPEND)
111
112# We deliberately don't have anything depend on the
113# $(DEPEND) file; otherwise it will get rebuilt even
114# on 'make clean'
115#
116
117## HACK: Specific to gcc
118## FIXME: The approach below is known to be conceptionally broken.
119depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
120##       Use gcc -M to generate dependencies
121##       Replace foo.o with $(ARCH)/foo.o
122##       Replace $(ARCH) value with string $(ARCH)
123##           so that it will for debug and profile cases
124        $(COMPILE) -M   $^    |  \
125        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
126            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
127        mv $(DEPEND).tmp $(DEPEND)
128depend: depend-am
129
130# pull in dependencies if they exist 
131ifeq (${DEPEND},$(wildcard ${DEPEND}))
132include ${DEPEND}
133@ENDIF@
134
135if RTEMS_USE_GCC
136## gcc >= 2.8
137define make-rel
138        $(LINK) -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) $^
139endef
140else
141## non-gcc
142define make-rel
143        $(LINK) $(XLDFLAGS) $^
144endef
145endif
146
147## -------------------------------------------------------------------------
148
149## translate VARIANT into VARIANT_V
150VARIANT = OPTIMIZE
151
152VARIANT_OPTIMIZE_V = OPTIMIZE
153VARIANT_DEBUG_V = DEBUG
154VARIANT_PROFILE_V = PROFILE
155VARIANT_optimize_V = OPTIMIZE
156VARIANT_debug_V = DEBUG
157VARIANT_profile_V = PROFILE
158
159VARIANT_V = $(VARIANT_$(VARIANT)_V)
160
161## Setup the variant build subdirectory
162ARCH_OPTIMIZE_V = o-optimize
163ARCH_DEBUG_V = o-debug
164ARCH_PROFILE_V = o-profile
165
166ARCH__V = $(ARCH_OPTIMIZE_V)
167ARCH = $(ARCH_$(VARIANT_V)_V)
168
169## Setup the library suffix
170LIBSUFFIX_OPTIMIZE_V =
171LIBSUFFIX_DEBUG_V = _g
172LIBSUFFIX_PROFILE_V = _p
173LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
174
175LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
176LIBSUFFIX_VA = $(LIB_VARIANT).a
177
178## These are supposed to be set in make/custom/<bsp>.cfg
179## CFLAGS_OPTIMIZE_V =
180## CFLAGS_DEBUG_V =
181## CFLAGS_PROFILE_V =
182CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
183
184## ------------------------------------------------------------------------
185## Setup hard-coded flags
186if RTEMS_USE_GCC
187## gcc >= gcc-2.8
188RTEMS_CFLAGS_OPTIMIZE_V =
189RTEMS_CFLAGS_DEBUG_V = -qrtems_debug -Wno-unused
190RTEMS_CFLAGS_PROFILE_V =
191
192## non-gcc
193## We can't guess what flags might be required here.
194## Pass the values from the environment if you want to apply them.
195endif
196RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
197
198## -------------------------------------------------------------------------
199
200CC = @CC@ $(GCCSPECS)
201CPP = @CPP@ $(GCCSPECS)
202
203##
204AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
205
206AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
207
208# AM_CFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CFLAGS)
209AM_CCASFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
Note: See TracBrowser for help on using the repository browser.