Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.28
      1 #	$NetBSD: Makefile,v 1.28 2011/01/23 11:29:46 nakayama 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 isfloppy.c
     15 .PATH:		${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common
     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+=	-I${CURDIR}/../../../../../common/include
     53 CPPFLAGS+=	-DRELOC=0x${RELOC}
     54 
     55 #
     56 # XXXXX FIXME
     57 #
     58 CPPFLAGS+=	-DSPARC_BOOT_AOUT
     59 CPPFLAGS+=	-DSPARC_BOOT_ELF
     60 CPPFLAGS+=	-DSPARC_BOOT_UFS
     61 CPPFLAGS+=	-DSPARC_BOOT_NFS
     62 CPPFLAGS+=	-DSPARC_BOOT_CD9660
     63 
     64 ### find out what to use for libkern
     65 KERN_AS=	library
     66 .include "${S}/lib/libkern/Makefile.inc"
     67 LIBKERN=	${KERNLIB}
     68 
     69 ### find out what to use for libz
     70 Z_AS=		library
     71 .include "${S}/lib/libz/Makefile.inc"
     72 LIBZ=		${ZLIB}
     73 
     74 ### find out what to use for libsa
     75 SA_AS=		library
     76 SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
     77 SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
     78 .include "${S}/lib/libsa/Makefile.inc"
     79 LIBSA=		${SALIB}
     80 
     81 .if !make(obj) && !make(clean) && !make(cleandir)
     82 .BEGIN:
     83 	@([ -h machine ] || ln -s ${S}/arch/sparc64/include machine)
     84 	@([ -h sparc64 ] || ln -s ${S}/arch/sparc64/include sparc64)
     85 	@([ -h sparc ] || ln -s ${S}/arch/sparc/include sparc)
     86 .NOPATH: machine sparc64 sparc
     87 .endif
     88 CLEANFILES+= machine sparc64 sparc
     89 
     90 cleandir distclean: .WAIT cleanlibdir
     91 
     92 cleanlibdir:
     93 	-rm -rf lib
     94 
     95 .include <bsd.own.mk>
     96 
     97 vers.c: version
     98 	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
     99 	    ${CURDIR}/version "sparc64" ${NEWVERSWHAT}
    100 
    101 CLEANFILES+= vers.c
    102 
    103 .if CROSS
    104 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    105 	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
    106 	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
    107 .else
    108 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    109 	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
    110 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
    111 .endif
    112 
    113 .include <bsd.prog.mk>
    114 
    115 .if ${MACHINE_ARCH} == "sparc64"
    116 AFLAGS+=		-Wa,-Av9a
    117 CEXTRAFLAGS?=		-D_LP64
    118 .else
    119 AFLAGS+=		-Wa,-Av8plusa
    120 .endif
    121 
    122 .if CROSS
    123 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__
    124 CEXTRAFLAGS?=		-D_LP64
    125 .else
    126 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
    127 .endif
    128 
    129 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    130 srt0.o: srt0.s
    131 	${NORMAL_S}
    132 
    133 # Explicit dependency for this.
    134 boot.o: boot.c
    135