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