11.42Slukem#	$NetBSD: Makefile,v 1.42 2023/06/03 21:26:28 lukem Exp $
21.37Schristos
31.37Schristos.include <bsd.init.mk>
41.1Smrg
51.1SmrgCURDIR=	${.CURDIR}
61.1SmrgS=	${CURDIR}/../../../..
71.1Smrg
81.1Smrg#
91.1Smrg# Override normal settings
101.1Smrg#
111.1Smrg
121.29StsutsuiWARNS?=		2
131.30SmattKLINK_MACHINE=	sparc64
141.1Smrg
151.1SmrgPROG?=		ofwboot
161.38SchristosSRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c
171.25SchristosSRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c
181.31Spalle.if ${MACHINE_ARCH} == "sparc64"
191.31SpalleSRCS+=		hvcall.S
201.35SmartinCPPFLAGS+=	-DSUN4V
211.31Spalle.endif
221.25Schristos.PATH:		${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common
231.1Smrg
241.13Ssimonb# XXX SHOULD NOT NEED TO DEFINE THESE!
251.13SsimonbLIBCRT0=
261.32StsutsuiLIBCRTI=
271.13SsimonbLIBC=
281.13SsimonbLIBCRTBEGIN=
291.13SsimonbLIBCRTEND=
301.13Ssimonb
311.36SmrgCOPTS+=		-ffreestanding -mcpu=v9
321.1SmrgCWARNFLAGS+=	-Wno-main
331.35SmartinCFLAGS+=	${COPTS}
341.35SmartinCPPFLAGS+=	-D_STANDALONE
351.18ScdiCPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
361.10SmrgCPPFLAGS+=	-DNETBOOT
371.14SchristosCPPFLAGS+=	-DSUPPORT_DHCP
381.1Smrg#CPPFLAGS+=	-DNETIF_DEBUG 
391.18Scdi#CPPFLAGS+=	-D_DEBUG
401.10Smrg
411.39Sriastrad# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
421.39Sriastrad# accessors -- they don't actually dereference the resulting pointer,
431.39Sriastrad# just use it for type-checking.
441.42SlukemCWARNFLAGS+=	${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
451.39Sriastrad
461.10SmrgLINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
471.1Smrg
481.5StvNOMAN=		# defined
491.1SmrgSTRIPFLAG=
501.1SmrgBINMODE=	444
511.1Smrg
521.1SmrgNEWVERSWHAT=	"OpenFirmware Boot"
531.1Smrg
541.1Smrg#
551.1Smrg# Elf64 defaults to 1MB
561.1Smrg#
571.1Smrg# We may get address conflicts with other bootloaders, say
581.1Smrg# Sun's ufsboot, so we'll pick a reasonably empty address.
591.1Smrg#
601.18ScdiRELOC=		100000
611.1Smrg
621.1SmrgENTRY=		_start
631.1Smrg
641.1SmrgCPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
651.22StsutsuiCPPFLAGS+=	-I${CURDIR}/../../../../../common/include
661.1SmrgCPPFLAGS+=	-DRELOC=0x${RELOC}
671.1Smrg
681.1Smrg#
691.1Smrg# XXXXX FIXME
701.1Smrg#
711.1SmrgCPPFLAGS+=	-DSPARC_BOOT_AOUT
721.1SmrgCPPFLAGS+=	-DSPARC_BOOT_ELF
731.1SmrgCPPFLAGS+=	-DSPARC_BOOT_UFS
741.1SmrgCPPFLAGS+=	-DSPARC_BOOT_NFS
751.23SmartinCPPFLAGS+=	-DSPARC_BOOT_CD9660
761.1Smrg
771.1Smrg### find out what to use for libkern
781.1SmrgKERN_AS=	library
791.1Smrg.include "${S}/lib/libkern/Makefile.inc"
801.1SmrgLIBKERN=	${KERNLIB}
811.1Smrg
821.1Smrg### find out what to use for libz
831.1SmrgZ_AS=		library
841.1Smrg.include "${S}/lib/libz/Makefile.inc"
851.1SmrgLIBZ=		${ZLIB}
861.1Smrg
871.1Smrg### find out what to use for libsa
881.1SmrgSA_AS=		library
891.18ScdiSAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
901.20SmartinSAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
911.1Smrg.include "${S}/lib/libsa/Makefile.inc"
921.1SmrgLIBSA=		${SALIB}
931.1Smrg
941.38Schristos.include "${S}/conf/newvers_stand.mk"
951.38Schristos
961.28Snakayama.include <bsd.own.mk>
971.30Smatt.include <bsd.klinks.mk>
981.28Snakayama
991.1Smrg.if CROSS
1001.1Smrg${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1011.30Smatt	${_MKTARGET_LINK}
1021.1Smrg	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
1031.1Smrg	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
1041.1Smrg.else
1051.1Smrg${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1061.30Smatt	${_MKTARGET_LINK}
1071.33Smartin	${LD} -X -N -S -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
1081.1Smrg	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
1091.1Smrg.endif
1101.1Smrg
1111.1Smrg.include <bsd.prog.mk>
1121.1Smrg
1131.35SmartinCPUFLAGS+=		-mcpu=v9
1141.2SmrgAFLAGS+=		-Wa,-Av9a
1151.26SjoergAFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__
1161.2Smrg
1171.34SjoergNORMAL_S=	${CC} ${AFLAGS} ${AFLAGS.${<:T}}  ${CPPFLAGS} -c $<
1181.1Smrgsrt0.o: srt0.s
1191.1Smrg	${NORMAL_S}
1201.1Smrg
1211.31Spallehvcall.o: hvcall.S
1221.31Spalle	${NORMAL_S}
1231.31Spalle
1241.31Spalle
1251.1Smrg# Explicit dependency for this.
1261.18Scdiboot.o: boot.c
127