source: rtems/cpukit/automake/compile.am @ 8e4cd5a

4.104.114.84.95
Last change on this file since 8e4cd5a was 8e4cd5a, checked in by Ralf Corsepius <ralf.corsepius@…>, on Dec 6, 2002 at 11:21:50 AM

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

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