Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.32
      1 #	$NetBSD: Makefile,v 1.32 2014/01/12 15:26:31 tsutsui 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 LIBCRTI=
     24 LIBC=
     25 LIBCRTBEGIN=
     26 LIBCRTEND=
     27 
     28 COPTS+=		-ffreestanding
     29 CWARNFLAGS+=	-Wno-main
     30 CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
     31 CPPFLAGS+=	-D_STANDALONE -DSUN4U
     32 .if ${MACHINE_ARCH} == "sparc64"
     33 CPPFLAGS+=	-DSUN4V
     34 .endif
     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 -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
    107 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
    108 .endif
    109 
    110 .include <bsd.prog.mk>
    111 
    112 .if ${MACHINE_ARCH} == "sparc64"
    113 AFLAGS+=		-Wa,-Av9a
    114 CEXTRAFLAGS?=		-D_LP64
    115 .else
    116 AFLAGS+=		-Wa,-Av8plusa
    117 .endif
    118 
    119 .if CROSS
    120 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__
    121 CEXTRAFLAGS?=		-D_LP64
    122 .else
    123 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
    124 .endif
    125 
    126 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    127 srt0.o: srt0.s
    128 	${NORMAL_S}
    129 
    130 hvcall.o: hvcall.S
    131 	${NORMAL_S}
    132 
    133 
    134 # Explicit dependency for this.
    135 boot.o: boot.c
    136