1 # $Id: Makefile.Bonito2fdev,v 1.1.1.1 2006/09/14 01:59:09 root 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 -m elf32ltsmip -G 0 -static -n -nostdlib
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
39 ifeq "$(shell echo ${CC}|grep 'mips-elf-')" ""
40 ifeq "$(shell echo ${CC}|grep '\-mabi=64')" ""
41 LD = $(CROSS_COMPILE)ld -m elf32ltsmip -G 0 -static -n -nostdlib
43 LD = $(CROSS_COMPILE)ld -m elf64ltsmip -G 0 -static -n -nostdlib
47 LD = $(CROSS_COMPILE)ld -m elf32ebmip -G 0 -static -n -nostdlib -EL
51 IDENT:=${IDENT} $(shell echo ${IDENT}|sed -n 's/.*-DX\([0-9]\+\)x\([0-9]\+\).*/ -DFB_XSIZE=\1 -DFB_YSIZE=\2 /p')
52 IDENT:=${IDENT} $(shell echo ${IDENT}|sed -n 's/.*-DCONFIG_VIDEO_\([0-9]\+\)BPP.*/ -DFB_COLOR_BITS=\1 /p')
56 # source tree is located via $S relative to the compilation directory
58 S:=$(shell cd ../../../..; pwd)
66 COMPILEDIR=${shell pwd}
71 INCLUDES= -I. -I${S}/include -I./machine -I${S} \
72 -I${S}/sys/arch/${MACHINE}/include -I${S}/sys \
73 -I${TARGET} -I${COMPILEDIR} -I${PATH1} -nostdinc -fno-strict-aliasing -fno-pic
75 ifneq "$(findstring $S/x86emu/src,$(CFILES))" ""
76 INCLUDES += -I${S}/x86emu/src/x86emu/ -I${S}/x86emu/src/x86emu/include
78 INCLUDES += -I${S}/x86emu/int10/x86emu/include -I${S}/x86emu/int10/x86emu/src/x86emu/x86emu
81 CPPFLAGS := ${CPPFLAGS} ${ENDIAN_FLAG} ${INCLUDES} ${IDENT} -D_KERNEL -D__OpenBSD__ -DPMON -D__PMON__\
82 -mmemcpy -mno-abicalls -fno-builtin#-march=r4600
83 #CWARNFLAGS= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
84 -Wno-uninitialized -Wno-format -Wno-main
85 CWARNFLAGS= -Wall -Wstrict-prototypes \
86 -Wno-uninitialized -Wno-format -Wno-main
87 CFLAGS= ${DEBUG} ${CWARNFLAGS} ${OPT} -G 0
88 AFLAGS= -D_LOCORE -G 0
89 LFLAGS= ${ENDIAN_FLAG} -N -G 0 -T../../conf/ld.script -e start
90 STRIPFLAGS= -g -S --strip-debug
93 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
94 HOSTED_CFLAGS= ${CFLAGS}
96 include ${S}/lib/libc/Makefile.inc
98 include ${S}/lib/libm/Makefile.inc
100 include ${S}/lib/libz/Makefile.inc
103 # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
104 # where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
105 # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
106 # is marked as config-dependent.
108 USRLAND_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
109 USRLAND_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
111 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
112 NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
114 DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
115 DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
117 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
118 NORMAL_S_C= ${AS} ${COPTS} ${PARAM} $< -o $@
123 # load lines for config "xxx" will be emitted as:
128 #SYSTEM_OBJ= ${START} crtbegin.o param.o ioconf.o ri.o ${OBJS} ${LIBC} ${LIBM} ${LIBZ} \
130 SYSTEM_OBJ= ${START} crtbegin.o param.o ioconf.o ri.o ${OBJS} ${LIBC} ${LIBM} ${LIBZ} \
132 SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
133 SYSTEM_LD_HEAD= rm -f $@
134 SYSTEM_LD= @echo ${LD} ${LFLAGS} -o $@ ${LIBDIR} '${SYSTEM_OBJ}' vers.o; \
135 ${LD} ${LFLAGS} -o $@ ${LIBDIR} ${SYSTEM_OBJ} vers.o -L../../../../examples/math/ -lgcc
136 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ ; \
137 ${OBJCOPY} -O binary $@ $@.bin
140 ifneq ("${DEBUG}", "")
143 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
144 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
150 param.c: $S/sys/kern/param.c
152 cp $S/sys/kern/param.c .
154 param.o: param.c Makefile
161 ri.c: $S/pmon/arch/mips/ri.c
163 cp $S/pmon/arch/mips/ri.c .
164 crtbegin.c: $S/pmon/arch/mips/crtbegin.c
166 cp $S/pmon/arch/mips/crtbegin.c .
168 crtbegin.o: crtbegin.c Makefile
171 crtend.c: $S/pmon/arch/mips/crtend.c
173 cp $S/pmon/arch/mips/crtend.c .
175 crtend.o: crtend.c Makefile
178 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
179 sh $S/conf/newvers.sh
180 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
183 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
184 [Ee]rrs linterrs makelinks genassym genassym.o
187 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
190 grep -v 'static function .* unused'
193 @echo "see $S/kern/Makefile for tags"
196 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
197 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
198 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
199 sort -u | comm -23 - dontlink | \
200 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
201 sh makelinks && rm -f dontlink
203 SRCS= ${TARGET}/${SUBTARGET}/start.S \
204 param.c ioconf.c ri.c ${CFILES} ${SFILES}
206 .depend: ${SRCS} param.c
207 ${MKDEP} ${AFLAGS} ${shell echo ${CPPFLAGS}|sed -e 's/ -f[^ ]*//g' } ${TARGET}/${SUBTARGET}/start.S
208 ${MKDEP} -a ${CFLAGS} ${shell echo ${CPPFLAGS}|sed -e 's/ -f[^ ]*//g' } param.c ioconf.c ${CFILES}
209 ifneq (${SFILES}, "")
210 ${MKDEP} -a ${AFLAGS} ${shell echo ${CPPFLAGS}|sed -e 's/ -f[^ ]*//g' } ${SFILES}
213 # depend on root or device configuration
214 autoconf.o conf.o: Makefile
216 # depend on network or filesystem configuration
217 uipc_proto.o vfs_conf.o: Makefile
219 ${START}: ${TARGET}/${SUBTARGET}/${START:.o=.S} Makefile
223 rm start.o && cp -f startz.o start.o
225 make -C ../zboot zpmon
226 startz.o: ${TARGET}/${SUBTARGET}/startz.S Makefile