1 # $NetBSD: Makefile,v 1.9 2009/03/15 06:17:03 tsutsui Exp $
8 S
= ${.CURDIR
}/..
/..
/..
/..
9 COMMON
= ${.CURDIR
}/..
/common
11 LIBSADIR
= ${S}/lib
/libsa
12 SYSVBFSDIR
= ${S}/fs
/sysvbfs
13 EWS4800MIPSDIR
= ${.CURDIR
}/..
/..
/ews4800mips
14 DEVDIR
= ${.CURDIR
}/..
/..
/dev
16 # XXX SHOULD NOT NEED TO DEFINE THESE!
22 .PATH
: ${COMMON} ${LIBSADIR} ${SYSVBFSDIR} \
23 ${EWS4800MIPSDIR} ${SBDDIR} ${DEVDIR}
25 COFFHDRFIX
= ${.OBJDIR
}/coffhdrfix
28 BOOT_KERNEL
= boot_kernel
29 FILES
+= ${PROG}.coff
${BOOT_KERNEL}.gz
# XXX hack to install these
30 SRCS
= start.S boot.c prompt.c delay.c cmd.c loader.c
31 SRCS
+= bfs_subr.o disk.c diskutil.c
32 SRCS
+= devopen.c datafs.c bootfs.c ustarfs.c
33 SRCS
+= lance.c ether_if.c
34 SRCS
+= device_test.c cop0.c mem.c
35 SRCS
+= boot_device.c floppy_2d.c floppy_2hd_ibmpc.c
37 SRCS
+= console.c cons_rom.c cons_fb.c cons_zskbd.c cons_zs.c
38 BINKERNEL_C
= ${COMMON}/binkernel.c
39 BINKERNEL_SIZE
= '2 * 1024 * 1024'
40 BINKERNEL_O
= binkernel.o
41 BINKERNEL_DUMMY_O
= binkernel_dummy.o
50 SRCS
+= pdinfo.c vtoc.c
55 ${HOST_SH} ${S}/conf
/newvers_stand.sh
-DM
${.CURDIR
}/version
${MACHINE}
61 LINKFLAGS
= -T
${S}/arch
/mips
/conf
/stand.ldscript
-Ttext
${TEXTADDR} \
63 COFFLDFLAGS
= -T
${COMMON}/coffboot.ldscript
-N
65 MIPSFLAGS
= -mips1
-G
0 -mno-abicalls
66 DEBUGFLAGS
= -Wall
-Werror
67 DEBUGFLAGS
+= -Wmissing-prototypes
-Wstrict-prototypes
-Wpointer-arith
68 DEBUGFLAGS
+= -Wno-format-zero-length
-Wno-sign-compare
69 OPTFLAGS
= -Os
-mmemcpy
70 FLAGS
= ${MIPSFLAGS} ${DEBUGFLAGS} ${OPTFLAGS}
71 AFLAGS
= -xassembler-with-cpp
-D_LOCORE
${FLAGS}
72 CFLAGS
= ${FLAGS} -ffreestanding
74 CPPFLAGS
+= -D_STANDALONE
-DSUPPORT_BOOTP
75 CPPFLAGS
+= -nostdinc
-I
${.OBJDIR
} -I
${.CURDIR
} -I
${COMMON} -I
${S}
76 CPPFLAGS
+= -D__daddr_t
=int32_t
77 #CPPFLAGS += -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG
78 #CPPFLAGS += -DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID
80 CLEANFILES
+= ${BINKERNEL_DUMMY_O} ${BINKERNEL_O}
81 CLEANFILES
+= ${PROG} ${PROG}.elf
${PROG}.coff
${PROG}.tmp
${PROG}.dis
82 CLEANFILES
+= ${COFFHDRFIX}
83 CLEANFILES
+= ${BOOT_KERNEL} ${BOOT_KERNEL}.elf
${BOOT_KERNEL}.tmp
84 CLEANFILES
+= ${BOOT_KERNEL}.gz
${BOOT_KERNEL}.gz.tmp
86 .
include "${S}/lib/libkern/Makefile.inc"
89 .
include "${S}/lib/libz/Makefile.inc"
92 SAMISCMAKEFLAGS
= SA_USE_CREAD
=yes SA_USE_LOADFILE
=yes
93 .
include "${S}/lib/libsa/Makefile.inc"
96 LIBS
= ${LIBSA} ${LIBZ} ${LIBKERN}
98 # fixup GNU binutils file offset error.
99 coffhdrfix
: ${COMMON}/coffhdrfix.c
100 ${HOST_CC} -o
${COFFHDRFIX} ${COMMON}/coffhdrfix.c
102 clean cleandir
distclean: cleanlibdir
107 ${BINKERNEL_DUMMY_O}: ${BINKERNEL_C}
109 ${COMPILE.c
} -DKERNEL_SIZE
=0 ${BINKERNEL_C} -o
${.TARGET
}
111 ${BINKERNEL_O}: ${BINKERNEL_C}
113 ${COMPILE.c
} -DKERNEL_SIZE
=${BINKERNEL_SIZE} ${BINKERNEL_C} \
116 all realall
: ${PROG}.coff
${BOOT_KERNEL}.gz
118 ${PROG}: ${BINKERNEL_DUMMY_O} ${OBJS} ${LIBS}
120 ${LD} ${LINKFLAGS} -S
-o
${PROG}.elf
${OBJS} ${LIBS} \
122 ${OBJDUMP} -h
${PROG}.elf
123 # ${OBJDUMP} -m mips:4000 -d ${PROG}.elf > ${PROG}.dis
124 mv
${PROG}.elf
${PROG}
127 .
include <bsd.klinks.mk
>
128 .
include <bsd.prog.mk
>
130 ${PROG}.coff
: ${PROG}
132 ${ELF2ECOFF} ${PROG} ${.TARGET
}.tmp
133 mv
${.TARGET
}.tmp
${.TARGET
}
135 ${BOOT_KERNEL}.gz
: ${BINKERNEL_O} ${OBJS} ${LIBS}
137 ${LD} ${LINKFLAGS} -o
${BOOT_KERNEL}.elf
${OBJS} ${LIBS} \
139 mv
${BOOT_KERNEL}.elf
${BOOT_KERNEL}
140 ${OBJDUMP} -h
${BOOT_KERNEL}
141 gzip
-9c
${BOOT_KERNEL} > ${.TARGET
}.tmp
142 mv
${.TARGET
}.tmp
${.TARGET
}