Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.47
      1 #	$NetBSD: Makefile,v 1.47 2009/01/12 07:05:22 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 CLEANFILES+=	machine powerpc
     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 .if !make(obj) && !make(clean) && !make(cleandir)
     60 .BEGIN:
     61 	@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
     62 	@[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
     63 .NOPATH: machine powerpc
     64 .endif
     65 CLEANFILES+= machine powerpc
     66 
     67 ### find out what to use for libkern
     68 KERN_AS=	library
     69 .include "${S}/lib/libkern/Makefile.inc"
     70 LIBKERN=	${KERNLIB}
     71 
     72 ### find out what to use for libz
     73 Z_AS=		library
     74 .include "${S}/lib/libz/Makefile.inc"
     75 LIBZ=		${ZLIB}
     76 
     77 ### find out what to use for libsa
     78 SA_AS=		library
     79 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
     80 .include "${S}/lib/libsa/Makefile.inc"
     81 LIBSA=		${SALIB}
     82 
     83 cleandir distclean: cleanlibdir
     84 
     85 cleanlibdir:
     86 	-rm -rf lib
     87 
     88 .PHONY: vers.c
     89 vers.c: version
     90 	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "macppc" ${NEWVERSWHAT}
     91 
     92 all realall: ${PROG} ${PROG}.xcf ${PROG}.elf
     93 
     94 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 
     95 	${_MKTARGET_LINK}
     96 	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.el1 \
     97 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
     98 	${OBJCOPY} -O binary ${PROG}.el1 ${PROG}
     99 
    100 .include <bsd.prog.mk>
    101 
    102 ${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    103 	${_MKTARGET_LINK}
    104 	${LD} -s -N -Ttext ${RELOC} -Bstatic -o ${PROG}.elf \
    105 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    106 
    107 ${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN}
    108 	${_MKTARGET_LINK}
    109 	${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \
    110 	    -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg  ${XCOFFXTRAOBJ} \
    111 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    112 	${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
    113 	    ${PROG}.mrg ${PROG}.xcf
    114 	${TOOL_MACPPCFIXCOFF} ${PROG}.xcf
    115