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