source: rtems/cpukit/automake/compile.am @ 385b2e2

Last change on this file since 385b2e2 was 385b2e2, checked in by Ralf Corsepius <ralf.corsepius@…>, on Feb 18, 2003 at 12:58:44 PM

2003-02-18 Ralf Corsepius <corsepiu@…>

  • automake/local.am: Introduce depend-gcc. Remove ${ARCH}.
  • automake/compile.am: Remove GCCSPECS, GCC_SPECS, CONFIG.CC, CC, CPP. Add ${ARCH}. depend-gcc.
  • aclocal/prog-cc.m4: Set up RTEMS_CPPFLAGS.
  • aclocal/env-rtemscpu.m4: Remove GCC_SPECS.
  • aclocal/env-rtemsbsp.m4: Remove GCC_SPECS.
  • Property mode set to 100644
File size: 4.4 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
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
60        ${COMPILE} -o $@ -c $<
61
62${ARCH}/%.$(OBJEXT): %.S
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 and profile 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_PROFILE_V = PROFILE
108VARIANT_optimize_V = OPTIMIZE
109VARIANT_debug_V = DEBUG
110VARIANT_profile_V = PROFILE
111
112VARIANT_V = $(VARIANT_$(VARIANT)_V)
113
114## Setup the variant build subdirectory
115ARCH_OPTIMIZE_V = o-optimize
116ARCH_DEBUG_V = o-debug
117ARCH_PROFILE_V = o-profile
118
119ARCH__V = $(ARCH_OPTIMIZE_V)
120ARCH = $(ARCH_$(VARIANT_V)_V)
121
122${ARCH}:
123        mkdir ${ARCH}
124
125## Setup the library suffix
126LIBSUFFIX_OPTIMIZE_V =
127LIBSUFFIX_DEBUG_V = _g
128LIBSUFFIX_PROFILE_V = _p
129LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
130
131LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
132LIBSUFFIX_VA = $(LIB_VARIANT).a
133
134## These are supposed to be set in make/custom/<bsp>.cfg
135CPU_CFLAGS = @CPU_CFLAGS@
136CFLAGS_OPTIMIZE_V = @CFLAGS_OPTIMIZE_V@
137CFLAGS_DEBUG_V = @CFLAGS_DEBUG_V@
138CFLAGS_PROFILE_V = @CFLAGS_PROFILE_V@
139CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
140
141## ------------------------------------------------------------------------
142## Setup hard-coded flags
143if RTEMS_USE_GCC
144## gcc >= gcc-2.8
145RTEMS_CFLAGS_OPTIMIZE_V =
146RTEMS_CFLAGS_DEBUG_V = -Wno-unused
147RTEMS_CFLAGS_PROFILE_V = -pg
148
149## non-gcc
150## We can't guess what flags might be required here.
151## Pass the values from the environment if you want to apply them.
152endif
153RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
154
155## -------------------------------------------------------------------------
156AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
157AM_CFLAGS =
158AM_CCASFLAGS = $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
Note: See TracBrowser for help on using the repository browser.