Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.29
      1 #	$NetBSD: Makefile,v 1.29 2002/03/29 18:21:38 tsutsui Exp $
      2 
      3 S=	${.CURDIR}/../../../..
      4 
      5 PROG=		ofwboot
      6 FILES=		${PROG}.elf ${PROG}.xcf
      7 SRCS=		Locore.c ofdev.c hfs.c net.c netif_of.c vers.c
      8 XCOFFXTRA=	Xcoffxtra.c
      9 XCOFFXTRAOBJ=	Xcoffxtra.o
     10 CFLAGS+=	-Wno-main -msoft-float -mmultiple
     11 #CPPFLAGS+=	-DDEBUG -DNETIF_DEBUG
     12 CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP
     13 DBG=		-Os
     14 
     15 .PATH:		${S}/arch/powerpc/powerpc
     16 SRCS+=		ofwmagic.S
     17 
     18 NOMAN=		# defined
     19 STRIPFLAG=
     20 BINMODE=	444
     21 
     22 .if !defined(FIXCOFF)
     23 .include <bsd.own.mk>
     24 
     25 FIXCOFFDIR!=	cd ${.CURDIR}/../fixcoff && ${PRINTOBJDIR}
     26 FIXCOFF=	${FIXCOFFDIR}/fixcoff
     27 FIXCOFFTARG=	${FIXCOFF}
     28 
     29 ${FIXCOFF}:
     30 	(cd ${.CURDIR}/../fixcoff; ${MAKE})
     31 
     32 .else
     33 FIXCOFFTARG=
     34 .endif
     35 
     36 NEWVERSWHAT=	"OpenFirmware Boot"
     37 
     38 # For now...
     39 #RELOC=		20000
     40 RELOC=		640000
     41 RELOC_FLATFILE=	600000
     42 
     43 ENTRY=		_start
     44 
     45 CLEANFILES+=	vers.c ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf
     46 CLEANFILES+=	machine powerpc
     47 
     48 CPPFLAGS+=	-I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../..
     49 CPPFLAGS+=	-DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE}
     50 #CPPFLAGS+=	-DXCOFF_GLUE		# for booting PCI Powermacs
     51 
     52 CLEANFILES+= ${XCOFFXTRAOBJ} boot.o boot1.o
     53 
     54 .if !make(obj) && !make(clean) && !make(cleandir)
     55 .BEGIN:
     56 	@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
     57 	@[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
     58 .NOPATH: machine powerpc
     59 .endif
     60 CLEANFILES+= machine powerpc
     61 
     62 ### find out what to use for libkern
     63 KERN_AS=	library
     64 .include "${S}/lib/libkern/Makefile.inc"
     65 LIBKERN=	${KERNLIB}
     66 
     67 ### find out what to use for libz
     68 Z_AS=		library
     69 .include "${S}/lib/libz/Makefile.inc"
     70 LIBZ=		${ZLIB}
     71 
     72 ### find out what to use for libsa
     73 SA_AS=		library
     74 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
     75 .include "${S}/lib/libsa/Makefile.inc"
     76 LIBSA=		${SALIB}
     77 
     78 .PHONY: vers.c
     79 vers.c: version
     80 	sh ${S}/conf/newvers_stand.sh ${.CURDIR}/version "macppc" ${NEWVERSWHAT}
     81 
     82 all realall: ${PROG} ${PROG}.xcf ${PROG}.elf
     83 
     84 ${PROG}: ${OBJS} boot1.o ${LIBSA} ${LIBZ} ${LIBKERN} 
     85 	${LD} -s -N -Ttext ${RELOC_FLATFILE} -Bstatic -o ${PROG}.el1 \
     86 	    ${OBJS} boot1.o ${LIBSA} ${LIBZ} ${LIBKERN}
     87 	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
     88 
     89 .include <bsd.prog.mk>
     90 
     91 ${PROG}.elf: ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
     92 	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \
     93 	    ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
     94 
     95 ${PROG}.xcf: ${OBJS} boot.o ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN} ${FIXCOFFTARG}
     96 	${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \
     97 	    -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg  ${XCOFFXTRAOBJ} \
     98 	    ${OBJS} boot.o ${LIBSA} ${LIBZ} ${LIBKERN}
     99 	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
    100 	    ${PROG}.mrg ${PROG}.xcf
    101 	${FIXCOFF} ${PROG}.xcf
    102