1#	$NetBSD: Makefile,v 1.5 2017/04/08 19:53:21 christos Exp $
2
3NOMAN=		# defined
4
5.include <bsd.own.mk>
6
7S=		${.CURDIR}/../../../..
8
9BINMODE=	444
10
11PROG=		boot
12SRCS=		entry.S
13SRCS+=		boot.c bootinfo.c clock.c conf.c cons.c devopen.c prf.c tgets.c
14SRCS+=		com.c scif.c wd.c wdc.c
15
16CLEANFILES+=	${PROG}
17
18#MMEYE_CPU=	SH3
19MMEYE_CPU=	SH4
20
21.if ${MMEYE_CPU} == "SH3"
22AFLAGS+=	-DSH3
23CPPFLAGS+=	-DSH3
24CPPFLAGS+=	-DCONS_COM
25RELOC=		8c800000
26.endif
27.if ${MMEYE_CPU} == "SH4"
28CLEANFILES+=	${PROG}.bin ${PROG}.bin.gz
29AFLAGS+=	-DSH4
30CPPFLAGS+=	-DSH4
31CPPFLAGS+=	-DCONS_SCIF
32RELOC=		89000000
33.endif
34
35
36AFLAGS+=	-D_LOCORE -D_KERNEL
37CFLAGS+=	-ffreestanding
38CFLAGS+=	-Wall -Werror -Wno-main
39CFLAGS+=	-Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
40CFLAGS+=	-Wno-pointer-sign
41CPPFLAGS+=	-nostdinc -D_STANDALONE -I. -I${.OBJDIR} -I${S}
42DBG=		-Os
43
44NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
45CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
46
47# XXX SHOULD NOT NEED TO DEFINE THESE!
48LIBCRT0=
49LIBCRTI=
50LIBC=
51LIBCRTBEGIN=
52LIBCRTEND=
53
54STRIPFLAG=
55
56ENTRY=		start
57
58
59### find out what to use for libkern
60KERN_AS=	library
61.include "${S}/lib/libkern/Makefile.inc"
62LIBKERN=	${KERNLIB}
63
64### find out what to use for libz
65Z_AS=		library
66.include "${S}/lib/libz/Makefile.inc"
67LIBZ=		${ZLIB}
68
69### find out what to use for libsa
70SA_AS=		library
71SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
72.include "${S}/lib/libsa/Makefile.inc"
73LIBSA=		${SALIB}
74
75
76${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
77	${LD} -N -Ttext ${RELOC} -Bstatic -e ${ENTRY} -o ${PROG} \
78	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
79.if ${MMEYE_CPU} == "SH4"
80	${OBJCOPY} -S -O binary ${.TARGET} ${.TARGET}.bin
81	TOOL_AWK=${TOOL_AWK} TOOL_HEXDUMP=${TOOL_HEXDUMP} \
82	    ${HOST_SH} $(.CURDIR)/deflate.sh ${.TARGET}.bin
83.endif
84
85.include "${S}/conf/newvers_stand.mk"
86
87cleandir distclean: .WAIT cleanlibdir
88
89cleanlibdir:
90	-rm -rf lib
91
92.include <bsd.prog.mk>
93.include <bsd.klinks.mk>
94