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