1 |
1026 |
ivang |
#
|
2 |
|
|
# gcc-no_bsp.cfg,v 1.13 1995/12/19 19:59:57 joel Exp
|
3 |
|
|
#
|
4 |
|
|
# This is for the amd29k portsw board.
|
5 |
|
|
#
|
6 |
|
|
# THIS IS NOT A GNU TOOLS BASED PORT!!!
|
7 |
|
|
#
|
8 |
|
|
|
9 |
|
|
# Prefix on the installed GNU tools
|
10 |
|
|
# Just use the native tools
|
11 |
|
|
GNU_TOOLS_PREFIX=
|
12 |
|
|
|
13 |
|
|
# Additional target names (other than debug, profile)
|
14 |
|
|
TARGET_VARIANTS +=
|
15 |
|
|
|
16 |
|
|
#
|
17 |
|
|
# Pre-processor defines.
|
18 |
|
|
# Local tailoring (on the command line) can be done by setting XCPPFLAGS
|
19 |
|
|
# which is never set in the Makefile's
|
20 |
|
|
#
|
21 |
|
|
# Possible defines include:
|
22 |
|
|
# -DRTEMS_LIBC using libc bundled with RTEMS
|
23 |
|
|
# -DRTEMS_NEWLIB using CYGNUS libc
|
24 |
|
|
# -DMALLOC_PROVIDED must be used for newlib reent struct
|
25 |
|
|
|
26 |
|
|
DEFINES:= $(LIBC_DEFINES)
|
27 |
|
|
|
28 |
|
|
GCC_INCLUDE=.
|
29 |
|
|
|
30 |
|
|
# Note: normally we do not want the standard include files
|
31 |
|
|
# Also we usually include a "libc_include" directory
|
32 |
|
|
CPPFLAGS=$(XCPPFLAGS) $(DEFINES) \
|
33 |
|
|
-I$(RTEMS_LIBC_DIR)/include \
|
34 |
|
|
-I$(PROJECT_INCLUDE) \
|
35 |
|
|
-I/opt/29k/src/inc
|
36 |
|
|
|
37 |
|
|
#
|
38 |
|
|
# Local tailoring (on the command line) can be done by setting XCFLAGS
|
39 |
|
|
# which is never set in the Makefile's
|
40 |
|
|
#
|
41 |
|
|
|
42 |
|
|
#
|
43 |
|
|
# CFLAGS_OPTIMIZE_V, CFLAGS_DEBUG_V, CFLAGS_PROFILE_V are the values we
|
44 |
|
|
# would want the corresponding macros to be set to.
|
45 |
|
|
#
|
46 |
|
|
# CFLAGS_OPTIMIZE, CFLAGS_DEBUG, CFLAGS_PROFILE are set in the leaf
|
47 |
|
|
# Makefiles by the 'debug:' and 'profile:' targets to their _V values.
|
48 |
|
|
#
|
49 |
|
|
|
50 |
|
|
# default flags
|
51 |
|
|
|
52 |
|
|
#CFLAGS_DEFAULT = -NB -bwc -nocrt0 -Ml -m -g -Hon=Pointers_compatible -Hon=Pointers_compatible_with_ints -Dinline= -D___AM29K__ -Hnocopyr
|
53 |
|
|
CFLAGS_DEFAULT = $(CPU_CFLAGS) -Wall
|
54 |
|
|
|
55 |
|
|
# optimize flag: typically -0, could use -O4 or -fast
|
56 |
|
|
# -O4 is ok for RTEMS
|
57 |
|
|
# -Os to optimize for size
|
58 |
|
|
CFLAGS_OPTIMIZE_V=-Os
|
59 |
|
|
|
60 |
|
|
# debug flag; typically -g
|
61 |
|
|
CFLAGS_DEBUG_V=-g -O0 -DRTEMS_DEBUG -DSTACK_CHECKER_ON
|
62 |
|
|
|
63 |
|
|
# profile flag; use gprof(1)
|
64 |
|
|
CFLAGS_PROFILE_V=
|
65 |
|
|
|
66 |
|
|
# default is to optimize
|
67 |
|
|
CFLAGS_OPTIMIZE=$(CFLAGS_OPTIMIZE_V)
|
68 |
|
|
|
69 |
|
|
# dynamic libraries
|
70 |
|
|
CFLAGS_DYNAMIC_V=-fpic
|
71 |
|
|
#ASFLAGS_DYNAMIC_V=
|
72 |
|
|
|
73 |
|
|
CFLAGS=$(CFLAGS_DEFAULT) $(CFLAGS_OPTIMIZE) $(CFLAGS_DEBUG) $(CFLAGS_PROFILE)
|
74 |
|
|
|
75 |
|
|
# List of library paths without -L
|
76 |
|
|
LD_PATHS= $(PROJECT_RELEASE)/lib
|
77 |
|
|
|
78 |
|
|
# libraries you want EVERYONE to link with
|
79 |
|
|
LD_LIBS=
|
80 |
|
|
|
81 |
|
|
# ld flag to ensure pure-text
|
82 |
|
|
LDFLAGS_MUST_BE_PURE_V =
|
83 |
|
|
|
84 |
|
|
# ld flag for [un]shared objects
|
85 |
|
|
LDFLAGS_STATIC_LIBRARIES_V =
|
86 |
|
|
LDFLAGS_SHARED_LIBRARIES_V =
|
87 |
|
|
|
88 |
|
|
# ld flag for incomplete link
|
89 |
|
|
LDFLAGS_INCOMPLETE = -i
|
90 |
|
|
|
91 |
|
|
# Special linker options when building lib.so
|
92 |
|
|
LDFLAGS_DYNAMIC_V = ??
|
93 |
|
|
|
94 |
|
|
# Some dynamic linking systems want the preferred name recorded in the binary
|
95 |
|
|
# ref: src/libxil/Makefile
|
96 |
|
|
LDFLAGS_DYNAMIC_LIBNAME_V = -h $(DYNAMIC_VERSION_LIBNAME)
|
97 |
|
|
|
98 |
|
|
# ld flags for profiling, debugging
|
99 |
|
|
LDFLAGS_PROFILE_V =
|
100 |
|
|
LDFLAGS_DEBUG_V =
|
101 |
|
|
|
102 |
|
|
LDFLAGS=$(LDFLAGS_PROFILE) $(LDFLAGS_DEBUG) $(LD_PATHS:%=-L %)
|
103 |
|
|
|
104 |
|
|
#
|
105 |
|
|
# Stuff to clean and clobber for the compiler and its tools
|
106 |
|
|
#
|
107 |
|
|
|
108 |
|
|
CLEAN_CC = a.out *.o *.BAK
|
109 |
|
|
CLOBBER_CC =
|
110 |
|
|
|
111 |
|
|
#
|
112 |
|
|
# Client compiler and support tools
|
113 |
|
|
#
|
114 |
|
|
|
115 |
|
|
CC=/opt/29k/bin/hc29
|
116 |
|
|
CXX=$(CC)
|
117 |
|
|
CCC=$(CXX)
|
118 |
|
|
|
119 |
|
|
# CPP command to write file to standard output
|
120 |
|
|
CPP=$(CC) -E
|
121 |
|
|
|
122 |
|
|
AS=/opt/29k/bin/as29
|
123 |
|
|
ASPP=ERROR_NO_ASPP
|
124 |
|
|
|
125 |
|
|
ASFLAGS=-l -fcgimosx
|
126 |
|
|
|
127 |
|
|
# NOTE: should never use full path .. but there is no guarantee ld, etc
|
128 |
|
|
# will be in the same directory as gcc.. so hope they are in the path
|
129 |
|
|
# Don't do this on a real target!!!
|
130 |
|
|
LD=/opt/29k/bin/ld29
|
131 |
|
|
NM=/opt/29k/bin/nm29
|
132 |
|
|
AR=echo making library
|
133 |
|
|
# egrep regexp to ignore symbol table entries in ar archives.
|
134 |
|
|
# Only used to make sure we skip them when coalescing libraries.
|
135 |
|
|
# skip __.SYMDEF and empty names (maybe bug in ranlib??).
|
136 |
|
|
AR_SYMBOL_TABLE="HIGHLY-UNLIKELY-TO-CONFLICT"
|
137 |
|
|
ARFLAGS=ruv
|
138 |
|
|
|
139 |
|
|
# NOTE: see comment on ld, nm, ar
|
140 |
|
|
SIZE=size
|
141 |
|
|
|
142 |
|
|
#
|
143 |
|
|
# Command to convert a normal archive to one searchable by $(LD)
|
144 |
|
|
# Not needed on SVR4
|
145 |
|
|
#
|
146 |
|
|
|
147 |
|
|
MKLIB=/opt/29k/bin/lib29
|
148 |
|
|
|
149 |
|
|
#
|
150 |
|
|
# How to compile stuff into ${ARCH} subdirectory
|
151 |
|
|
#
|
152 |
|
|
# NOTE: we override COMPILE.c
|
153 |
|
|
#
|
154 |
|
|
|
155 |
|
|
COMPILE.c=$(CC) -c $(CFLAGS) $(CPPFLAGS) $(XCFLAGS)
|
156 |
|
|
|
157 |
|
|
${ARCH}/%.o: %.c
|
158 |
|
|
${COMPILE.c} -o $@ $<
|
159 |
|
|
$(CHMOD) -f g+w $@
|
160 |
|
|
|
161 |
|
|
${ARCH}/%.o: %.cc
|
162 |
|
|
${COMPILE.c} -o $@ $<
|
163 |
|
|
$(CHMOD) -f g+w $@
|
164 |
|
|
|
165 |
|
|
${ARCH}/%.o: %.s
|
166 |
|
|
${COMPILE.c} -DASM -o $@ $<
|
167 |
|
|
$(CHMOD) -f g+w $@
|
168 |
|
|
|
169 |
|
|
${ARCH}/%.o: %.S
|
170 |
|
|
$(CP) $*.s $(ARCH)/$*.c
|
171 |
|
|
$(CPP) $(CPPFLAGS) $(ARCH)/$*.c > $(ARCH)/$*.s
|
172 |
|
|
${COMPILE.c} -o $@ $(ARCH)/$*.s
|
173 |
|
|
$(CHMOD) -f g+w $@
|
174 |
|
|
$(RM) $(ARCH)/$*.c
|
175 |
|
|
|
176 |
|
|
# Specify our own default rule for this to prevent having CFLAGS and
|
177 |
|
|
# CPPFLAGS being passed to linker
|
178 |
|
|
${ARCH}/%: ${ARCH}/%.o
|
179 |
|
|
${CC} ${LDFLAGS} -o $@ $@.o ${LD_LIBS}
|
180 |
|
|
$(CHMOD) -f g+w $@
|
181 |
|
|
|
182 |
|
|
# Make foo.rel from foo.o
|
183 |
|
|
${ARCH}/%.rel: ${ARCH}/%.o
|
184 |
|
|
${LD} $(LDFLAGS_INCOMPLETE) -o $@ $^
|
185 |
|
|
$(CHMOD) -f g+w $@
|
186 |
|
|
|
187 |
|
|
# create $(ARCH)/pgm from pgm.sh
|
188 |
|
|
${ARCH}/%: %.sh
|
189 |
|
|
$(RM) $@
|
190 |
|
|
$(CP) $< $@
|
191 |
|
|
$(CHMOD) +x $@
|
192 |
|
|
$(CHMOD) -f g+w $@
|
193 |
|
|
|
194 |
|
|
# Dependency files for use by gmake
|
195 |
|
|
# NOTE: we don't put them into $(ARCH)
|
196 |
|
|
# so that 'make clean' doesn't blow it away
|
197 |
|
|
|
198 |
|
|
DEPEND=Depends-${ARCH}
|
199 |
|
|
|
200 |
|
|
CLEAN_DEPEND=$(DEPEND).tmp
|
201 |
|
|
CLOBBER_DEPEND=$(DEPEND)
|
202 |
|
|
|
203 |
|
|
# We deliberately don't have anything depend on the
|
204 |
|
|
# $(DEPEND) file; otherwise it will get rebuilt even
|
205 |
|
|
# on 'make clean'
|
206 |
|
|
#
|
207 |
|
|
|
208 |
|
|
depend: $(C_FILES) $(CC_FILES) $(S_FILES)
|
209 |
|
|
ifneq ($(words $(C_FILES) $(CC_FILES) $(S_FILES)), 0)
|
210 |
|
|
# Use gcc -M to generate dependencies
|
211 |
|
|
# Replace foo.o with $(ARCH)/foo.o
|
212 |
|
|
# Replace $(ARCH) value with string $(ARCH)
|
213 |
|
|
# so that it will for debug and profile cases
|
214 |
|
|
$(COMPILE.c) -Hmake $^ | \
|
215 |
|
|
$(SED) -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
|
216 |
|
|
-e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmp
|
217 |
|
|
|
218 |
|
|
$(MV) $(DEPEND).tmp $(DEPEND)
|
219 |
|
|
$(CHMOD) -f g+w $(DEPEND)
|
220 |
|
|
endif
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
# spell out all the LINK_FILE's, rather than using -lbsp, so
|
224 |
|
|
# that $(LINK_FILES) can be a dependency
|
225 |
|
|
|
226 |
|
|
# Start file must be one of
|
227 |
|
|
# $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
|
228 |
|
|
# $(PROJECT_RELEASE)/lib/asmiface$(LIB_VARIANT).o
|
229 |
|
|
# It defaults to start.o, but an app can override it.
|
230 |
|
|
|
231 |
|
|
# Note: Normally RTEMS provides a start file...
|
232 |
|
|
START_FILE= $(PROJECT_RELEASE)/lib/crt0$(LIB_VARIANT).o $(PROJECT_RELEASE)/lib/register$(LIB_VARIANT).o
|
233 |
|
|
|
234 |
|
|
LIBC_LOW= $(PROJECT_RELEASE)/lib/libcsupport$(LIBSUFFIX_VA)
|
235 |
|
|
|
236 |
|
|
LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name $(GCCSED))
|
237 |
|
|
|
238 |
|
|
LIBOSBOOT=/home/src/amd29k/sps2000/netrom.o
|
239 |
|
|
|
240 |
|
|
LINK_FILES= \
|
241 |
|
|
$(START_FILE) \
|
242 |
|
|
$(OBJS) \
|
243 |
|
|
$(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
|
244 |
|
|
$(PROJECT_RELEASE)/lib/libbsp$(LIBSUFFIX_VA) \
|
245 |
|
|
$(LD_LIBS) \
|
246 |
|
|
$(PROJECT_RELEASE)/lib/libtest$(LIBSUFFIX_VA) \
|
247 |
|
|
$(PROJECT_RELEASE)/lib/librtems$(LIBSUFFIX_VA) \
|
248 |
|
|
$(LIBC_LOW) \
|
249 |
|
|
$(PROJECT_RELEASE)/lib/libmisc$(LIBSUFFIX_VA) \
|
250 |
|
|
$(LIBC_LIBC) \
|
251 |
|
|
$(LIBC_EXTRALIBS) \
|
252 |
|
|
$(LIBC_LIBM)
|
253 |
|
|
# /home/craigl/osbdbg.o
|
254 |
|
|
|
255 |
|
|
# Here is the rule to actually build a $(ARCH)/foo.exe
|
256 |
|
|
# It also builds $(ARCH)/foo.sr and $(ARCH)/foo.nm
|
257 |
|
|
# Usage ref: src/tests/sptest/sp1/Makefile
|
258 |
|
|
|
259 |
|
|
define make-exe
|
260 |
|
|
if [ $(NO_ROM) ]; then echo "\n\nskipping ROM compile\n"; else \
|
261 |
|
|
$(CC) -nocrt0 -cmd$(PROJECT_RELEASE)/lib/romlink -u _times -u _gettimeofday \
|
262 |
|
|
-u _sleep -o $(basename $@).out $(LIBOSBOOT) $(LINK_FILES); \
|
263 |
|
|
romcoff -r -t -l -b $(basename $@).out raminit.o; \
|
264 |
|
|
rm $(basename $@).out; \
|
265 |
|
|
$(CC) -m -u _times -u _gettimeofday -u _sleep -o $(basename $@).romcof $(LIBOSBOOT) \
|
266 |
|
|
$(LINK_FILES) raminit.o -nocrt0 -cmd$(PROJECT_RELEASE)/lib/romlink > $(basename $@).rommap ; \
|
267 |
|
|
rm raminit.o ; \
|
268 |
|
|
$(CHMOD) -f g+w $(basename $@).romcof; \
|
269 |
|
|
/opt/green/coff2sr -noS5 $(basename $@).romcof -o $(basename $@).srec; \
|
270 |
|
|
$(CHMOD) -f g+w $(basename $@).srec; \
|
271 |
|
|
fi
|
272 |
|
|
if [ $(CREATE_MAP) ]; then \
|
273 |
|
|
$(CC) -m -u _times -u _gettimeofday -u _sleep -o $(basename $@).exe $(LINK_FILES) -nocrt0 -cmd$(PROJECT_RELEASE)/lib/ramlink > $(basename $@).rammap; \
|
274 |
|
|
else \
|
275 |
|
|
rm $(basename $@).rommap > /dev/null 2> /dev/null ; \
|
276 |
|
|
$(CC) -u _times -u _gettimeofday -u _sleep -o $(basename $@).exe $(LINK_FILES) -nocrt0 -cmd$(PROJECT_RELEASE)/lib/ramlink; \
|
277 |
|
|
fi
|
278 |
|
|
$(CHMOD) -f g+w $(basename $@).exe
|
279 |
|
|
# $(CC) -o $(basename $@).exe $(LINK_FILES) -nocrt0 -cmd/opt/29k/lib/link030.cmd
|
280 |
|
|
$(NM) -g $(basename $@).exe > $(basename $@).num
|
281 |
|
|
$(CHMOD) -f g+w $(basename $@).num
|
282 |
|
|
# $(SIZE) $(basename $@).exe
|
283 |
|
|
endef
|
284 |
|
|
|
285 |
|
|
define make-rel
|
286 |
|
|
$(LD) $(LDFLAGS_INCOMPLETE) $(XLDFLAGS) -o $@ $(OBJS)
|
287 |
|
|
$(CHMOD) -f g+w $@
|
288 |
|
|
endef
|