Makefile revision 1.28
11.28Sjmc#	$NetBSD: Makefile,v 1.28 2002/03/02 06:32:28 jmc 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.21SmattCFLAGS+=	-msoft-float -Wno-main
111.9Stsubai#CFLAGS+=	-DDEBUG -DNETIF_DEBUG
121.20SmattCPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP -I${.CURDIR}
131.14StsubaiDBG=		-Os -mmultiple
141.9Stsubai
151.1Stsubai.PATH:		${S}/arch/powerpc/powerpc
161.1StsubaiSRCS+=		ofwmagic.S
171.9Stsubai
181.24StvNOMAN=		# defined
191.1StsubaiSTRIPFLAG=
201.1StsubaiBINMODE=	444
211.1Stsubai
221.7Swrstuden.if !defined(FIXCOFF)
231.23Stv.include <bsd.own.mk>
241.23Stv
251.23StvFIXCOFFDIR!=	cd ${.CURDIR}/../fixcoff && ${PRINTOBJDIR}
261.7SwrstudenFIXCOFF=	${FIXCOFFDIR}/fixcoff
271.7SwrstudenFIXCOFFTARG=	${FIXCOFF}
281.7Swrstuden
291.7Swrstuden${FIXCOFF}:
301.18Sgarbled	(cd ${.CURDIR}/../fixcoff; ${MAKE})
311.7Swrstuden
321.7Swrstuden.else
331.7SwrstudenFIXCOFFTARG=
341.7Swrstuden.endif
351.7Swrstuden
361.1StsubaiNEWVERSWHAT=	"OpenFirmware Boot"
371.1Stsubai
381.1Stsubai# For now...
391.1Stsubai#RELOC=		20000
401.26SwrstudenRELOC=		640000
411.26SwrstudenRELOC_FLATFILE=	600000
421.1Stsubai
431.1StsubaiENTRY=		_start
441.1Stsubai
451.26SwrstudenCLEANFILES+=	vers.c ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf
461.26SwrstudenCLEANFILES+=	machine powerpc
471.1Stsubai
481.5StsubaiCPPFLAGS+=	-I. -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
491.26SwrstudenCPPFLAGS+=	-DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE}
501.1Stsubai#CPPFLAGS+=	-DXCOFF_GLUE		# for booting PCI Powermacs
511.1Stsubai
521.26SwrstudenCLEANFILES+= ${XCOFFXTRAOBJ} boot.o boot1.o
531.5Stsubai
541.28Sjmc.if !make(obj) && !make(clean) && !make(cleandir)
551.5Stsubai.BEGIN:
561.5Stsubai	@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
571.5Stsubai	@[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
581.8Smycroft.NOPATH: machine powerpc
591.28Sjmc.endif
601.8SmycroftCLEANFILES+= machine powerpc
611.5Stsubai
621.1Stsubai### find out what to use for libkern
631.1StsubaiKERN_AS=	library
641.1Stsubai.include "${S}/lib/libkern/Makefile.inc"
651.1StsubaiLIBKERN=	${KERNLIB}
661.1Stsubai
671.1Stsubai### find out what to use for libz
681.1StsubaiZ_AS=		library
691.1Stsubai.include "${S}/lib/libz/Makefile.inc"
701.1StsubaiLIBZ=		${ZLIB}
711.1Stsubai
721.1Stsubai### find out what to use for libsa
731.1StsubaiSA_AS=		library
741.5StsubaiSAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
751.1Stsubai.include "${S}/lib/libsa/Makefile.inc"
761.1StsubaiLIBSA=		${SALIB}
771.1Stsubai
781.13Sjdolecek.PHONY: vers.c
791.13Sjdolecekvers.c: version
801.13Sjdolecek	sh ${S}/conf/newvers_stand.sh ${.CURDIR}/version "macppc" ${NEWVERSWHAT}
811.13Sjdolecek
821.27Swrstudenall realall: ${PROG} ${PROG}.xcf ${PROG}.elf
831.26Swrstuden
841.26Swrstuden${PROG}: ${OBJS} boot1.o ${LIBSA} ${LIBZ} ${LIBKERN} 
851.26Swrstuden	${LD} -s -N -Ttext ${RELOC_FLATFILE} -Bstatic -o ${PROG}.el1 \
861.26Swrstuden	    ${OBJS} boot1.o ${LIBSA} ${LIBZ} ${LIBKERN}
871.26Swrstuden	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
881.26Swrstuden
891.26Swrstuden.include <bsd.prog.mk>
901.26Swrstuden
911.26Swrstuden${PROG}.elf: ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
921.7Swrstuden	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \
931.26Swrstuden	    ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
941.26Swrstuden
951.26Swrstuden${PROG}.xcf: ${OBJS} boot.o ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN} ${FIXCOFFTARG}
961.7Swrstuden	${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \
971.7Swrstuden	    -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg  ${XCOFFXTRAOBJ} \
981.26Swrstuden	    ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
991.7Swrstuden	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
1001.7Swrstuden	    ${PROG}.mrg ${PROG}.xcf
1011.7Swrstuden	${FIXCOFF} ${PROG}.xcf
102