Makefile revision 1.47
11.47Stsutsui#	$NetBSD: Makefile,v 1.47 2009/01/12 07:05:22 tsutsui 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.47StsutsuiCFLAGS+=	-msoft-float -mmultiple -ffreestanding
111.47StsutsuiCFLAGS+=	-Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
121.29Stsutsui#CPPFLAGS+=	-DDEBUG -DNETIF_DEBUG
131.29StsutsuiCPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP
141.31StsutsuiCPPFLAGS+=	-DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK
151.32StsutsuiCPPFLAGS+=	-DLIBSA_USE_MEMCPY -DLIBSA_USE_MEMSET
161.41SaymericDBG=		-Os
171.36Sthorpej
181.36SthorpejLIBCRT0=	# nothing
191.36SthorpejLIBCRTBEGIN=	# nothing
201.36SthorpejLIBCRTEND=	# nothing
211.36SthorpejLIBC=		# nothing
221.9Stsubai
231.1Stsubai.PATH:		${S}/arch/powerpc/powerpc
241.1StsubaiSRCS+=		ofwmagic.S
251.34Sitojun
261.34Sitojun.PATH:		${S}/lib/libsa
271.34SitojunSRCS+=		byteorder.c
281.9Stsubai
291.24StvNOMAN=		# defined
301.1StsubaiSTRIPFLAG=
311.1StsubaiBINMODE=	444
321.1Stsubai
331.7Swrstuden.if !defined(FIXCOFF)
341.23Stv.include <bsd.own.mk>
351.23Stv
361.39Smatt.if !defined(TOOL_MACPPCFIXCOFF)
371.39SmattTOOL_MACPPCFIXCOFFDIR!=	cd ${.CURDIR}/../fixcoff && ${PRINTOBJDIR}
381.46ShaukeTOOL_MACPPCFIXCOFF=	${TOOL_MACPPCFIXCOFFDIR}/fixcoff
391.39Smatt.endif
401.7Swrstuden.endif
411.7Swrstuden
421.1StsubaiNEWVERSWHAT=	"OpenFirmware Boot"
431.1Stsubai
441.1Stsubai# For now...
451.1Stsubai#RELOC=		20000
461.42SwrstudenRELOC=		E00000
471.1Stsubai
481.1StsubaiENTRY=		_start
491.1Stsubai
501.26SwrstudenCLEANFILES+=	vers.c ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf
511.26SwrstudenCLEANFILES+=	machine powerpc
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.28Sjmc.if !make(obj) && !make(clean) && !make(cleandir)
601.5Stsubai.BEGIN:
611.5Stsubai	@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
621.5Stsubai	@[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
631.8Smycroft.NOPATH: machine powerpc
641.28Sjmc.endif
651.8SmycroftCLEANFILES+= machine powerpc
661.5Stsubai
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.33Stsutsuicleandir distclean: cleanlibdir
841.33Stsutsui
851.33Stsutsuicleanlibdir:
861.44Sjmc	-rm -rf lib
871.1Stsubai
881.13Sjdolecek.PHONY: vers.c
891.13Sjdolecekvers.c: version
901.38Slukem	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "macppc" ${NEWVERSWHAT}
911.13Sjdolecek
921.27Swrstudenall realall: ${PROG} ${PROG}.xcf ${PROG}.elf
931.26Swrstuden
941.42Swrstuden${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 
951.43Smatt	${_MKTARGET_LINK}
961.42Swrstuden	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.el1 \
971.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
981.26Swrstuden	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
991.26Swrstuden
1001.26Swrstuden.include <bsd.prog.mk>
1011.26Swrstuden
1021.42Swrstuden${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1031.43Smatt	${_MKTARGET_LINK}
1041.7Swrstuden	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \
1051.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1061.26Swrstuden
1071.42Swrstuden${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN}
1081.43Smatt	${_MKTARGET_LINK}
1091.7Swrstuden	${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \
1101.7Swrstuden	    -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg  ${XCOFFXTRAOBJ} \
1111.42Swrstuden	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
1121.7Swrstuden	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
1131.7Swrstuden	    ${PROG}.mrg ${PROG}.xcf
1141.39Smatt	${TOOL_MACPPCFIXCOFF} ${PROG}.xcf
115