Makefile revision 1.54
11.54Sjoerg#	$NetBSD: Makefile,v 1.54 2014/08/10 17:44:26 joerg Exp $
21.1Stsubai
31.1StsubaiS=	${.CURDIR}/../../../..
41.1Stsubai
51.1StsubaiPROG=		ofwboot
61.12SdmcmahilFILES=		${PROG}.elf ${PROG}.xcf
71.42SwrstudenSRCS=		Locore.c boot.c ofdev.c hfs.c net.c netif_of.c alloc.c vers.c
81.7SwrstudenXCOFFXTRA=	Xcoffxtra.c
91.7SwrstudenXCOFFXTRAOBJ=	Xcoffxtra.o
101.54SjoergCFLAGS+=	-ffreestanding
111.54SjoergCFLAGS+=	${${ACTIVE_CC} == "gcc":? -msoft-float :}
121.47StsutsuiCFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
131.29Stsutsui#CPPFLAGS+=	-DDEBUG -DNETIF_DEBUG
141.29StsutsuiCPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP
151.31StsutsuiCPPFLAGS+=	-DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK
161.41SaymericDBG=		-Os
171.36Sthorpej
181.36SthorpejLIBCRT0=	# nothing
191.52StsutsuiLIBCRTI=	# nothing
201.36SthorpejLIBCRTBEGIN=	# nothing
211.36SthorpejLIBCRTEND=	# nothing
221.36SthorpejLIBC=		# nothing
231.9Stsubai
241.1Stsubai.PATH:		${S}/arch/powerpc/powerpc
251.1StsubaiSRCS+=		ofwmagic.S
261.34Sitojun
271.34Sitojun.PATH:		${S}/lib/libsa
281.34SitojunSRCS+=		byteorder.c
291.9Stsubai
301.24StvNOMAN=		# defined
311.1StsubaiSTRIPFLAG=
321.1StsubaiBINMODE=	444
331.1Stsubai
341.23Stv.include <bsd.own.mk>
351.23Stv
361.51Sjoerg.if !defined(FIXCOFF)
371.39Smatt.if !defined(TOOL_MACPPCFIXCOFF)
381.39SmattTOOL_MACPPCFIXCOFFDIR!=	cd ${.CURDIR}/../fixcoff && ${PRINTOBJDIR}
391.46ShaukeTOOL_MACPPCFIXCOFF=	${TOOL_MACPPCFIXCOFFDIR}/fixcoff
401.39Smatt.endif
411.7Swrstuden.endif
421.7Swrstuden
431.1StsubaiNEWVERSWHAT=	"OpenFirmware Boot"
441.1Stsubai
451.1Stsubai# For now...
461.1Stsubai#RELOC=		20000
471.42SwrstudenRELOC=		E00000
481.1Stsubai
491.1StsubaiENTRY=		_start
501.1Stsubai
511.26SwrstudenCLEANFILES+=	vers.c ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf
521.1Stsubai
531.30StsutsuiCPPFLAGS+=	-I. -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
541.26SwrstudenCPPFLAGS+=	-DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE}
551.1Stsubai#CPPFLAGS+=	-DXCOFF_GLUE		# for booting PCI Powermacs
561.1Stsubai
571.42SwrstudenCLEANFILES+= ${XCOFFXTRAOBJ}
581.5Stsubai
591.1Stsubai### find out what to use for libkern
601.1StsubaiKERN_AS=	library
611.1Stsubai.include "${S}/lib/libkern/Makefile.inc"
621.1StsubaiLIBKERN=	${KERNLIB}
631.1Stsubai
641.1Stsubai### find out what to use for libz
651.1StsubaiZ_AS=		library
661.1Stsubai.include "${S}/lib/libz/Makefile.inc"
671.1StsubaiLIBZ=		${ZLIB}
681.1Stsubai
691.1Stsubai### find out what to use for libsa
701.1StsubaiSA_AS=		library
711.5StsubaiSAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
721.1Stsubai.include "${S}/lib/libsa/Makefile.inc"
731.1StsubaiLIBSA=		${SALIB}
741.33Stsutsui
751.50Sdhollandcleandir distclean: .WAIT cleanlibdir
761.33Stsutsui
771.33Stsutsuicleanlibdir:
781.44Sjmc	-rm -rf lib
791.1Stsubai
801.13Sjdolecek.PHONY: vers.c
811.13Sjdolecekvers.c: version
821.51Sjoerg	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
831.51Sjoerg	    ${.CURDIR}/version "macppc" ${NEWVERSWHAT}
841.13Sjdolecek
851.27Swrstudenall realall: ${PROG} ${PROG}.xcf ${PROG}.elf
861.26Swrstuden
871.42Swrstuden${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 
881.43Smatt	${_MKTARGET_LINK}
891.42Swrstuden	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.el1 \
901.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
911.26Swrstuden	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
921.26Swrstuden
931.48Stsutsui.include <bsd.klinks.mk>
941.26Swrstuden.include <bsd.prog.mk>
951.26Swrstuden
961.42Swrstuden${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
971.43Smatt	${_MKTARGET_LINK}
981.7Swrstuden	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \
991.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1001.26Swrstuden
1011.42Swrstuden${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN}
1021.43Smatt	${_MKTARGET_LINK}
1031.7Swrstuden	${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \
1041.7Swrstuden	    -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg  ${XCOFFXTRAOBJ} \
1051.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1061.7Swrstuden	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
1071.7Swrstuden	    ${PROG}.mrg ${PROG}.xcf
1081.39Smatt	${TOOL_MACPPCFIXCOFF} ${PROG}.xcf
109