git repos for lemote 502 board
[pmon-gdium.git] / Targets / Bonito2enc / conf / Makefile.Bonito2enc
blob56ba32f1b329cdd33409320e712797e16cd1a2d8
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:
6 #       config machineid
7 # Most changes should be made in the machine description
8 #       /sys/arch/pmonppc/conf/``machineid''
9 # after which you should do
10 #       config machineid
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
18 .SUFFIXES:      .S .c .o
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
30 CPP             = $(CC) -E
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 OPT?=   -O2
41 all: pmon
43 # source tree is located via $S relative to the compilation directory
44 ifndef S
45 S:=$(shell cd ../../../..; pwd)
46 endif
48 # Defines
50 TARGET= ${S}/Targets/Bonito2enc
51 MACHINE=mips
52 MACHINE_ARCH=mips
53 COMPILEDIR=${shell pwd}
54 OBJDIR=${COMPILEDIR}
55 PMONDIR=${S}
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
74 HOSTCC?=        ${CC}
75 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
76 HOSTED_CFLAGS=  ${CFLAGS}
78 include ${S}/lib/libc/Makefile.inc
79 LIBC=${CLIB}
80 include ${S}/lib/libm/Makefile.inc
81 LIBM=${MLIB}
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 $@
101 %OBJS
103 %CFILES
105 %SFILES
108 ifneq "$(findstring $S/x86emu/src,$(CFILES))" ""
109                 INCLUDES += -I${S}/x86emu/src/x86emu/ -I${S}/x86emu/src/x86emu/include
110 else
111                 INCLUDES += -I${S}/x86emu/int10/x86emu/include -I${S}/x86emu/int10/x86emu/src/x86emu/x86emu 
112 endif
114 # load lines for config "xxx" will be emitted as:
115 # xxx: ${SYSTEM_DEP}
116 #       ${SYSTEM_LD_HEAD}
117 #       ${SYSTEM_LD}
118 #       ${SYSTEM_LD_TAIL}
119 SYSTEM_OBJ=     start.o crtbegin.o param.o ioconf.o ri.o ${OBJS} ${LIBC} ${LIBM} \
120                 crtend.o
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
128 DEBUG?=
129 ifneq ("${DEBUG}", "")
130 LFLAGS+=        -X
131 SYSTEM_LD_TAIL+=; \
132                 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
133                 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
134 else
135 LFLAGS+=        -S
136 endif
138 %LOAD
140 param.c: $S/sys/kern/param.c
141         rm -f param.c
142         cp $S/sys/kern/param.c .
144 param.o: param.c Makefile
145         ${NORMAL_C_C}
147 ioconf.o: ioconf.c
148         ${NORMAL_C}
149 ri.o:ri.c Makefile
150         ${NORMAL_C_C}
151 ri.c: $S/pmon/arch/mips/ri.c
152         rm -f ri.c
153         cp $S/pmon/arch/mips/ri.c .
154 crtbegin.c: $S/pmon/arch/mips/crtbegin.c
155         rm -f crtbegin.c
156         cp $S/pmon/arch/mips/crtbegin.c .
158 crtbegin.o: crtbegin.c Makefile
159         ${NORMAL_C_C}
161 crtend.c: $S/pmon/arch/mips/crtend.c
162         rm -f crtend.c
163         cp $S/pmon/arch/mips/crtend.c .
165 crtend.o: crtend.c Makefile
166         ${NORMAL_C_C}
168 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
169         sh $S/conf/newvers.sh
170         ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
172 clean::
173         rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
174                 [Ee]rrs linterrs makelinks genassym genassym.o 
176 lint:
177         @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
178                 ${CFILES} \
179                 ioconf.c param.c | \
180                 grep -v 'static function .* unused'
182 tags:
183         @echo "see $S/kern/Makefile for tags"
185 links:
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}
195 depend:: .depend
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}
201 endif
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
210         ${NORMAL_S}
212 zpmon: startz.o
213         rm start.o && cp -f startz.o start.o
214         make pmon
215         make -C ../zboot zpmon
216 startz.o: ${TARGET}/Bonito/startz.S Makefile
217         ${NORMAL_S}
219 %RULES