source: rtems/cpukit/automake/compile.am @ baa8dd7c

4.104.114.84.95
Last change on this file since baa8dd7c was baa8dd7c, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/06/02 at 13:07:15

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

  • automake/compile.am: Rework *FLAGS, AM_*FLAGS handling.
  • Property mode set to 100644
File size: 4.7 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## gcc >= 2.8.x
46GCCSPECS = $(GCC_SPECS)
47else
48## fall back to the old style compilers/*.cfg
49## CONFIG.CC is supposed to be provided by <BSP>.cfg
50include $(CONFIG.CC)
51endif # RTEMS_USE_GCC
52
53DEFS = @DEFS@
54
55CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) $(DEFINES) $(XCPPFLAGS)
56CFLAGS   = @RTEMS_CFLAGS@ $(XCFLAGS)
57ASFLAGS  = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
58
59#
60# How to compile stuff into ${ARCH} subdirectory
61#
62
63COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
64        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
65CCLD = $(CC)
66
67CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
68
69${ARCH}/%.$(OBJEXT): %.c
70        ${COMPILE} -o $@ -c $<
71
72${ARCH}/%.$(OBJEXT): %.S
73        ${CCASCOMPILE} -o $@ -c $<
74
75# Make foo.rel from foo.$(OBJEXT)
76${ARCH}/%.rel: ${ARCH}/%.$(OBJEXT)
77        ${make-rel}
78
79# Dependency files for use by gmake
80# NOTE: we don't put them into $(ARCH)
81#       so that 'make clean' doesn't blow it away
82
83DEPEND=Depends-${ARCH}
84
85CLEAN_DEPEND=$(DEPEND).tmp
86CLOBBER_DEPEND=$(DEPEND)
87
88# We deliberately don't have anything depend on the
89# $(DEPEND) file; otherwise it will get rebuilt even
90# on 'make clean'
91#
92
93## HACK: Specific to gcc
94## FIXME: The approach below is known to be conceptionally broken.
95depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
96##       Use gcc -M to generate dependencies
97##       Replace foo.$(OBJEXT) with $(ARCH)/foo.$(OBJEXT)
98##       Replace $(ARCH) value with string $(ARCH)
99##           so that it will for debug and profile cases
100        $(COMPILE) -M   $^    |  \
101        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
102            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
103        mv $(DEPEND).tmp $(DEPEND)
104depend: depend-am
105
106# pull in dependencies if they exist 
107ifeq (${DEPEND},$(wildcard ${DEPEND}))
108include ${DEPEND}
109@ENDIF@
110
111## -------------------------------------------------------------------------
112
113## translate VARIANT into VARIANT_V
114VARIANT = OPTIMIZE
115
116VARIANT_OPTIMIZE_V = OPTIMIZE
117VARIANT_DEBUG_V = DEBUG
118VARIANT_PROFILE_V = PROFILE
119VARIANT_optimize_V = OPTIMIZE
120VARIANT_debug_V = DEBUG
121VARIANT_profile_V = PROFILE
122
123VARIANT_V = $(VARIANT_$(VARIANT)_V)
124
125## Setup the variant build subdirectory
126ARCH_OPTIMIZE_V = o-optimize
127ARCH_DEBUG_V = o-debug
128ARCH_PROFILE_V = o-profile
129
130ARCH__V = $(ARCH_OPTIMIZE_V)
131ARCH = $(ARCH_$(VARIANT_V)_V)
132
133## Setup the library suffix
134LIBSUFFIX_OPTIMIZE_V =
135LIBSUFFIX_DEBUG_V = _g
136LIBSUFFIX_PROFILE_V = _p
137LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
138
139LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
140LIBSUFFIX_VA = $(LIB_VARIANT).a
141
142## These are supposed to be set in make/custom/<bsp>.cfg
143CPU_CFLAGS = @CPU_CFLAGS@
144CFLAGS_OPTIMIZE_V = @CFLAGS_OPTIMIZE_V@
145CFLAGS_DEBUG_V = @CFLAGS_DEBUG_V@
146CFLAGS_PROFILE_V = @CFLAGS_PROFILE_V@
147CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
148
149## ------------------------------------------------------------------------
150## Setup hard-coded flags
151if RTEMS_USE_GCC
152## gcc >= gcc-2.8
153RTEMS_CFLAGS_OPTIMIZE_V =
154RTEMS_CFLAGS_DEBUG_V = -Wno-unused
155RTEMS_CFLAGS_PROFILE_V = -pg
156
157## non-gcc
158## We can't guess what flags might be required here.
159## Pass the values from the environment if you want to apply them.
160endif
161RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
162
163## -------------------------------------------------------------------------
164
165CC = @CC@ $(GCCSPECS)
166CPP = @CPP@ $(GCCSPECS)
167
168##
169AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
170AM_CFLAGS =
171AM_CCASFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
Note: See TracBrowser for help on using the repository browser.