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