1 # $NetBSD: Makefile,v 1.57 2017/04/20 18:39:28 uwe 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 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+= ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf 52 CLEANFILES+= ${XCOFFXTRAOBJ} 53 54 CPPFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. 55 CPPFLAGS+= -DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE} 56 #CPPFLAGS+= -DXCOFF_GLUE # for booting PCI Powermacs 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 .include "${S}/conf/newvers_stand.mk" 80 81 all realall: ${PROG} ${PROG}.xcf ${PROG}.elf 82 83 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 84 ${_MKTARGET_LINK} 85 ${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.el1 \ 86 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 87 ${OBJCOPY} -O binary ${PROG}.el1 ${PROG} 88 89 .include <bsd.klinks.mk> 90 .include <bsd.prog.mk> 91 92 ${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 93 ${_MKTARGET_LINK} 94 ${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \ 95 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 96 97 ${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN} 98 ${_MKTARGET_LINK} 99 ${LD} -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \ 100 -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg ${XCOFFXTRAOBJ} \ 101 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 102 ${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \ 103 ${PROG}.mrg ${PROG}.xcf 104 ${TOOL_MACPPCFIXCOFF} ${PROG}.xcf 105