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