Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.38
      1 #	$NetBSD: Makefile,v 1.38 2017/04/08 19:53:23 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
     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 "${S}/conf/newvers_stand.mk"
     90 
     91 .include <bsd.own.mk>
     92 .include <bsd.klinks.mk>
     93 
     94 .if CROSS
     95 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
     96 	${_MKTARGET_LINK}
     97 	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
     98 	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
     99 .else
    100 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    101 	${_MKTARGET_LINK}
    102 	${LD} -X -N -S -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
    103 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
    104 .endif
    105 
    106 .include <bsd.prog.mk>
    107 
    108 CPUFLAGS+=		-mcpu=v9
    109 AFLAGS+=		-Wa,-Av9a
    110 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__
    111 
    112 NORMAL_S=	${CC} ${AFLAGS} ${AFLAGS.${<:T}}  ${CPPFLAGS} -c $<
    113 srt0.o: srt0.s
    114 	${NORMAL_S}
    115 
    116 hvcall.o: hvcall.S
    117 	${NORMAL_S}
    118 
    119 
    120 # Explicit dependency for this.
    121 boot.o: boot.c
    122