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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [make/] [compilers/] [gcc-target-default.cfg] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
#
2
#  Shared compiler for all GNU tools configurations
3
#
4
#  gcc-target-default.cfg,v 1.35 2002/01/22 17:35:22 joel Exp
5
#
6
 
7
##
8
# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
9
# would want the corresponding macros to be set to.
10
#
11
# CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set in the leaf
12
# Makefiles by the 'debug:' and 'profile:' targets to their _V values.
13
#
14
 
15
# default flags
16
# XCPPFLAGS, XCFLAGS, XCXXFLAGS, XASFLAGS
17
# are used to add flags from the shell
18
# cf. make.info ("Implicit rules/variables" for details)
19
 
20
# NOTE: Should these go to CPPFLAGS ?
21
CFLAGS_DEFAULT=-g -Wall
22
 
23
# NOTE: CPU_CFLAGS should probably be renamed to CPU_CPPFLAGS
24
# NOTE: CPU_DEFINES should probably be merged with CPU_CFLAGS
25
CPPFLAGS += $(CPU_DEFINES) $(CPU_CFLAGS) $(DEFINES) $(XCPPFLAGS)
26
CFLAGS   = $(CFLAGS_DEFAULT) $(XCFLAGS)
27
CXXFLAGS = $(CFLAGS_DEFAULT) $(XCXXFLAGS)
28
ASFLAGS  = $(CPU_ASFLAGS) $(XASFLAGS)
29
 
30
ifeq ($(RTEMS_USE_GCC272),yes)
31
ifeq ($(RTEMS_CROSS_TARGET),no)
32
 
33
ifdef RTEMS_LIBC_DIR
34
RTEMS_LIBC_INCLUDES := -I$(RTEMS_LIBC_DIR)/include
35
endif
36
 
37
# Used for posix bsps
38
CPPFLAGS += \
39
  -I$(PROJECT_INCLUDE) \
40
  $(RTEMS_LIBC_INCLUDES)
41
else
42
# Used for embedded bsps
43
# Ask gcc where it finds its own include files
44
GCC_INCLUDE=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=include $(GCCSED))
45
 
46
CPPFLAGS += -nostdinc \
47
  -I$(PROJECT_INCLUDE) \
48
  -I$(GCC_INCLUDE) \
49
  -I$(RTEMS_LIBC_DIR)/sys-include \
50
  -I$(RTEMS_LIBC_DIR)/include
51
endif
52
 
53
# default location of Standard C Library
54
ifndef LIBC_LIBC
55
LIBC_LIBC=$(RTEMS_LIBC_DIR)/lib/libc.a
56
endif
57
 
58
ifndef LIBC_LIBM
59
LIBC_LIBM=$(RTEMS_LIBC_DIR)/lib/libm.a
60
endif
61
 
62
else
63
# NOTE: GCCSPECS probably belongs to CPPFLAGS
64
# Unfortunately, many custom/*.cfg files do not pass CPPFLAGS
65
# to their gcc-2.8 make-exe rules
66
GCCSPECS = -B$(PROJECT_RELEASE)/lib/ -specs bsp_specs -qrtems
67
 
68
CC  += $(GCCSPECS)
69
CXX += $(GCCSPECS)
70
 
71
CPPFLAGS +=
72
 
73
# default location of Standard C Library
74
ifndef LIBC_LIBC
75
LIBC_LIBC=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libc.a $(GCCSED))
76
endif
77
 
78
ifndef LIBC_LIBM
79
LIBC_LIBM=$(shell $(CC) $(CPU_CFLAGS) -print-file-name=libm.a $(GCCSED))
80
endif
81
endif
82
 
83
# Define this to yes if C++ is included in the development environment.
84
# This requires that at least the GNU C++ compiler and libg++ be installed.
85
ifeq ($(HAS_CPLUSPLUS),yes)
86
CPLUS_LD_LIBS += $(PROJECT_RELEASE)/lib/librtems++$(LIBSUFFIX_VA)
87
endif
88
 
89
# debug flag;
90
CFLAGS_DEBUG_V+=-Wno-unused
91
CXXFLAGS_DEBUG_V+=
92
 
93
ifeq ($(RTEMS_USE_GCC272),no)
94
CFLAGS_DEBUG_V+=-qrtems_debug
95
CXXFLAGS_DEBUG_V+=-qrtems_debug
96
endif
97
 
98
# when debugging, optimize flag: typically empty
99
# some compilers do allow optimization with their "-g"
100
CFLAGS_OPTIMIZE_V=-g
101
CXXFLAGS_OPTIMIZE_V=-g
102
 
103
# profile flag; use gprof(1)
104
CFLAGS_PROFILE_V=-pg
105
CXXFLAGS_PROFILE_V=-pg
106
 
107
ifndef AUTOMAKE
108
# default is to optimize
109
CFLAGS_OPTIMIZE  =$(CFLAGS_OPTIMIZE_V)
110
CXXFLAGS_OPTIMIZE=$(CXXFLAGS_OPTIMIZE_V)
111
endif
112
 
113
ifndef AUTOMAKE
114
CFLAGS   += $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
115
CXXFLAGS += $(CXXFLAGS_OPTIMIZE) $(CXXFLAGS_DEBUG) $(CXXFLAGS_PROFILE)
116
endif
117
 
118
# List of library paths without -L
119
LD_PATHS= $(PROJECT_RELEASE)/lib
120
 
121
# libraries you want EVERYONE to link with
122
#LD_LIBS=
123
 
124
# ld flag to ensure pure-text
125
#LDFLAGS_MUST_BE_PURE_V =
126
 
127
# ld flag for [un]shared objects
128
#LDFLAGS_STATIC_LIBRARIES_V =
129
#LDFLAGS_SHARED_LIBRARIES_V =
130
 
131
# ld flag for incomplete link
132
LDFLAGS_INCOMPLETE = -r
133
 
134
# Special linker options when building lib.so
135
LDFLAGS_DYNAMIC_V = ??
136
 
137
# Some dynamic linking systems want the preferred name recorded in the binary
138
# ref: src/libxil/Makefile
139
LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
140
 
141
# ld flags for profiling, debugging
142
LDFLAGS_PROFILE_V =
143
LDFLAGS_DEBUG_V =
144
 
145
LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
146
 
147
#
148
# Stuff to clean and clobber for the compiler and its tools
149
#
150
 
151
CLEAN_CC = a.out *.o *.BAK
152
CLOBBER_CC =
153
 
154
#
155
# Client compiler and support tools
156
#
157
 
158
# CPP command to write file to standard output
159
CPP=$(CC) -E -w -Wp,-$$
160
 
161
# egrep regexp to ignore symbol table entries in ar archives.
162
# Only used to make sure we skip them when coalescing libraries.
163
# skip __.SYMDEF and empty names (maybe bug in ranlib??).
164
AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
165
ARFLAGS=ruv
166
 
167
#
168
# How to compile stuff into ${ARCH} subdirectory
169
#
170
 
171
${ARCH}/%.o: %.c
172
        ${COMPILE.c} $(AM_CPPFLAGS) $(AM_CFLAGS) -o $@ $<
173
 
174
${ARCH}/%.o: %.cc
175
        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
176
 
177
${ARCH}/%.o: %.cpp
178
        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
179
 
180
${ARCH}/%.o: %.cxx
181
        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
182
 
183
${ARCH}/%.o: %.C
184
        ${COMPILE.cc} $(AM_CPPFLAGS) $(AM_CXXFLAGS) -o $@ $<
185
 
186
${ARCH}/%.o: %.S
187
        ${COMPILE.S} $(AM_CPPFLAGS) -DASM -o $@ $<
188
 
189
# Make foo.rel from foo.o
190
${ARCH}/%.rel: ${ARCH}/%.o
191
        ${make-rel}
192
 
193
# create $(ARCH)/pgm from pgm.sh
194
${ARCH}/%: %.sh
195
        $(RM) $@
196
        $(CP) $< $@
197
        $(CHMOD) +x $@
198
 
199
# Dependency files for use by gmake
200
# NOTE: we don't put them into $(ARCH)
201
#       so that 'make clean' doesn't blow it away
202
 
203
DEPEND=Depends-${ARCH}
204
 
205
CLEAN_DEPEND=$(DEPEND).tmp
206
CLOBBER_DEPEND=$(DEPEND)
207
 
208
# We deliberately don't have anything depend on the
209
# $(DEPEND) file; otherwise it will get rebuilt even
210
# on 'make clean'
211
#
212
 
213
depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
214
ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
215
#       Use gcc -M to generate dependencies
216
#       Replace foo.o with $(ARCH)/foo.o
217
#       Replace $(ARCH) value with string $(ARCH)
218
#           so that it will for debug and profile cases
219
        $(COMPILE.c) $(AM_CPPFLAGS) $(AM_CFLAGS) -M   $^    |  \
220
        $(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
221
            -e 's?$(ARCH)/?$$(ARCH)/?'   >$(DEPEND).tmp
222
        $(MV) $(DEPEND).tmp $(DEPEND)
223
endif
224
depend: depend-am
225
 
226
# spell out all the LINK_FILE's, rather than using -lbsp, so
227
#  that $(LINK_FILES) can be a dependency
228
 
229
# Start file must be one of
230
#    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
231
#    $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
232
# It defaults to start.o, but an app can override it.
233
 
234
ifeq ($(START_BASE),)
235
  START_FILE=
236
else
237
  START_FILE=$(PROJECT_RELEASE)/lib/$(START_BASE)$(LIB_VARIANT).o
238
endif
239
 
240
CONSTRUCTOR=
241
 
242
LIBC_LOW=
243
 
244
ifndef LIBGCC
245
LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name $(GCCSED))
246
endif
247
 
248
#
249
# NOTE: a rule to link an rtems' application should look similar to this
250
#       (cf. "make-exe" in make/custom/*.cfg):
251
#
252
# gcc27:
253
# $(PGM): $(LINK_FILES)
254
#       $(LD) $(LDFLAGS) -o $@ $(LINK_OBJS) \
255
#       --start-group $(LINK_LIBS) --end-group
256
#
257
# gcc28:
258
# $(PGM): $(LINK_FILES)
259
#       $(CC) $(CFLAGS) -o $@ $(LINK_OBJS) $(LINK_LIBS)
260
#
261
 
262
LINK_OBJS =\
263
    $(CONSTRUCTOR) \
264
    $(OBJS) \
265
    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel)
266
 
267
LINK_FILES =\
268
    $(START_FILE) \
269
    $(CONSTRUCTOR) \
270
    $(OBJS) \
271
    $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
272
    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
273
    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
274
 
275
ifeq ($(RTEMS_USE_GCC272),yes)
276
LINK_LIBS = $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
277
ifeq ($(RTEMS_CROSS_TARGET),yes)
278
# NOTE: add libc and libgcc only for embedded targets
279
#       LIBC_LIBM should not be needed by rtems itself.
280
# FIXME: If a BSP requires libm, its make/custom/*.cfg file should add
281
#        LIBC_LIBM to LINK_LIBS (untested)
282
LINK_LIBS += $(LIBC_LIBC) $(LIBGCC)
283
endif
284
endif
285
 
286
LINK_LIBS += $(LD_LIBS)
287
 
288
#
289
# Allow user to override link commands (to build a prom image, perhaps)
290
#
291
ifndef LINKCMDS
292
LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
293
endif
294
 
295
ifeq ($(RTEMS_USE_GCC272),yes)
296
define make-rel
297
        $(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $^
298
endef
299
else
300
define make-rel
301
        $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) \
302
          -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
303
endef
304
endif

powered by: WebSVN 2.1.0

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