Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.27
      1 #	$NetBSD: Makefile,v 1.27 2011/01/22 19:19:24 joerg Exp $
      2 
      3 CURDIR=	${.CURDIR}
      4 S=	${CURDIR}/../../../..
      5 
      6 .include <bsd.own.mk>
      7 
      8 #
      9 # Override normal settings
     10 #
     11 
     12 WARNS=		0
     13 
     14 PROG?=		ofwboot
     15 SRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c vers.c
     16 SRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c
     17 .PATH:		${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common
     18 
     19 # XXX SHOULD NOT NEED TO DEFINE THESE!
     20 LIBCRT0=
     21 LIBC=
     22 LIBCRTBEGIN=
     23 LIBCRTEND=
     24 
     25 COPTS+=		-ffreestanding
     26 CWARNFLAGS+=	-Wno-main
     27 CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
     28 CPPFLAGS+=	-D_STANDALONE -DSUN4U
     29 CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
     30 CPPFLAGS+=	-DNETBOOT
     31 CPPFLAGS+=	-DSUPPORT_DHCP
     32 #CPPFLAGS+=	-DNETIF_DEBUG 
     33 #CPPFLAGS+=	-D_DEBUG
     34 
     35 LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
     36 
     37 NOMAN=		# defined
     38 STRIPFLAG=
     39 BINMODE=	444
     40 
     41 NEWVERSWHAT=	"OpenFirmware Boot"
     42 
     43 #
     44 # Elf64 defaults to 1MB
     45 #
     46 # We may get address conflicts with other bootloaders, say
     47 # Sun's ufsboot, so we'll pick a reasonably empty address.
     48 #
     49 RELOC=		100000
     50 
     51 ENTRY=		_start
     52 
     53 CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
     54 CPPFLAGS+=	-I${CURDIR}/../../../../../common/include
     55 CPPFLAGS+=	-DRELOC=0x${RELOC}
     56 
     57 #
     58 # XXXXX FIXME
     59 #
     60 CPPFLAGS+=	-DSPARC_BOOT_AOUT
     61 CPPFLAGS+=	-DSPARC_BOOT_ELF
     62 CPPFLAGS+=	-DSPARC_BOOT_UFS
     63 CPPFLAGS+=	-DSPARC_BOOT_NFS
     64 CPPFLAGS+=	-DSPARC_BOOT_CD9660
     65 
     66 ### find out what to use for libkern
     67 KERN_AS=	library
     68 .include "${S}/lib/libkern/Makefile.inc"
     69 LIBKERN=	${KERNLIB}
     70 
     71 ### find out what to use for libz
     72 Z_AS=		library
     73 .include "${S}/lib/libz/Makefile.inc"
     74 LIBZ=		${ZLIB}
     75 
     76 ### find out what to use for libsa
     77 SA_AS=		library
     78 SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
     79 SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
     80 .include "${S}/lib/libsa/Makefile.inc"
     81 LIBSA=		${SALIB}
     82 
     83 .if !make(obj) && !make(clean) && !make(cleandir)
     84 .BEGIN:
     85 	@([ -h machine ] || ln -s ${S}/arch/sparc64/include machine)
     86 	@([ -h sparc64 ] || ln -s ${S}/arch/sparc64/include sparc64)
     87 	@([ -h sparc ] || ln -s ${S}/arch/sparc/include sparc)
     88 .NOPATH: machine sparc64 sparc
     89 .endif
     90 CLEANFILES+= machine sparc64 sparc
     91 
     92 cleandir distclean: .WAIT cleanlibdir
     93 
     94 cleanlibdir:
     95 	-rm -rf lib
     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