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

Last change on this file since a0d2c79a was 16735ca, checked in by Ralf Corsepius <ralf.corsepius@…>, on 01/21/03 at 13:40:05

2003-01-21 Ralf Corsepius <corsepiu@…>

  • automake/compile.am: Remove CLEAN_DEPEND (Unused). Remove CLOBBER_DEPEND (Unused).
  • 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
85# We deliberately don't have anything depend on the
86# $(DEPEND) file; otherwise it will get rebuilt even
87# on 'make clean'
88#
89
90## HACK: Specific to gcc
91## FIXME: The approach below is known to be conceptionally broken.
92depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
93##       Use gcc -M to generate dependencies
94##       Replace foo.$(OBJEXT) with $(ARCH)/foo.$(OBJEXT)
95##       Replace $(ARCH) value with string $(ARCH)
96##           so that it will for debug and profile cases
97        $(COMPILE) -M   $^    |  \
98        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
99            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
100        mv $(DEPEND).tmp $(DEPEND)
101depend: depend-am
102
103# pull in dependencies if they exist 
104ifeq (${DEPEND},$(wildcard ${DEPEND}))
105include ${DEPEND}
106@ENDIF@
107
108## -------------------------------------------------------------------------
109
110## translate VARIANT into VARIANT_V
111VARIANT = OPTIMIZE
112
113VARIANT_OPTIMIZE_V = OPTIMIZE
114VARIANT_DEBUG_V = DEBUG
115VARIANT_PROFILE_V = PROFILE
116VARIANT_optimize_V = OPTIMIZE
117VARIANT_debug_V = DEBUG
118VARIANT_profile_V = PROFILE
119
120VARIANT_V = $(VARIANT_$(VARIANT)_V)
121
122## Setup the variant build subdirectory
123ARCH_OPTIMIZE_V = o-optimize
124ARCH_DEBUG_V = o-debug
125ARCH_PROFILE_V = o-profile
126
127ARCH__V = $(ARCH_OPTIMIZE_V)
128ARCH = $(ARCH_$(VARIANT_V)_V)
129
130## Setup the library suffix
131LIBSUFFIX_OPTIMIZE_V =
132LIBSUFFIX_DEBUG_V = _g
133LIBSUFFIX_PROFILE_V = _p
134LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
135
136LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
137LIBSUFFIX_VA = $(LIB_VARIANT).a
138
139## These are supposed to be set in make/custom/<bsp>.cfg
140CPU_CFLAGS = @CPU_CFLAGS@
141CFLAGS_OPTIMIZE_V = @CFLAGS_OPTIMIZE_V@
142CFLAGS_DEBUG_V = @CFLAGS_DEBUG_V@
143CFLAGS_PROFILE_V = @CFLAGS_PROFILE_V@
144CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
145
146## ------------------------------------------------------------------------
147## Setup hard-coded flags
148if RTEMS_USE_GCC
149## gcc >= gcc-2.8
150RTEMS_CFLAGS_OPTIMIZE_V =
151RTEMS_CFLAGS_DEBUG_V = -Wno-unused
152RTEMS_CFLAGS_PROFILE_V = -pg
153
154## non-gcc
155## We can't guess what flags might be required here.
156## Pass the values from the environment if you want to apply them.
157endif
158RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
159
160## -------------------------------------------------------------------------
161
162CC = @CC@ $(GCCSPECS)
163CPP = @CPP@ $(GCCSPECS)
164
165##
166AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
167AM_CFLAGS =
168AM_CCASFLAGS = $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
Note: See TracBrowser for help on using the repository browser.