source: rtems/cpukit/automake/compile.am @ 6562751e

4.104.114.84.95
Last change on this file since 6562751e was 5ef82f97, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/01/03 at 04:10:53

2003-11-30 Ralf Corsepius <corsepiu@…>

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