1 # $NetBSD: Makefile,v 1.50 2010/05/27 06:58:14 dholland 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+= -msoft-float -mmultiple -ffreestanding 11 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith 12 #CPPFLAGS+= -DDEBUG -DNETIF_DEBUG 13 CPPFLAGS+= -D_STANDALONE -DSUPPORT_DHCP 14 CPPFLAGS+= -DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK 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 51 CPPFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. 52 CPPFLAGS+= -DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE} 53 #CPPFLAGS+= -DXCOFF_GLUE # for booting PCI Powermacs 54 55 CLEANFILES+= ${XCOFFXTRAOBJ} 56 57 ### find out what to use for libkern 58 KERN_AS= library 59 .include "${S}/lib/libkern/Makefile.inc" 60 LIBKERN= ${KERNLIB} 61 62 ### find out what to use for libz 63 Z_AS= library 64 .include "${S}/lib/libz/Makefile.inc" 65 LIBZ= ${ZLIB} 66 67 ### find out what to use for libsa 68 SA_AS= library 69 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes 70 .include "${S}/lib/libsa/Makefile.inc" 71 LIBSA= ${SALIB} 72 73 cleandir distclean: .WAIT cleanlibdir 74 75 cleanlibdir: 76 -rm -rf lib 77 78 .PHONY: vers.c 79 vers.c: version 80 ${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "macppc" ${NEWVERSWHAT} 81 82 all realall: ${PROG} ${PROG}.xcf ${PROG}.elf 83 84 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 85 ${_MKTARGET_LINK} 86 ${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.el1 \ 87 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 88 ${OBJCOPY} -O binary ${PROG}.el1 ${PROG} 89 90 .include <bsd.klinks.mk> 91 .include <bsd.prog.mk> 92 93 ${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 94 ${_MKTARGET_LINK} 95 ${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \ 96 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 97 98 ${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN} 99 ${_MKTARGET_LINK} 100 ${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \ 101 -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg ${XCOFFXTRAOBJ} \ 102 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 103 ${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \ 104 ${PROG}.mrg ${PROG}.xcf 105 ${TOOL_MACPPCFIXCOFF} ${PROG}.xcf 106