Home | History | Annotate | Line # | Download | only in ofwboot
Makefile revision 1.13
      1 #	$NetBSD: Makefile,v 1.13 2004/07/28 01:05:35 simonb 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 .PATH:		${S}/arch/sparc64/sparc64
     15 
     16 # XXX SHOULD NOT NEED TO DEFINE THESE!
     17 LIBCRT0=
     18 LIBC=
     19 LIBCRTBEGIN=
     20 LIBCRTEND=
     21 
     22 COPTS+=		-ffreestanding
     23 CWARNFLAGS+=	-Wno-main
     24 CFLAGS+=	${COPTS} ${CEXTRAFLAGS}
     25 CPPFLAGS+=	-D_STANDALONE -DSUN4U
     26 CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64
     27 CPPFLAGS+=	-DNETBOOT
     28 #CPPFLAGS+=	-DNETIF_DEBUG 
     29 
     30 LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
     31 
     32 NOMAN=		# defined
     33 STRIPFLAG=
     34 BINMODE=	444
     35 
     36 NEWVERSWHAT=	"OpenFirmware Boot"
     37 
     38 #
     39 # Elf64 defaults to 1MB
     40 #
     41 # We may get address conflicts with other bootloaders, say
     42 # Sun's ufsboot, so we'll pick a reasonably empty address.
     43 #
     44 RELOC=		800000
     45 
     46 ENTRY=		_start
     47 
     48 CLEANFILES+=	vers.c sparc64 sparc machine
     49 
     50 CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
     51 CPPFLAGS+=	-DRELOC=0x${RELOC}
     52 
     53 #
     54 # XXXXX FIXME
     55 #
     56 CPPFLAGS+=	-DSPARC_BOOT_AOUT
     57 CPPFLAGS+=	-DSPARC_BOOT_ELF
     58 CPPFLAGS+=	-DSPARC_BOOT_UFS
     59 CPPFLAGS+=	-DSPARC_BOOT_NFS
     60 #CPPFLAGS+=	-DSPARC_BOOT_HSFS
     61 
     62 ### find out what to use for libkern
     63 KERN_AS=	library
     64 .include "${S}/lib/libkern/Makefile.inc"
     65 LIBKERN=	${KERNLIB}
     66 
     67 ### find out what to use for libz
     68 Z_AS=		library
     69 .include "${S}/lib/libz/Makefile.inc"
     70 LIBZ=		${ZLIB}
     71 
     72 ### find out what to use for libsa
     73 SA_AS=		library
     74 SAMISCMAKEFLAGS= SA_USE_CREAD=yes
     75 .include "${S}/lib/libsa/Makefile.inc"
     76 LIBSA=		${SALIB}
     77 
     78 .NOPATH: machine sparc64 sparc
     79 ${SRCS}: machine sparc64 sparc
     80 
     81 machine:
     82 	rm -f machine
     83 	ln -s sparc64 machine
     84 
     85 sparc64:
     86 	rm -f sparc64
     87 	ln -s ${.CURDIR}/../../../sparc64/include sparc64
     88 
     89 sparc:
     90 	rm -f sparc
     91 	ln -s ${.CURDIR}/../../../sparc/include sparc
     92 
     93 cleandir distclean: cleanlibdir
     94 
     95 cleanlibdir:
     96 	-rm -rf lib
     97 
     98 vers.c: version
     99 	${HOST_SH} ${S}/conf/newvers_stand.sh ${CURDIR}/version "sparc64" ${NEWVERSWHAT}
    100 
    101 .if CROSS
    102 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    103 	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
    104 	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
    105 .else
    106 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    107 	${LD} -X -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
    108 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
    109 .endif
    110 
    111 .include <bsd.prog.mk>
    112 
    113 .if ${MACHINE_ARCH} == "sparc64"
    114 AFLAGS+=		-Wa,-Av9a
    115 CEXTRAFLAGS?=		-D_LP64
    116 .else
    117 AFLAGS+=		-Wa,-Av8plusa
    118 .endif
    119 
    120 .if CROSS
    121 AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__
    122 CEXTRAFLAGS?=		-D_LP64
    123 .else
    124 AFLAGS+=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -D__ELF__ ${CEXTRAFLAGS}
    125 .endif
    126 
    127 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    128 srt0.o: srt0.s
    129 	${NORMAL_S}
    130 
    131 # Explicit dependency for this.
    132 boot.o: boot.c elfXX_exec.c
    133