1 # $Id: Makefile.Bonito,v 1.1.1.1 2006/06/29 06:43:25 cpu Exp $
3 # Makefile for PMON2000 EV64240
5 # This makefile is constructed from a machine description:
7 # Most changes should be made in the machine description
8 # /sys/arch/pmonppc/conf/``machineid''
9 # after which you should do
11 # Machine generic makefile changes should be made in
12 # /sys/arch/pmonppc/conf/Makefile.pmonppc
13 # after which config should be rerun for all machines of that type.
15 # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
16 # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
20 CROSS_COMPILE =mips-elf-
21 #CROSS_COMPILE =mipsel-linux-
24 # Include the make variables (CC, etc...)
27 AS = $(CROSS_COMPILE)as
28 LD = $(CROSS_COMPILE)ld
29 CC ?= $(CROSS_COMPILE)gcc
31 AR = $(CROSS_COMPILE)ar
32 NM = $(CROSS_COMPILE)nm
33 STRIP = $(CROSS_COMPILE)strip
34 OBJCOPY = $(CROSS_COMPILE)objcopy
35 OBJDUMP = $(CROSS_COMPILE)objdump
36 RANLIB = $(CROSS_COMPILE)ranlib
37 SIZE = $(CROSS_COMPILE)size
43 # source tree is located via $S relative to the compilation directory
45 S:=$(shell cd ../../../..; pwd)
50 TARGET= ${S}/Targets/Bonito2enc
53 COMPILEDIR=${shell pwd}
58 INCLUDES= -I. -I${S}/include -I./machine -I${S} \
59 -I${S}/sys/arch/${MACHINE}/include -I${S}/sys \
60 -I${TARGET} -I${COMPILEDIR} -nostdinc
61 #CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -D__OpenBSD__ -DPMON -D__PMON__\
62 # -${ENDIAN} -mno-abicalls -mips3 -mmemcpy -mcpu=r4000
63 CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -D__OpenBSD__ -DPMON -D__PMON__\
64 -${ENDIAN} -mno-abicalls -mips3 -mmemcpy -mcpu=r4000
65 #CWARNFLAGS= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
66 -Wno-uninitialized -Wno-format -Wno-main
67 CWARNFLAGS= -Wall -Wstrict-prototypes \
68 -Wno-uninitialized -Wno-format -Wno-main
69 CFLAGS= ${DEBUG} ${CWARNFLAGS} ${OPT} -G 0
70 AFLAGS= -D_LOCORE -G 0
71 LFLAGS= -${ENDIAN} -N -G 0 -T../../conf/ld.script -e start
72 STRIPFLAGS= -g -S --strip-debug
75 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
76 HOSTED_CFLAGS= ${CFLAGS}
78 include ${S}/lib/libc/Makefile.inc
80 include ${S}/lib/libm/Makefile.inc
83 # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
84 # where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
85 # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
86 # is marked as config-dependent.
88 USRLAND_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
89 USRLAND_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
91 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
92 NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
94 DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
95 DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
97 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
98 NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@
108 ifneq "$(findstring $S/x86emu/src,$(CFILES))" ""
109 INCLUDES += -I${S}/x86emu/src/x86emu/ -I${S}/x86emu/src/x86emu/include
111 INCLUDES += -I${S}/x86emu/int10/x86emu/include -I${S}/x86emu/int10/x86emu/src/x86emu/x86emu
114 # load lines for config "xxx" will be emitted as:
119 SYSTEM_OBJ= start.o crtbegin.o param.o ioconf.o ri.o ${OBJS} ${LIBC} ${LIBM} \
121 SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
122 SYSTEM_LD_HEAD= rm -f $@
123 SYSTEM_LD= @echo ${LD} ${LFLAGS} -o $@ ${LIBDIR} '$${SYSTEM_OBJ}' vers.o; \
124 ${LD} ${LFLAGS} -o $@ ${LIBDIR} ${SYSTEM_OBJ} vers.o
125 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ ; \
126 ${OBJCOPY} -O binary $@ $@.bin
129 ifneq ("${DEBUG}", "")
132 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
133 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
140 param.c: $S/sys/kern/param.c
142 cp $S/sys/kern/param.c .
144 param.o: param.c Makefile
151 ri.c: $S/pmon/arch/mips/ri.c
153 cp $S/pmon/arch/mips/ri.c .
154 crtbegin.c: $S/pmon/arch/mips/crtbegin.c
156 cp $S/pmon/arch/mips/crtbegin.c .
158 crtbegin.o: crtbegin.c Makefile
161 crtend.c: $S/pmon/arch/mips/crtend.c
163 cp $S/pmon/arch/mips/crtend.c .
165 crtend.o: crtend.c Makefile
168 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
169 sh $S/conf/newvers.sh
170 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
173 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
174 [Ee]rrs linterrs makelinks genassym genassym.o
177 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
180 grep -v 'static function .* unused'
183 @echo "see $S/kern/Makefile for tags"
186 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
187 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
188 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
189 sort -u | comm -23 - dontlink | \
190 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
191 sh makelinks && rm -f dontlink
193 SRCS= ${TARGET}/Bonito/start.S \
194 param.c ioconf.c ri.c ${CFILES} ${SFILES}
196 .depend: ${SRCS} param.c
197 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${TARGET}/Bonito/start.S
198 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
199 ifneq (${SFILES}, "")
200 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
203 # depend on root or device configuration
204 autoconf.o conf.o: Makefile
206 # depend on network or filesystem configuration
207 uipc_proto.o vfs_conf.o: Makefile
209 start.o: ${TARGET}/Bonito/start.S Makefile
213 rm start.o && cp -f startz.o start.o
215 make -C ../zboot zpmon
216 startz.o: ${TARGET}/Bonito/startz.S Makefile