1# $NetBSD: Makefile,v 1.36 2015/10/26 07:11:33 mrg Exp $ 2 3CURDIR= ${.CURDIR} 4S= ${CURDIR}/../../../.. 5 6# 7# Override normal settings 8# 9 10WARNS?= 2 11KLINK_MACHINE= sparc64 12 13PROG?= ofwboot 14SRCS= srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c vers.c 15SRCS+= bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c 16.if ${MACHINE_ARCH} == "sparc64" 17SRCS+= hvcall.S 18CPPFLAGS+= -DSUN4V 19.endif 20.PATH: ${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common 21 22# XXX SHOULD NOT NEED TO DEFINE THESE! 23LIBCRT0= 24LIBCRTI= 25LIBC= 26LIBCRTBEGIN= 27LIBCRTEND= 28 29COPTS+= -ffreestanding -mcpu=v9 30CWARNFLAGS+= -Wno-main 31CFLAGS+= ${COPTS} 32CPPFLAGS+= -D_STANDALONE 33CPPFLAGS+= -DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT 34CPPFLAGS+= -DNETBOOT 35CPPFLAGS+= -DSUPPORT_DHCP 36#CPPFLAGS+= -DNETIF_DEBUG 37#CPPFLAGS+= -D_DEBUG 38 39LINKS+= ${BINDIR}/ofwboot ${BINDIR}/ofwboot.net 40 41NOMAN= # defined 42STRIPFLAG= 43BINMODE= 444 44 45NEWVERSWHAT= "OpenFirmware Boot" 46 47# 48# Elf64 defaults to 1MB 49# 50# We may get address conflicts with other bootloaders, say 51# Sun's ufsboot, so we'll pick a reasonably empty address. 52# 53RELOC= 100000 54 55ENTRY= _start 56 57CPPFLAGS+= -I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I. 58CPPFLAGS+= -I${CURDIR}/../../../../../common/include 59CPPFLAGS+= -DRELOC=0x${RELOC} 60 61# 62# XXXXX FIXME 63# 64CPPFLAGS+= -DSPARC_BOOT_AOUT 65CPPFLAGS+= -DSPARC_BOOT_ELF 66CPPFLAGS+= -DSPARC_BOOT_UFS 67CPPFLAGS+= -DSPARC_BOOT_NFS 68CPPFLAGS+= -DSPARC_BOOT_CD9660 69 70### find out what to use for libkern 71KERN_AS= library 72.include "${S}/lib/libkern/Makefile.inc" 73LIBKERN= ${KERNLIB} 74 75### find out what to use for libz 76Z_AS= library 77.include "${S}/lib/libz/Makefile.inc" 78LIBZ= ${ZLIB} 79 80### find out what to use for libsa 81SA_AS= library 82SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes 83SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS 84.include "${S}/lib/libsa/Makefile.inc" 85LIBSA= ${SALIB} 86 87.include <bsd.own.mk> 88.include <bsd.klinks.mk> 89 90vers.c: version 91 ${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \ 92 ${CURDIR}/version "sparc64" ${NEWVERSWHAT} 93 94CLEANFILES+= vers.c 95 96.if CROSS 97${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 98 ${_MKTARGET_LINK} 99 ${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \ 100 ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker 101.else 102${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} 103 ${_MKTARGET_LINK} 104 ${LD} -X -N -S -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \ 105 ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} # native linker 106.endif 107 108.include <bsd.prog.mk> 109 110CPUFLAGS+= -mcpu=v9 111AFLAGS+= -Wa,-Av9a 112AFLAGS+= -x assembler-with-cpp -D_LOCORE -D__ELF__ 113 114NORMAL_S= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< 115srt0.o: srt0.s 116 ${NORMAL_S} 117 118hvcall.o: hvcall.S 119 ${NORMAL_S} 120 121 122# Explicit dependency for this. 123boot.o: boot.c 124