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