1 # $NetBSD: Makefile,v 1.52 2014/01/12 15:26:30 tsutsui 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 LIBCRTI= # nothing 19 LIBCRTBEGIN= # nothing 20 LIBCRTEND= # nothing 21 LIBC= # nothing 22 23 .PATH: ${S}/arch/powerpc/powerpc 24 SRCS+= ofwmagic.S 25 26 .PATH: ${S}/lib/libsa 27 SRCS+= byteorder.c 28 29 NOMAN= # defined 30 STRIPFLAG= 31 BINMODE= 444 32 33 .include <bsd.own.mk> 34 35 .if !defined(FIXCOFF) 36 .if !defined(TOOL_MACPPCFIXCOFF) 37 TOOL_MACPPCFIXCOFFDIR!= cd ${.CURDIR}/../fixcoff && ${PRINTOBJDIR} 38 TOOL_MACPPCFIXCOFF= ${TOOL_MACPPCFIXCOFFDIR}/fixcoff 39 .endif 40 .endif 41 42 NEWVERSWHAT= "OpenFirmware Boot" 43 44 # For now... 45 #RELOC= 20000 46 RELOC= E00000 47 48 ENTRY= _start 49 50 CLEANFILES+= vers.c ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf 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 ### find out what to use for libkern 59 KERN_AS= library 60 .include "${S}/lib/libkern/Makefile.inc" 61 LIBKERN= ${KERNLIB} 62 63 ### find out what to use for libz 64 Z_AS= library 65 .include "${S}/lib/libz/Makefile.inc" 66 LIBZ= ${ZLIB} 67 68 ### find out what to use for libsa 69 SA_AS= library 70 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes 71 .include "${S}/lib/libsa/Makefile.inc" 72 LIBSA= ${SALIB} 73 74 cleandir distclean: .WAIT cleanlibdir 75 76 cleanlibdir: 77 -rm -rf lib 78 79 .PHONY: vers.c 80 vers.c: version 81 ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \ 82 ${.CURDIR}/version "macppc" ${NEWVERSWHAT} 83 84 all realall: ${PROG} ${PROG}.xcf ${PROG}.elf 85 86 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 87 ${_MKTARGET_LINK} 88 ${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.el1 \ 89 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 90 ${OBJCOPY} -O binary ${PROG}.el1 ${PROG} 91 92 .include <bsd.klinks.mk> 93 .include <bsd.prog.mk> 94 95 ${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 96 ${_MKTARGET_LINK} 97 ${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \ 98 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 99 100 ${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN} 101 ${_MKTARGET_LINK} 102 ${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \ 103 -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg ${XCOFFXTRAOBJ} \ 104 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 105 ${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \ 106 ${PROG}.mrg ${PROG}.xcf 107 ${TOOL_MACPPCFIXCOFF} ${PROG}.xcf 108