Makefile revision 1.61
11.61Smartin#	$NetBSD: Makefile,v 1.61 2025/05/10 11:59:00 martin Exp $
21.1Stsubai
31.1StsubaiS=	${.CURDIR}/../../../..
41.1Stsubai
51.1StsubaiPROG=		ofwboot
61.12SdmcmahilFILES=		${PROG}.elf ${PROG}.xcf
71.60SthorpejSRCS=		Locore.c boot.c ofdev.c hfs.c net.c netif_of.c \
81.60Sthorpej		loadfile_machdep.c
91.7SwrstudenXCOFFXTRA=	Xcoffxtra.c
101.7SwrstudenXCOFFXTRAOBJ=	Xcoffxtra.o
111.54SjoergCFLAGS+=	-ffreestanding
121.54SjoergCFLAGS+=	${${ACTIVE_CC} == "gcc":? -msoft-float :}
131.58SuweCFLAGS+=	${CFLAGS_UNWIND.${ACTIVE_CC}}
141.47StsutsuiCFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
151.29Stsutsui#CPPFLAGS+=	-DDEBUG -DNETIF_DEBUG
161.29StsutsuiCPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP
171.31StsutsuiCPPFLAGS+=	-DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK
181.41SaymericDBG=		-Os
191.36Sthorpej
201.59Suwe# PR port-macppc/44895
211.59SuweSRCS+=		alloc.c			# use ./alloc.c
221.59Suwe#CPPFLAGS+=	-DHEAP_VARIABLE		# use libsa alloc.c
231.59Suwe
241.36SthorpejLIBCRT0=	# nothing
251.52StsutsuiLIBCRTI=	# nothing
261.36SthorpejLIBCRTBEGIN=	# nothing
271.36SthorpejLIBCRTEND=	# nothing
281.36SthorpejLIBC=		# nothing
291.9Stsubai
301.1Stsubai.PATH:		${S}/arch/powerpc/powerpc
311.1StsubaiSRCS+=		ofwmagic.S
321.34Sitojun
331.34Sitojun.PATH:		${S}/lib/libsa
341.34SitojunSRCS+=		byteorder.c
351.9Stsubai
361.24StvNOMAN=		# defined
371.1StsubaiSTRIPFLAG=
381.1StsubaiBINMODE=	444
391.1Stsubai
401.23Stv.include <bsd.own.mk>
411.23Stv
421.51Sjoerg.if !defined(FIXCOFF)
431.39Smatt.if !defined(TOOL_MACPPCFIXCOFF)
441.39SmattTOOL_MACPPCFIXCOFFDIR!=	cd ${.CURDIR}/../fixcoff && ${PRINTOBJDIR}
451.46ShaukeTOOL_MACPPCFIXCOFF=	${TOOL_MACPPCFIXCOFFDIR}/fixcoff
461.39Smatt.endif
471.7Swrstuden.endif
481.7Swrstuden
491.1StsubaiNEWVERSWHAT=	"OpenFirmware Boot"
501.1Stsubai
511.1Stsubai# For now...
521.1Stsubai#RELOC=		20000
531.42SwrstudenRELOC=		E00000
541.1Stsubai
551.1StsubaiENTRY=		_start
561.1Stsubai
571.56SchristosCLEANFILES+=	${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf
581.57SuweCLEANFILES+=	${XCOFFXTRAOBJ}
591.1Stsubai
601.30StsutsuiCPPFLAGS+=	-I. -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
611.26SwrstudenCPPFLAGS+=	-DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE}
621.1Stsubai#CPPFLAGS+=	-DXCOFF_GLUE		# for booting PCI Powermacs
631.1Stsubai
641.58SuweLINKFLAGS=	-N -Ttext ${RELOC} -Bstatic
651.58SuweLINKFLAGS+=	${LINKFLAGS_UNWIND}
661.58Suwe
671.1Stsubai### find out what to use for libkern
681.1StsubaiKERN_AS=	library
691.1Stsubai.include "${S}/lib/libkern/Makefile.inc"
701.1StsubaiLIBKERN=	${KERNLIB}
711.1Stsubai
721.1Stsubai### find out what to use for libz
731.1StsubaiZ_AS=		library
741.1Stsubai.include "${S}/lib/libz/Makefile.inc"
751.1StsubaiLIBZ=		${ZLIB}
761.1Stsubai
771.1Stsubai### find out what to use for libsa
781.1StsubaiSA_AS=		library
791.5StsubaiSAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
801.1Stsubai.include "${S}/lib/libsa/Makefile.inc"
811.1StsubaiLIBSA=		${SALIB}
821.33Stsutsui
831.50Sdhollandcleandir distclean: .WAIT cleanlibdir
841.33Stsutsui
851.33Stsutsuicleanlibdir:
861.44Sjmc	-rm -rf lib
871.1Stsubai
881.56Schristos.include "${S}/conf/newvers_stand.mk"
891.13Sjdolecek
901.27Swrstudenall realall: ${PROG} ${PROG}.xcf ${PROG}.elf
911.26Swrstuden
921.42Swrstuden${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 
931.43Smatt	${_MKTARGET_LINK}
941.58Suwe	${LD} -s -o ${PROG}.el1 ${LINKFLAGS} \
951.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
961.26Swrstuden	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
971.26Swrstuden
981.48Stsutsui.include <bsd.klinks.mk>
991.26Swrstuden.include <bsd.prog.mk>
1001.26Swrstuden
1011.42Swrstuden${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1021.43Smatt	${_MKTARGET_LINK}
1031.58Suwe	${LD} -s -o ${PROG}.elf ${LINKFLAGS} \
1041.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1051.26Swrstuden
1061.42Swrstuden${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN}
1071.43Smatt	${_MKTARGET_LINK}
1081.58Suwe	${LD} -o ${PROG}.mrg ${LINKFLAGS} \
1091.58Suwe	    -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x \
1101.58Suwe	    -e _entry ${XCOFFXTRAOBJ} \
1111.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1121.7Swrstuden	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
1131.61Smartin	    --strip-debug --strip-unneeded \
1141.61Smartin	    ${PROG}.mrg ${PROG}.xcf.${.MAKE.PID}
1151.61Smartin	${TOOL_MACPPCFIXCOFF} ${PROG}.xcf.${.MAKE.PID} && \
1161.61Smartin	    mv ${PROG}.xcf.${.MAKE.PID} ${PROG}.xcf
117