1 1.27 rin # $NetBSD: Makefile,v 1.27 2022/04/29 07:18:17 rin Exp $ 2 1.25 christos 3 1.25 christos .include <bsd.init.mk> 4 1.25 christos .include <bsd.sys.mk> 5 1.1 mhitch 6 1.1 mhitch ### what we need: 7 1.1 mhitch 8 1.25 christos DIR_TOP= ${.CURDIR}/../../../../.. 9 1.25 christos DIR_SA = ${DIR_TOP}/lib/libsa 10 1.25 christos DIR_KERN= ${DIR_TOP}/lib/libkern 11 1.25 christos DIR_KERN_MD= ${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH) 12 1.25 christos DIR_LIBC= ${DIR_TOP}/../common/lib/libc 13 1.10 is 14 1.10 is .PATH: ${.CURDIR}/../boot $(DIR_SA) $(DIR_KERN) $(DIR_KERN_MD) \ 15 1.10 is ${DIR_LIBC}/gen ${DIR_LIBC}/arch/m68k/gen \ 16 1.10 is ${DIR_LIBC}/inet ${DIR_LIBC}/arch/m68k/inet \ 17 1.10 is ${DIR_LIBC}/quad ${DIR_LIBC}/arch/m68k/quad \ 18 1.10 is ${DIR_LIBC}/string ${DIR_LIBC}/arch/m68k/string 19 1.1 mhitch 20 1.25 christos S= ${DIR_TOP} 21 1.1 mhitch 22 1.1 mhitch # prefer our assembler versions over assembler, and assembler over C: 23 1.1 mhitch 24 1.1 mhitch .SUFFIXES: 25 1.13 mrg .SUFFIXES: .out .o .po .pico .so .s .S .c .cc .C .f .y .l .ln .m4 .sh 26 1.1 mhitch 27 1.26 rin .ifdef BOOTXX_FFSV2 28 1.26 rin FILES= bootxx_ffsv2 29 1.26 rin FSOBJS= ffsv2.o 30 1.26 rin DEFS+= -DBOOTXX_FFS_VERSION=2 31 1.26 rin .else 32 1.26 rin FILES= bootxx_ffsv1 bootxx_fd 33 1.26 rin FSOBJS= ufs.o ustarfs.o 34 1.26 rin DEFS+= -DBOOTXX_FFS_VERSION=1 35 1.26 rin .endif 36 1.26 rin 37 1.1 mhitch BINDIR=/usr/mdec 38 1.1 mhitch 39 1.27 rin COBJS = main.o console.o xd.o bzero.o gets.o 40 1.25 christos COBJS+= lseek.o open.o vers.o read.o close.o dev.o errno.o 41 1.26 rin COBJS+= ${FSOBJS} panic.o files.o 42 1.1 mhitch 43 1.1 mhitch SOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o 44 1.1 mhitch SOBJS += strlen.o strcmp.o fstat.o 45 1.6 he SOBJS += libstubs.o memcmp.o memmove.o memset.o strncmp.o 46 1.1 mhitch 47 1.24 christos OBJS+= $(SOBJS) $(COBJS) 48 1.1 mhitch 49 1.26 rin DEFS+= -D_STANDALONE -DSA_EXEC_ANYOWNER -D_PRIMARY_BOOT -DSERCONSOLE 50 1.1 mhitch 51 1.1 mhitch .NOPATH: ${OBJS} x.out f.out libboot.a xxstart.o 52 1.1 mhitch 53 1.1 mhitch ### main target: ### 54 1.1 mhitch 55 1.20 matt realall: ${FILES} 56 1.1 mhitch 57 1.26 rin CLEANFILES += ${FILES} x.out f.out xxstart.o fdstart.o libboot.a 58 1.1 mhitch 59 1.25 christos VERSIONFILE=${.CURDIR}/../boot/version 60 1.25 christos VERSIONFLAGS+=-n 61 1.25 christos .include "${S}/conf/newvers_stand.mk" 62 1.25 christos 63 1.1 mhitch .include <bsd.prog.mk> 64 1.20 matt .include <bsd.klinks.mk> 65 1.1 mhitch 66 1.1 mhitch ### special rules for bootblocks ### 67 1.1 mhitch 68 1.24 christos INCPATH = -nostdinc -I${S} -I${S}/lib/libsa -I${.CURDIR} 69 1.1 mhitch INCPATH += -I${.CURDIR}/../boot -I${.CURDIR}/../../.. 70 1.14 mrg INCPATH += -I${.CURDIR}/../elf2bb -I${.OBJDIR} 71 1.1 mhitch 72 1.1 mhitch AFLAGS += -m68030 -l 73 1.22 martin CAFLAGS += -Wa,-l -Wa,-march=68030 -Wa,-mcpu=68030 ${INCPATH} -D_PRIMARY_BOOT 74 1.1 mhitch 75 1.19 joerg COPTIM= -Os -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks 76 1.21 mlelstv COPTIM+= -Wa,-l -m68060 -Wa,-mcpu=68030 -fno-unwind-tables 77 1.4 thorpej CFLAGS= -ffreestanding ${COPTIM} ${INCPATH} ${DEFS} -Wall #-Wstrict-prototypes 78 1.1 mhitch 79 1.8 lukem NETBSD_VERS!= ${HOST_SH} ${.CURDIR}/../../../../../conf/osrelease.sh 80 1.1 mhitch DEFS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 81 1.5 mhitch 82 1.5 mhitch # Use small daddr_t to avoid code bloat 83 1.5 mhitch DEFS+= -D__daddr_t=int32_t 84 1.1 mhitch 85 1.1 mhitch .c.o: 86 1.20 matt ${_MKTARGET_COMPILE} 87 1.1 mhitch ${CC} ${CFLAGS} -S $< -o $*.s 88 1.1 mhitch ${TXLT} < $*.s | ${AS} ${AFLAGS} -o $*.o 89 1.1 mhitch rm $*.s 90 1.1 mhitch 91 1.20 matt .s.o: 92 1.20 matt ${_MKTARGET_COMPILE} 93 1.20 matt ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $< 94 1.20 matt 95 1.20 matt .S.o: 96 1.20 matt ${_MKTARGET_COMPILE} 97 1.20 matt ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $< 98 1.1 mhitch 99 1.26 rin bootxx_ffsv1: x.out 100 1.26 rin ${_MKTARGET_CREATE} 101 1.26 rin ${RELOC2BB} x.out $@ || (${NM} -u x.out && false) 102 1.26 rin 103 1.26 rin bootxx_ffsv2: x.out 104 1.20 matt ${_MKTARGET_CREATE} 105 1.17 mrg ${RELOC2BB} x.out $@ || (${NM} -u x.out && false) 106 1.1 mhitch 107 1.1 mhitch bootxx_fd: f.out 108 1.20 matt ${_MKTARGET_CREATE} 109 1.17 mrg ${RELOC2BB} -F f.out $@ || (${NM} -u f.out && false) 110 1.1 mhitch 111 1.1 mhitch x.out: xxstart.o libboot.a 112 1.20 matt ${_MKTARGET_LINK} 113 1.20 matt ${LD} ${LDFLAGS} -r -dc -e start -o $@ $> 114 1.1 mhitch ${SIZE} $@ 115 1.1 mhitch ${NM} -u $@ 116 1.1 mhitch 117 1.1 mhitch f.out: fdstart.o libboot.a 118 1.20 matt ${_MKTARGET_LINK} 119 1.20 matt ${LD} ${LDFLAGS} -r -dc -e start -o $@ $> 120 1.1 mhitch ${SIZE} $@ 121 1.1 mhitch ${NM} -u $@ 122 1.1 mhitch 123 1.1 mhitch xxstart.o: ${.CURDIR}/../boot/bbstart.s 124 1.20 matt ${_MKTARGET_COMPILE} 125 1.1 mhitch ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \ 126 1.1 mhitch -o $@ -c $> 127 1.1 mhitch 128 1.1 mhitch fdstart.o: ${.CURDIR}/../boot//bbstart.s 129 1.20 matt ${_MKTARGET_COMPILE} 130 1.1 mhitch ${CC} -DAUTOLOAD=8192 ${CAFLAGS} ${COPTS} -x assembler-with-cpp \ 131 1.1 mhitch -o $@ -c $> 132 1.1 mhitch 133 1.1 mhitch libboot.a: ${OBJS} 134 1.20 matt ${_MKTARGET_BUILD} 135 1.20 matt ${AR} crs $@ $> && ${RANLIB} $@ 136 1.1 mhitch 137 1.1 mhitch # make sure these are built: 138 1.1 mhitch 139 1.1 mhitch ${COBJS}: ${TXLT} 140 1.1 mhitch ${FILES}: ${RELOC2BB} 141 1.2 aymeric 142 1.2 aymeric .include "${.CURDIR}/../Makefile.booters" 143