Makefile revision 1.1
1# $NetBSD: Makefile,v 1.1 2025/11/16 20:11:47 jmcneill Exp $
2
3S=		${.CURDIR}/../../../..
4POWERPC=	${S}/arch/powerpc
5
6PROG?=		ppcboot.elf
7NEWVERSWHAT=	"Wii MINI boot"
8
9SRCS+=		start.S
10SRCS+=		boot.c
11SRCS+=		console.c
12SRCS+=		conf.c
13SRCS+=		devopen.c
14SRCS+=		gecko.c
15SRCS+=		gpio.c
16SRCS+=		miniipc.c
17SRCS+=		sdmmc.c
18SRCS+=		timer.c
19
20NOMAN=		# defined
21NOSANITIZER=	# defined
22NORELRO=	# defined
23STRIPFLAG=	# nothing
24
25LIBCRT0=	# nothing
26LIBCRTI=	# nothing
27LIBCRTBEGIN=	# nothing
28LIBCRTEND=	# nothing
29LIBC=		# nothing
30
31BINDIR=		/usr/mdec
32BINMODE=	444
33
34.include <bsd.own.mk>
35
36TEXTADDR=	0x01004000
37STACKADDR=	0x01100000
38ENTRY=		__start
39
40AFLAGS+=	-mcpu=750
41
42CFLAGS+=	-mcpu=750 -msdata=none -mno-strict-align -msoft-float
43CFLAGS+=	-ffreestanding
44CFLAGS+=	-nostdinc
45CFLAGS+=	-Wall -Wmissing-prototypes
46
47CPPFLAGS+=	-D_STANDALONE
48CPPFLAGS+=	-DSUPPORT_DOSFS
49CPPFLAGS+=	-DLIBSA_FFS_EI
50CPPFLAGS+=	-DLIBSA_DISKLABEL_EI
51
52CPPFLAGS+=	-DTEXTADDR=${TEXTADDR}
53CPPFLAGS+=	-DSTACKADDR=${STACKADDR}
54CPPFLAGS+=	-DPPC_OEA -DDISTANT_KERNEL -D__wii__ -Devbppc=evbppc
55CPPFLAGS+=	-DCACHE_LINE_SIZE=32
56CPPFLAGS+=	-DEVBPPC_HAS_MBR
57
58CPPFLAGS+=	-I. -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
59
60# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
61# accessors -- they don't actually dereference the resulting pointer,
62# just use it for type-checking.
63CWARNFLAGS+=		${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
64
65### find out what to use for libsa
66SA_AS= library
67SAMISCMAKEFLAGS+=	SA_USE_LOADFILE=yes
68SAMISCMAKEFLAGS+=	SA_USE_CREAD=yes
69SAMISCMAKEFLAGS+=	SA_INCLUDE_NET=no
70.include "${S}/lib/libsa/Makefile.inc"
71LIBSA= ${SALIB}
72
73### find out what to use for libkern
74KERN_AS= library
75.include "${S}/lib/libkern/Makefile.inc"
76LIBKERN= ${KERNLIB}
77
78### find out what to use for libz
79Z_AS= library
80.include "${S}/lib/libz/Makefile.inc"
81LIBZ= ${ZLIB}
82
83cleandir distclean: .WAIT cleanlibdir
84
85cleanlibdir:
86	-rm -rf lib
87
88LIBLIST= ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA}
89
90.include "${S}/conf/newvers_stand.mk"
91
92${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
93	${_MKTARGET_LINK}
94	${LD} -N -T ${POWERPC}/conf/kern.ldscript \
95	    -Ttext ${TEXTADDR} -e ${ENTRY} -q -X \
96	    -o ${PROG} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
97
98release: check_RELEASEDIR
99	${HOST_INSTALL_FILE} -m ${BINMODE} ${PROG} \
100	    ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/misc
101
102.include <bsd.klinks.mk>
103.include <bsd.prog.mk>
104