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

4.104.114.84.95
Last change on this file since a953fa1 was a953fa1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/17/03 at 03:54:31

2003-12-17 Ralf Corsepius <corsepiu@…>

  • automake/compile.am: Use $(mkdir_p) instead of $(mkinstalldirs).
  • Property mode set to 100644
File size: 4.3 KB
RevLine 
[9ea3832c]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
[d46ec86]33## CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V are the values we
[9ea3832c]34## would want the corresponding macros to be set to.
35##
[d46ec86]36## CFLAGS_OPTIMIZE, CFLAGS_DEBUG are set by the
37## 'VARIANT=<OPTIMIZE|DEBUG>' targets to their _V values.
[9ea3832c]38
[5261406]39## XCPPFLAGS, XCFLAGS, XASFLAGS
[9ea3832c]40## are used to add flags from the shell
41## cf. make.info ("Implicit rules/variables" for details)
42
43DEFS = @DEFS@
44
[baa8dd7c]45CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) $(DEFINES) $(XCPPFLAGS)
46CFLAGS   = @RTEMS_CFLAGS@ $(XCFLAGS)
[9ea3832c]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
[5261406]57CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
[9ea3832c]58
[5ef82f97]59${ARCH}/%.$(OBJEXT): %.c $(ARCH)/$(dirstamp)
[9ea3832c]60        ${COMPILE} -o $@ -c $<
61
[5ef82f97]62${ARCH}/%.$(OBJEXT): %.S $(ARCH)/$(dirstamp)
[5261406]63        ${CCASCOMPILE} -o $@ -c $<
[9ea3832c]64
[c3efdb3]65# Make foo.rel from foo.$(OBJEXT)
66${ARCH}/%.rel: ${ARCH}/%.$(OBJEXT)
[9ea3832c]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
[b9184faa]80if RTEMS_USE_GCC
[9ea3832c]81## HACK: Specific to gcc
82## FIXME: The approach below is known to be conceptionally broken.
[b9184faa]83depend-gcc: $(C_FILES) $(CC_FILES) $(S_FILES)
[9ea3832c]84##       Use gcc -M to generate dependencies
[c3efdb3]85##       Replace foo.$(OBJEXT) with $(ARCH)/foo.$(OBJEXT)
[9ea3832c]86##       Replace $(ARCH) value with string $(ARCH)
[d46ec86]87##           so that it will for debug cases
[9ea3832c]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@
[b9184faa]97endif
98depend: depend-gcc
[9ea3832c]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
[5ef82f97]119${ARCH}/$(dirstamp):
[a953fa1]120        @$(mkdir_p) $(ARCH)
[5ef82f97]121        @: > $(ARCH)/$(dirstamp)
[b9184faa]122
[9ea3832c]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
[8e4cd5a]131CPU_CFLAGS = @CPU_CFLAGS@
132CFLAGS_OPTIMIZE_V = @CFLAGS_OPTIMIZE_V@
133CFLAGS_DEBUG_V = @CFLAGS_DEBUG_V@
[9ea3832c]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 =
[14620166]141RTEMS_CFLAGS_DEBUG_V = -Wno-unused
[9ea3832c]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)
[baa8dd7c]151AM_CFLAGS =
[28ed8f3]152AM_CCASFLAGS = $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
Note: See TracBrowser for help on using the repository browser.