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