Makefile revision 1.31
11.31Stsutsui#	$NetBSD: Makefile,v 1.31 2002/03/30 07:17:09 tsutsui Exp $
21.1Stsubai
31.1StsubaiS=	${.CURDIR}/../../../..
41.1Stsubai
51.1StsubaiPROG=		ofwboot
61.12SdmcmahilFILES=		${PROG}.elf ${PROG}.xcf
71.26SwrstudenSRCS=		Locore.c ofdev.c hfs.c net.c netif_of.c vers.c
81.7SwrstudenXCOFFXTRA=	Xcoffxtra.c
91.7SwrstudenXCOFFXTRAOBJ=	Xcoffxtra.o
101.29StsutsuiCFLAGS+=	-Wno-main -msoft-float -mmultiple
111.29Stsutsui#CPPFLAGS+=	-DDEBUG -DNETIF_DEBUG
121.29StsutsuiCPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP
131.31StsutsuiCPPFLAGS+=	-DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK
141.29StsutsuiDBG=		-Os
151.9Stsubai
161.1Stsubai.PATH:		${S}/arch/powerpc/powerpc
171.1StsubaiSRCS+=		ofwmagic.S
181.9Stsubai
191.24StvNOMAN=		# defined
201.1StsubaiSTRIPFLAG=
211.1StsubaiBINMODE=	444
221.1Stsubai
231.7Swrstuden.if !defined(FIXCOFF)
241.23Stv.include <bsd.own.mk>
251.23Stv
261.23StvFIXCOFFDIR!=	cd ${.CURDIR}/../fixcoff && ${PRINTOBJDIR}
271.7SwrstudenFIXCOFF=	${FIXCOFFDIR}/fixcoff
281.7SwrstudenFIXCOFFTARG=	${FIXCOFF}
291.7Swrstuden
301.7Swrstuden${FIXCOFF}:
311.18Sgarbled	(cd ${.CURDIR}/../fixcoff; ${MAKE})
321.7Swrstuden
331.7Swrstuden.else
341.7SwrstudenFIXCOFFTARG=
351.7Swrstuden.endif
361.7Swrstuden
371.1StsubaiNEWVERSWHAT=	"OpenFirmware Boot"
381.1Stsubai
391.1Stsubai# For now...
401.1Stsubai#RELOC=		20000
411.26SwrstudenRELOC=		640000
421.26SwrstudenRELOC_FLATFILE=	600000
431.1Stsubai
441.1StsubaiENTRY=		_start
451.1Stsubai
461.26SwrstudenCLEANFILES+=	vers.c ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf
471.26SwrstudenCLEANFILES+=	machine powerpc
481.1Stsubai
491.30StsutsuiCPPFLAGS+=	-I. -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
501.26SwrstudenCPPFLAGS+=	-DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE}
511.1Stsubai#CPPFLAGS+=	-DXCOFF_GLUE		# for booting PCI Powermacs
521.1Stsubai
531.26SwrstudenCLEANFILES+= ${XCOFFXTRAOBJ} boot.o boot1.o
541.5Stsubai
551.28Sjmc.if !make(obj) && !make(clean) && !make(cleandir)
561.5Stsubai.BEGIN:
571.5Stsubai	@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
581.5Stsubai	@[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
591.8Smycroft.NOPATH: machine powerpc
601.28Sjmc.endif
611.8SmycroftCLEANFILES+= machine powerpc
621.5Stsubai
631.1Stsubai### find out what to use for libkern
641.1StsubaiKERN_AS=	library
651.1Stsubai.include "${S}/lib/libkern/Makefile.inc"
661.1StsubaiLIBKERN=	${KERNLIB}
671.1Stsubai
681.1Stsubai### find out what to use for libz
691.1StsubaiZ_AS=		library
701.1Stsubai.include "${S}/lib/libz/Makefile.inc"
711.1StsubaiLIBZ=		${ZLIB}
721.1Stsubai
731.1Stsubai### find out what to use for libsa
741.1StsubaiSA_AS=		library
751.5StsubaiSAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
761.1Stsubai.include "${S}/lib/libsa/Makefile.inc"
771.1StsubaiLIBSA=		${SALIB}
781.1Stsubai
791.13Sjdolecek.PHONY: vers.c
801.13Sjdolecekvers.c: version
811.13Sjdolecek	sh ${S}/conf/newvers_stand.sh ${.CURDIR}/version "macppc" ${NEWVERSWHAT}
821.13Sjdolecek
831.27Swrstudenall realall: ${PROG} ${PROG}.xcf ${PROG}.elf
841.26Swrstuden
851.26Swrstuden${PROG}: ${OBJS} boot1.o ${LIBSA} ${LIBZ} ${LIBKERN} 
861.26Swrstuden	${LD} -s -N -Ttext ${RELOC_FLATFILE} -Bstatic -o ${PROG}.el1 \
871.26Swrstuden	    ${OBJS} boot1.o ${LIBSA} ${LIBZ} ${LIBKERN}
881.26Swrstuden	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
891.26Swrstuden
901.26Swrstuden.include <bsd.prog.mk>
911.26Swrstuden
921.26Swrstuden${PROG}.elf: ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
931.7Swrstuden	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \
941.26Swrstuden	    ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
951.26Swrstuden
961.26Swrstuden${PROG}.xcf: ${OBJS} boot.o ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN} ${FIXCOFFTARG}
971.7Swrstuden	${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \
981.7Swrstuden	    -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg  ${XCOFFXTRAOBJ} \
991.26Swrstuden	    ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
1001.7Swrstuden	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
1011.7Swrstuden	    ${PROG}.mrg ${PROG}.xcf
1021.7Swrstuden	${FIXCOFF} ${PROG}.xcf
103