Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.48
      1 #	$NetBSD: Makefile,v 1.48 2009/03/15 14:54:24 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 CPPFLAGS+=	-DLIBSA_USE_MEMCPY -DLIBSA_USE_MEMSET
     16 DBG=		-Os
     17 
     18 LIBCRT0=	# 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 .if !defined(FIXCOFF)
     34 .include <bsd.own.mk>
     35 
     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: 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 ${.CURDIR}/version "macppc" ${NEWVERSWHAT}
     82 
     83 all realall: ${PROG} ${PROG}.xcf ${PROG}.elf
     84 
     85 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 
     86 	${_MKTARGET_LINK}
     87 	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.el1 \
     88 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
     89 	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
     90 
     91 .include <bsd.klinks.mk>
     92 .include <bsd.prog.mk>
     93 
     94 ${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
     95 	${_MKTARGET_LINK}
     96 	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \
     97 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
     98 
     99 ${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN}
    100 	${_MKTARGET_LINK}
    101 	${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \
    102 	    -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg  ${XCOFFXTRAOBJ} \
    103 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    104 	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
    105 	    ${PROG}.mrg ${PROG}.xcf
    106 	${TOOL_MACPPCFIXCOFF} ${PROG}.xcf
    107