Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.20
      1 #	$NetBSD: Makefile,v 1.20 2007/09/29 21:43:52 martin Exp $
      2 
      3 CURDIR=	${.CURDIR}
      4 S=	${CURDIR}/../../../..
      5 
      6 #
      7 # Override normal settings
      8 #
      9 
     10 WARNS=		0
     11 
     12 PROG?=		ofwboot
     13 SRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c vers.c
     14 SRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c
     15 .PATH:		${S}/arch/sparc64/sparc64
     16 
     17 # XXX SHOULD NOT NEED TO DEFINE THESE!
     18 LIBCRT0=
     19 LIBC=
     20 LIBCRTBEGIN=
     21 LIBCRTEND=
     22 
     23 COPTS+=		-ffreestanding
     24 CWARNFLAGS+=	-Wno-main
     25 CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
     26 CPPFLAGS+=	-D_STANDALONE -DSUN4U
     27 CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
     28 CPPFLAGS+=	-DNETBOOT
     29 CPPFLAGS+=	-DSUPPORT_DHCP
     30 #CPPFLAGS+=	-DNETIF_DEBUG 
     31 #CPPFLAGS+=	-D_DEBUG
     32 
     33 LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
     34 
     35 NOMAN=		# defined
     36 STRIPFLAG=
     37 BINMODE=	444
     38 
     39 NEWVERSWHAT=	"OpenFirmware Boot"
     40 
     41 #
     42 # Elf64 defaults to 1MB
     43 #
     44 # We may get address conflicts with other bootloaders, say
     45 # Sun's ufsboot, so we'll pick a reasonably empty address.
     46 #
     47 RELOC=		100000
     48 
     49 ENTRY=		_start
     50 
     51 CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
     52 CPPFLAGS+=	-DRELOC=0x${RELOC}
     53 
     54 #
     55 # XXXXX FIXME
     56 #
     57 CPPFLAGS+=	-DSPARC_BOOT_AOUT
     58 CPPFLAGS+=	-DSPARC_BOOT_ELF
     59 CPPFLAGS+=	-DSPARC_BOOT_UFS
     60 CPPFLAGS+=	-DSPARC_BOOT_NFS
     61 #CPPFLAGS+=	-DSPARC_BOOT_CD9660
     62 
     63 ### find out what to use for libkern
     64 KERN_AS=	library
     65 .include "${S}/lib/libkern/Makefile.inc"
     66 LIBKERN=	${KERNLIB}
     67 
     68 ### find out what to use for libz
     69 Z_AS=		library
     70 .include "${S}/lib/libz/Makefile.inc"
     71 LIBZ=		${ZLIB}
     72 
     73 ### find out what to use for libsa
     74 SA_AS=		library
     75 SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
     76 SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
     77 .include "${S}/lib/libsa/Makefile.inc"
     78 LIBSA=		${SALIB}
     79 
     80 .if !make(obj) && !make(clean) && !make(cleandir)
     81 .BEGIN:
     82 	@([ -h machine ] || ln -s ${S}/arch/sparc64/include machine)
     83 	@([ -h sparc64 ] || ln -s ${S}/arch/sparc64/include sparc64)
     84 	@([ -h sparc ] || ln -s ${S}/arch/sparc/include sparc)
     85 .NOPATH: machine sparc64 sparc
     86 .endif
     87 CLEANFILES+= machine sparc64 sparc
     88 
     89 cleandir distclean: cleanlibdir
     90 
     91 cleanlibdir:
     92 	-rm -rf lib
     93 
     94 vers.c: version
     95 	${HOST_SH} ${S}/conf/newvers_stand.sh ${CURDIR}/version "sparc64" ${NEWVERSWHAT}
     96 
     97 CLEANFILES+= vers.c
     98 
     99 .if CROSS
    100 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    101 	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
    102 	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
    103 .else
    104 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    105 	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
    106 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
    107 .endif
    108 
    109 .include <bsd.prog.mk>
    110 
    111 .if ${MACHINE_ARCH} == "sparc64"
    112 AFLAGS+=		-Wa,-Av9a
    113 CEXTRAFLAGS?=		-D_LP64
    114 .else
    115 AFLAGS+=		-Wa,-Av8plusa
    116 .endif
    117 
    118 .if CROSS
    119 AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__
    120 CEXTRAFLAGS?=		-D_LP64
    121 .else
    122 AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
    123 .endif
    124 
    125 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    126 srt0.o: srt0.s
    127 	${NORMAL_S}
    128 
    129 # Explicit dependency for this.
    130 boot.o: boot.c
    131