Makefile revision 91114
184974Srobert# $FreeBSD: head/sys/boot/sparc64/loader/Makefile 91114 2002-02-23 04:35:28Z jake $
284974Srobert
384974SrobertBASE=		loader
484974SrobertPROG=		${BASE}
584974SrobertNEWVERSWHAT=	"bootstrap loader" sparc64
684974Srobert
791114SjakeCFLAGS=		-mno-app-regs 
885720Sjake
991114SjakeLOADER_DISK_SUPPORT?=	no
1091114SjakeLOADER_NET_SUPPORT?=	yes
1191114SjakeLOADER_NFS_SUPPORT?=	yes
1291114SjakeLOADER_TFTP_SUPPORT?=	yes
1391114Sjake
1491114Sjake.if ${LOADER_DISK_SUPPORT} == "yes"
1591114SjakeCFLAGS+=	-DLOADER_DISK_SUPPORT
1691114Sjake.endif
1791114Sjake.if ${LOADER_NET_SUPPORT} == "yes"
1891114SjakeCFLAGS+=	-DLOADER_NET_SUPPORT
1991114Sjake.endif
2091114Sjake.if ${LOADER_NFS_SUPPORT} == "yes"
2191114SjakeCFLAGS+=	-DLOADER_NFS_SUPPORT
2291114Sjake.endif
2391114Sjake.if ${LOADER_TFTP_SUPPORT} == "yes"
2491114SjakeCFLAGS+=	-DLOADER_TFTP_SUPPORT
2591114Sjake.endif
2691114Sjake
2784974Srobert# Architecture-specific loader code
2885720SjakeSRCS=		locore.s main.c metadata.c
2984974Srobert
3084974Srobert# Always add MI sources 
3184974Srobert.PATH:		${.CURDIR}/../../common
3284974Srobert.include	<${.CURDIR}/../../common/Makefile.inc>
3384974SrobertCFLAGS+=	-I${.CURDIR}/../../common
3484974SrobertCFLAGS+=	-I${.CURDIR}/../../.. -I.
3584974Srobert
3684974SrobertCLEANFILES+=	${PROG}
3784974Srobert
3891114SjakeCFLAGS+=	-W -Wall -ffreestanding
3991114SjakeLDFLAGS=	-X -static
4084974Srobert
4184974Srobert# where to get libstand from
4284974Srobert#XXX need a better way to do this
4384974SrobertLIBSTAND=	${.CURDIR}/../../../../lib/libstand/libstand.a
4484974Srobert.if !exists(${LIBSTAND})
4584974SrobertLIBSTAND=	${.OBJDIR}/../../../../lib/libstand/libstand.a
4684974Srobert.if !exists(${LIBSTAND})
4784974SrobertLIBSTAND=	-lstand
4884974Srobert.endif
4984974Srobert.endif
5084974SrobertLIBOFW=		${.CURDIR}/../../ofw/libofw/libofw.a
5184974SrobertCFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
5284974SrobertCFLAGS+=	-I${.CURDIR}/../../ofw/libofw/
5384974Srobert
5484974Srobert# Debug me!
5584974Srobert#CFLAGS+=	-g
5684974Srobert#LDFLAGS+=	-g
5784974Srobert
5884974Srobert${PROG}:	${OBJS}
5984974Srobert	${LD} -o ${.TARGET} ${OBJS} ${LIBOFW} ${LIBSTAND} ${LDFLAGS}
6084974Srobert
6184974Srobertlocore.o:	locore.s
6284974Srobert	${CC} ${CFLAGS} -D_LOCORE -xassembler-with-cpp -c locore.s -o locore.o
6384974Srobertmain.o:		main.c
6484974Srobert	${CC} ${CFLAGS} -c main.c -o main.o
6584974Srobert
6684974Srobertbeforeinstall:
6784974Srobert.if exists(${DESTDIR}/boot/loader)
6884974Srobert	mv ${DESTDIR}/boot/loader ${DESTDIR}/boot/loader.old
6984974Srobert.endif
7084974Srobert.if exists(${.OBJDIR}/loader.help)
7184974Srobert	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7284974Srobert		${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
7384974Srobert.else
7484974Srobert	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7584974Srobert		${.CURDIR}/${BASE}.help ${DESTDIR}/boot
7684974Srobert.endif
7784974Srobert.if !exists(${DESTDIR}/boot/loader.rc)
7884974Srobert	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7984974Srobert		${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot
8084974Srobert.endif
8184974Srobert	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8284974Srobert		${.CURDIR}/../../forth/loader.4th ${DESTDIR}/boot
8384974Srobert	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8484974Srobert		${.CURDIR}/../../forth/support.4th ${DESTDIR}/boot
8584974Srobert	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8684974Srobert		${.CURDIR}/../../forth/loader.conf ${DESTDIR}/boot/defaults
8784974Srobert
8884974Srobert# There are no things relevant to all boot parts of FreeBSD/sparc64 yet.
8984974Srobert#.include <${.CURDIR}/../Makefile.inc>
9084974Srobert
9184974Srobert.include <bsd.prog.mk>
92