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