xref: /netbsd-src/sys/arch/mmeye/stand/boot/Makefile (revision a24efa7dea9f1f56c3bdb15a927d3516792ace1c)
1#	$NetBSD: Makefile,v 1.4 2014/01/16 01:15:34 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
15SRCS+=		vers.c
16
17CLEANFILES+=	vers.c ${PROG}
18
19#MMEYE_CPU=	SH3
20MMEYE_CPU=	SH4
21
22.if ${MMEYE_CPU} == "SH3"
23AFLAGS+=	-DSH3
24CPPFLAGS+=	-DSH3
25CPPFLAGS+=	-DCONS_COM
26RELOC=		8c800000
27.endif
28.if ${MMEYE_CPU} == "SH4"
29CLEANFILES+=	${PROG}.bin ${PROG}.bin.gz
30AFLAGS+=	-DSH4
31CPPFLAGS+=	-DSH4
32CPPFLAGS+=	-DCONS_SCIF
33RELOC=		89000000
34.endif
35
36
37AFLAGS+=	-D_LOCORE -D_KERNEL
38CFLAGS+=	-ffreestanding
39CFLAGS+=	-Wall -Werror -Wno-main
40CFLAGS+=	-Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
41CFLAGS+=	-Wno-pointer-sign
42CPPFLAGS+=	-nostdinc -D_STANDALONE -I. -I${.OBJDIR} -I${S}
43DBG=		-Os
44
45NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
46CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
47
48# XXX SHOULD NOT NEED TO DEFINE THESE!
49LIBCRT0=
50LIBCRTI=
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