1# $NetBSD: Makefile,v 1.42 2023/06/03 21:26:28 lukem Exp $ 2 3.include <bsd.init.mk> 4 5CURDIR= ${.CURDIR} 6S= ${CURDIR}/../../../.. 7 8# 9# Override normal settings 10# 11 12WARNS?= 2 13KLINK_MACHINE= sparc64 14 15PROG?= ofwboot 16SRCS= srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c 17SRCS+= bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c 18.if ${MACHINE_ARCH} == "sparc64" 19SRCS+= hvcall.S 20CPPFLAGS+= -DSUN4V 21.endif 22.PATH: ${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common 23 24# XXX SHOULD NOT NEED TO DEFINE THESE! 25LIBCRT0= 26LIBCRTI= 27LIBC= 28LIBCRTBEGIN= 29LIBCRTEND= 30 31COPTS+= -ffreestanding -mcpu=v9 32CWARNFLAGS+= -Wno-main 33CFLAGS+= ${COPTS} 34CPPFLAGS+= -D_STANDALONE 35CPPFLAGS+= -DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT 36CPPFLAGS+= -DNETBOOT 37CPPFLAGS+= -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. 44CWARNFLAGS+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER} 45 46LINKS+= ${BINDIR}/ofwboot ${BINDIR}/ofwboot.net 47 48NOMAN= # defined 49STRIPFLAG= 50BINMODE= 444 51 52NEWVERSWHAT= "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# 60RELOC= 100000 61 62ENTRY= _start 63 64CPPFLAGS+= -I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I. 65CPPFLAGS+= -I${CURDIR}/../../../../../common/include 66CPPFLAGS+= -DRELOC=0x${RELOC} 67 68# 69# XXXXX FIXME 70# 71CPPFLAGS+= -DSPARC_BOOT_AOUT 72CPPFLAGS+= -DSPARC_BOOT_ELF 73CPPFLAGS+= -DSPARC_BOOT_UFS 74CPPFLAGS+= -DSPARC_BOOT_NFS 75CPPFLAGS+= -DSPARC_BOOT_CD9660 76 77### find out what to use for libkern 78KERN_AS= library 79.include "${S}/lib/libkern/Makefile.inc" 80LIBKERN= ${KERNLIB} 81 82### find out what to use for libz 83Z_AS= library 84.include "${S}/lib/libz/Makefile.inc" 85LIBZ= ${ZLIB} 86 87### find out what to use for libsa 88SA_AS= library 89SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes 90SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS 91.include "${S}/lib/libsa/Makefile.inc" 92LIBSA= ${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 113CPUFLAGS+= -mcpu=v9 114AFLAGS+= -Wa,-Av9a 115AFLAGS+= -x assembler-with-cpp -D_LOCORE -D__ELF__ 116 117NORMAL_S= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< 118srt0.o: srt0.s 119 ${NORMAL_S} 120 121hvcall.o: hvcall.S 122 ${NORMAL_S} 123 124 125# Explicit dependency for this. 126boot.o: boot.c 127