OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [automake/] [compile.am] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
##
2
## compile.am,v 1.18 2002/07/22 09:17:40 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, XCXXFLAGS, 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) $(RTEMS_BSP_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
CXXFLAGS = $(CFLAGS_DEFAULT) $(CPU_CFLAGS) $(XCXXFLAGS)
61
ASFLAGS  = $(CPU_ASFLAGS) $(CPU_CFLAGS) $(XASFLAGS)
62
 
63
LINK_LIBS = $(LD_LIBS)
64
 
65
## FIXME: This doesn't seem to be correct
66
# when debugging, optimize flag: typically empty
67
# some compilers do allow optimization with their "-g"
68
CFLAGS_DEBUG_OPTIMIZE_V=-g
69
CXXFLAGS_DEBUG_OPTIMIZE_V=-g
70
LDFLAGS_DEBUG_V =
71
 
72
# profile flag; use gprof(1)
73
CFLAGS_PROFILE_V=-pg
74
CXXFLAGS_PROFILE_V=-pg
75
LDFLAGS_PROFILE_V =
76
 
77
# List of library paths without -L
78
LD_PATHS= $(PROJECT_RELEASE)/lib
79
 
80
# ld flag for incomplete link
81
LDFLAGS_INCOMPLETE = -r
82
 
83
# ld flags for profiling, debugging
84
LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
85
 
86
#
87
# Client compiler and support tools
88
#
89
 
90
#
91
# How to compile stuff into ${ARCH} subdirectory
92
#
93
 
94
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
95
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
96
CCLD = $(CC)
97
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
98
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
99
 
100
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
101
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
102
CXXLD = $(CXX)
103
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
104
        $(AM_LDFLAGS) $(LDFLAGS) -o $@
105
 
106
AS = $(CC)
107
ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS)
108
 
109
${ARCH}/%.o: %.c
110
        test -d $(ARCH) || mkdir $(ARCH)
111
        ${COMPILE} -o $@ -c $<
112
 
113
${ARCH}/%.o: %.cc
114
        test -d $(ARCH) || mkdir $(ARCH)
115
        ${CXXCOMPILE} -o $@ -c $<
116
 
117
${ARCH}/%.o: %.cpp
118
        test -d $(ARCH) || mkdir $(ARCH)
119
        ${CXXCOMPILE} -o $@ -c $<
120
 
121
${ARCH}/%.o: %.cxx
122
        test -d $(ARCH) || mkdir $(ARCH)
123
        ${CXXCOMPILE} -o $@ -c $<
124
 
125
${ARCH}/%.o: %.C
126
        test -d $(ARCH) || mkdir $(ARCH)
127
        ${CXXCOMPILE} -o $@ -c $<
128
 
129
${ARCH}/%.o: %.S
130
        test -d $(ARCH) || mkdir $(ARCH)
131
        ${ASCOMPILE} -DASM -o $@ -c $<
132
 
133
# Make foo.rel from foo.o
134
${ARCH}/%.rel: ${ARCH}/%.o
135
        test -d $(ARCH) || mkdir $(ARCH)
136
        ${make-rel}
137
 
138
# Dependency files for use by gmake
139
# NOTE: we don't put them into $(ARCH)
140
#       so that 'make clean' doesn't blow it away
141
 
142
DEPEND=Depends-${ARCH}
143
 
144
CLEAN_DEPEND=$(DEPEND).tmp
145
CLOBBER_DEPEND=$(DEPEND)
146
 
147
# We deliberately don't have anything depend on the
148
# $(DEPEND) file; otherwise it will get rebuilt even
149
# on 'make clean'
150
#
151
 
152
## HACK: Specific to gcc
153
## FIXME: The approach below is known to be conceptionally broken.
154
depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
155
##       Use gcc -M to generate dependencies
156
##       Replace foo.o with $(ARCH)/foo.o
157
##       Replace $(ARCH) value with string $(ARCH)
158
##           so that it will for debug and profile cases
159
        $(COMPILE) -M   $^    |  \
160
        sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
161
            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
162
        mv $(DEPEND).tmp $(DEPEND)
163
depend: depend-am
164
 
165
# pull in dependencies if they exist
166
ifeq (${DEPEND},$(wildcard ${DEPEND}))
167
include ${DEPEND}
168
@ENDIF@
169
 
170
 
171
# spell out all the LINK_FILE's, rather than using -lbsp, so
172
#  that $(LINK_FILES) can be a dependency
173
 
174
LINK_OBJS = \
175
    $(OBJS) \
176
    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
177
 
178
LINK_FILES =\
179
    $(START_FILE) \
180
    $(OBJS) \
181
    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
182
 
183
if RTEMS_USE_GCC
184
## gcc >= 2.8
185
define make-rel
186
        $(LINK) -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) $^
187
endef
188
else
189
## non-gcc
190
define make-rel
191
        $(LINK) $(XLDFLAGS) $^
192
endef
193
endif
194
 
195
## -------------------------------------------------------------------------
196
 
197
## translate VARIANT into VARIANT_V
198
VARIANT = OPTIMIZE
199
 
200
VARIANT_OPTIMIZE_V = OPTIMIZE
201
VARIANT_DEBUG_V = DEBUG
202
VARIANT_PROFILE_V = PROFILE
203
VARIANT_optimize_V = OPTIMIZE
204
VARIANT_debug_V = DEBUG
205
VARIANT_profile_V = PROFILE
206
 
207
VARIANT_V = $(VARIANT_$(VARIANT)_V)
208
 
209
## Setup the variant build subdirectory
210
ARCH_OPTIMIZE_V = o-optimize
211
ARCH_DEBUG_V = o-debug
212
ARCH_PROFILE_V = o-profile
213
 
214
ARCH__V = $(ARCH_OPTIMIZE_V)
215
ARCH = $(ARCH_$(VARIANT_V)_V)
216
 
217
## Setup the library suffix
218
LIBSUFFIX_OPTIMIZE_V =
219
LIBSUFFIX_DEBUG_V = _g
220
LIBSUFFIX_PROFILE_V = _p
221
LIBSUFFIX__V = $(LIBSUFFIX_OPTIMIZE_V)
222
 
223
LIB_VARIANT = $(LIBSUFFIX_$(VARIANT_V)_V)
224
LIBSUFFIX_VA = $(LIB_VARIANT).a
225
 
226
## These are supposed to be set in make/custom/.cfg
227
## CFLAGS_OPTIMIZE_V =
228
## CFLAGS_DEBUG_V =
229
## CFLAGS_PROFILE_V =
230
CFLAGS__V = $(CFLAGS_OPTIMIZE_V)
231
 
232
## ------------------------------------------------------------------------
233
## Setup hard-coded flags
234
if RTEMS_USE_GCC
235
## gcc >= gcc-2.8
236
RTEMS_CFLAGS_OPTIMIZE_V =
237
RTEMS_CFLAGS_DEBUG_V = -qrtems_debug -Wno-unused
238
RTEMS_CFLAGS_PROFILE_V =
239
 
240
## non-gcc
241
## We can't guess what flags might be required here.
242
## Pass the values from the environment if you want to apply them.
243
endif
244
RTEMS_CFLAGS__V = $(RTEMS_CFLAGS_OPTIMIZE_V)
245
 
246
## -------------------------------------------------------------------------
247
 
248
CC = @CC@ $(GCCSPECS)
249
CXX = @CXX@ $(GCCSPECS)
250
CPP = @CPP@ $(GCCSPECS)
251
 
252
LD = @LD@
253
OBJCOPY = @OBJCOPY@
254
NM = @NM@
255
SIZE = @SIZE@
256
STRIP = @STRIP@
257
 
258
 
259
##
260
AM_CPPFLAGS = $(RTEMS_CPPFLAGS)
261
 
262
AM_CFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)
263
AM_CXXFLAGS = $(RTEMS_CFLAGS_$(VARIANT_V)_V) $(CFLAGS_$(VARIANT_V)_V)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.