Home | History | Annotate | Line # | Download | only in ofwboot
      1 #	$NetBSD: Makefile,v 1.42 2023/06/03 21:26:28 lukem 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 # Follow the suit of Makefile.kern.inc; needed for the lfs64 union
     42 # accessors -- they don't actually dereference the resulting pointer,
     43 # just use it for type-checking.
     44 CWARNFLAGS+=	${CC_WNO_ADDRESS_OF_PACKED_MEMBER}
     45 
     46 LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
     47 
     48 NOMAN=		# defined
     49 STRIPFLAG=
     50 BINMODE=	444
     51 
     52 NEWVERSWHAT=	"OpenFirmware Boot"
     53 
     54 #
     55 # Elf64 defaults to 1MB
     56 #
     57 # We may get address conflicts with other bootloaders, say
     58 # Sun's ufsboot, so we'll pick a reasonably empty address.
     59 #
     60 RELOC=		100000
     61 
     62 ENTRY=		_start
     63 
     64 CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
     65 CPPFLAGS+=	-I${CURDIR}/../../../../../common/include
     66 CPPFLAGS+=	-DRELOC=0x${RELOC}
     67 
     68 #
     69 # XXXXX FIXME
     70 #
     71 CPPFLAGS+=	-DSPARC_BOOT_AOUT
     72 CPPFLAGS+=	-DSPARC_BOOT_ELF
     73 CPPFLAGS+=	-DSPARC_BOOT_UFS
     74 CPPFLAGS+=	-DSPARC_BOOT_NFS
     75 CPPFLAGS+=	-DSPARC_BOOT_CD9660
     76 
     77 ### find out what to use for libkern
     78 KERN_AS=	library
     79 .include "${S}/lib/libkern/Makefile.inc"
     80 LIBKERN=	${KERNLIB}
     81 
     82 ### find out what to use for libz
     83 Z_AS=		library
     84 .include "${S}/lib/libz/Makefile.inc"
     85 LIBZ=		${ZLIB}
     86 
     87 ### find out what to use for libsa
     88 SA_AS=		library
     89 SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
     90 SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
     91 .include "${S}/lib/libsa/Makefile.inc"
     92 LIBSA=		${SALIB}
     93 
     94 .include "${S}/conf/newvers_stand.mk"
     95 
     96 .include <bsd.own.mk>
     97 .include <bsd.klinks.mk>
     98 
     99 .if CROSS
    100 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    101 	${_MKTARGET_LINK}
    102 	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
    103 	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
    104 .else
    105 ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
    106 	${_MKTARGET_LINK}
    107 	${LD} -X -N -S -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
    108 	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
    109 .endif
    110 
    111 .include <bsd.prog.mk>
    112 
    113 CPUFLAGS+=		-mcpu=v9
    114 AFLAGS+=		-Wa,-Av9a
    115 AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__
    116 
    117 NORMAL_S=	${CC} ${AFLAGS} ${AFLAGS.${<:T}}  ${CPPFLAGS} -c $<
    118 srt0.o: srt0.s
    119 	${NORMAL_S}
    120 
    121 hvcall.o: hvcall.S
    122 	${NORMAL_S}
    123 
    124 
    125 # Explicit dependency for this.
    126 boot.o: boot.c
    127