1 |
1026 |
ivang |
##
|
2 |
|
|
## compile.am,v 1.4 2002/07/26 12:51:02 ralf Exp
|
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=' 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 |
|
|
|
43 |
|
|
if RTEMS_USE_GCC
|
44 |
|
|
## All the stuff below is specific to gcc
|
45 |
|
|
|
46 |
|
|
CFLAGS_DEFAULT=-g -Wall
|
47 |
|
|
## gcc >= 2.8.x
|
48 |
|
|
GCCSPECS = $(GCC_SPECS)
|
49 |
|
|
else
|
50 |
|
|
## fall back to the old style compilers/*.cfg
|
51 |
|
|
## CONFIG.CC is supposed to be provided by .cfg
|
52 |
|
|
include $(CONFIG.CC)
|
53 |
|
|
endif # RTEMS_USE_GCC
|
54 |
|
|
|
55 |
|
|
DEFS = @DEFS@
|
56 |
|
|
|
57 |
|
|
CPPFLAGS = @CPPFLAGS@ $(CPU_DEFINES) \
|
58 |
|
|
$(DEFINES) $(XCPPFLAGS) $(CPPFLAGS_GCC)
|
59 |
|
|
CFLAGS = $(CFLAGS_DEFAULT) $(CPU_CFLAGS) $(XCFLAGS)
|
60 |
|
|
ASFLAGS = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
|
61 |
|
|
|
62 |
|
|
## FIXME: This doesn't seem to be correct
|
63 |
|
|
# when debugging, optimize flag: typically empty
|
64 |
|
|
# some compilers do allow optimization with their "-g"
|
65 |
|
|
CFLAGS_DEBUG_OPTIMIZE_V=-g
|
66 |
|
|
|
67 |
|
|
# profile flag; use gprof(1)
|
68 |
|
|
CFLAGS_PROFILE_V=-pg
|
69 |
|
|
|
70 |
|
|
#
|
71 |
|
|
# How to compile stuff into ${ARCH} subdirectory
|
72 |
|
|
#
|
73 |
|
|
|
74 |
|
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
75 |
|
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
76 |
|
|
CCLD = $(CC)
|
77 |
|
|
|
78 |
|
|
CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
|
79 |
|
|
|
80 |
|
|
${ARCH}/%.$(OBJEXT): %.c
|
81 |
|
|
${COMPILE} -o $@ -c $<
|
82 |
|
|
|
83 |
|
|
${ARCH}/%.$(OBJEXT): %.S
|
84 |
|
|
${CCASCOMPILE} -o $@ -c $<
|
85 |
|
|
|
86 |
|
|
# Make foo.rel from foo.$(OBJEXT)
|
87 |
|
|
${ARCH}/%.rel: ${ARCH}/%.$(OBJEXT)
|
88 |
|
|
${make-rel}
|
89 |
|
|
|
90 |
|
|
# Dependency files for use by gmake
|
91 |
|
|
# NOTE: we don't put them into $(ARCH)
|
92 |
|
|
# so that 'make clean' doesn't blow it away
|
93 |
|
|
|
94 |
|
|
DEPEND=Depends-${ARCH}
|
95 |
|
|
|
96 |
|
|
CLEAN_DEPEND=$(DEPEND).tmp
|
97 |
|
|
CLOBBER_DEPEND=$(DEPEND)
|
98 |
|
|
|
99 |
|
|
# We deliberately don't have anything depend on the
|
100 |
|
|
# $(DEPEND) file; otherwise it will get rebuilt even
|
101 |
|
|
# on 'make clean'
|
102 |
|
|
#
|
103 |
|
|
|
104 |
|
|
## HACK: Specific to gcc
|
105 |
|
|
## FIXME: The approach below is known to be conceptionally broken.
|
106 |
|
|
depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
|
107 |
|
|
## Use gcc -M to generate dependencies
|
108 |
|
|
## Replace foo.$(OBJEXT) with $(ARCH)/foo.$(OBJEXT)
|
109 |
|
|
## Replace $(ARCH) value with string $(ARCH)
|
110 |
|
|
## so that it will for debug and profile cases
|
111 |
|
|
$(COMPILE) -M $^ | \
|
112 |
|
|
sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
|
113 |
|
|
-e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmp
|
114 |
|
|
mv $(DEPEND).tmp $(DEPEND)
|
115 |
|
|
depend: depend-am
|
116 |
|
|
|
117 |
|
|
# pull in dependencies if they exist
|
118 |
|
|
ifeq (${DEPEND},$(wildcard ${DEPEND}))
|
119 |
|
|
include ${DEPEND}
|
120 |
|
|
@ENDIF@
|
121 |
|
|
|
122 |
|
|
## -------------------------------------------------------------------------
|
123 |
|
|
|
124 |
|
|
## translate VARIANT into VARIANT_V
|
125 |
|
|
VARIANT = OPTIMIZE
|
126 |
|
|
|
127 |
|
|
VARIANT_OPTIMIZE_V = OPTIMIZE
|
128 |
|
|
VARIANT_DEBUG_V = DEBUG
|
129 |
|
|
VARIANT_PROFILE_V = PROFILE
|
130 |
|
|
VARIANT_optimize_V = OPTIMIZE
|
131 |
|
|
VARIANT_debug_V = DEBUG
|
132 |
|
|
VARIANT_profile_V = PROFILE
|
133 |
|
|
|
134 |
|
|
VARIANT_V = $(VARIANT_$(VARIANT)_V)
|
135 |
|
|
|
136 |
|
|
## Setup the variant build subdirectory
|
137 |
|
|
ARCH_OPTIMIZE_V = o-optimize
|
138 |
|
|
ARCH_DEBUG_V = o-debug
|
139 |
|
|
ARCH_PROFILE_V = o-profile
|
140 |
|
|
|
141 |
|
|
ARCH__V = $(ARCH_OPTIMIZE_V)
|
142 |
|
|
ARCH = $(ARCH_$(VARIANT_V)_V)
|
143 |
|
|
|
144 |
|
|
## Setup the library suffix
|
145 |
|
|
LIBSUFFIX_OPTIMIZE_V =
|
146 |
|
|
LIBSUFFIX_DEBUG_V = _g
|
147 |
|
|
LIBSUFFIX_PROFILE_V = _p
|
148 |
|
|
LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
|
149 |
|
|
|
150 |
|
|
LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
|
151 |
|
|
LIBSUFFIX_VA = $(LIB_VARIANT).a
|
152 |
|
|
|
153 |
|
|
## These are supposed to be set in make/custom/.cfg
|
154 |
|
|
## CFLAGS_OPTIMIZE_V =
|
155 |
|
|
## CFLAGS_DEBUG_V =
|
156 |
|
|
## CFLAGS_PROFILE_V =
|
157 |
|
|
CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
|
158 |
|
|
|
159 |
|
|
## ------------------------------------------------------------------------
|
160 |
|
|
## Setup hard-coded flags
|
161 |
|
|
if RTEMS_USE_GCC
|
162 |
|
|
## gcc >= gcc-2.8
|
163 |
|
|
RTEMS_CFLAGS_OPTIMIZE_V =
|
164 |
|
|
RTEMS_CFLAGS_DEBUG_V = -Wno-unused
|
165 |
|
|
RTEMS_CFLAGS_PROFILE_V =
|
166 |
|
|
|
167 |
|
|
## non-gcc
|
168 |
|
|
## We can't guess what flags might be required here.
|
169 |
|
|
## Pass the values from the environment if you want to apply them.
|
170 |
|
|
endif
|
171 |
|
|
RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
|
172 |
|
|
|
173 |
|
|
## -------------------------------------------------------------------------
|
174 |
|
|
|
175 |
|
|
CC = @CC@ $(GCCSPECS)
|
176 |
|
|
CPP = @CPP@ $(GCCSPECS)
|
177 |
|
|
|
178 |
|
|
##
|
179 |
|
|
AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
|
180 |
|
|
|
181 |
|
|
AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
|
182 |
|
|
|
183 |
|
|
# AM_CFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CFLAGS)
|
184 |
|
|
AM_CCASFLAGS = $(RTEMS_BSP_CFLAGS) $(RTEMS_CPPFLAGS) $(RTEMS_ASFLAGS)
|