1 1.28 rin # $NetBSD: Makefile,v 1.28 2022/04/29 07:45:20 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.28 rin DEFS+= -D_STANDALONE -DSA_EXEC_ANYOWNER -DSA_HARDCODED_SECSIZE \ 50 1.28 rin -D_PRIMARY_BOOT -DSERCONSOLE 51 1.1 mhitch 52 1.1 mhitch .NOPATH: ${OBJS} x.out f.out libboot.a xxstart.o 53 1.1 mhitch 54 1.1 mhitch ### main target: ### 55 1.1 mhitch 56 1.20 matt realall: ${FILES} 57 1.1 mhitch 58 1.26 rin CLEANFILES += ${FILES} x.out f.out xxstart.o fdstart.o libboot.a 59 1.1 mhitch 60 1.25 christos VERSIONFILE=${.CURDIR}/../boot/version 61 1.25 christos VERSIONFLAGS+=-n 62 1.25 christos .include "${S}/conf/newvers_stand.mk" 63 1.25 christos 64 1.1 mhitch .include <bsd.prog.mk> 65 1.20 matt .include <bsd.klinks.mk> 66 1.1 mhitch 67 1.1 mhitch ### special rules for bootblocks ### 68 1.1 mhitch 69 1.24 christos INCPATH = -nostdinc -I${S} -I${S}/lib/libsa -I${.CURDIR} 70 1.1 mhitch INCPATH += -I${.CURDIR}/../boot -I${.CURDIR}/../../.. 71 1.14 mrg INCPATH += -I${.CURDIR}/../elf2bb -I${.OBJDIR} 72 1.1 mhitch 73 1.1 mhitch AFLAGS += -m68030 -l 74 1.22 martin CAFLAGS += -Wa,-l -Wa,-march=68030 -Wa,-mcpu=68030 ${INCPATH} -D_PRIMARY_BOOT 75 1.1 mhitch 76 1.19 joerg COPTIM= -Os -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks 77 1.21 mlelstv COPTIM+= -Wa,-l -m68060 -Wa,-mcpu=68030 -fno-unwind-tables 78 1.4 thorpej CFLAGS= -ffreestanding ${COPTIM} ${INCPATH} ${DEFS} -Wall #-Wstrict-prototypes 79 1.1 mhitch 80 1.8 lukem NETBSD_VERS!= ${HOST_SH} ${.CURDIR}/../../../../../conf/osrelease.sh 81 1.1 mhitch DEFS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 82 1.5 mhitch 83 1.5 mhitch # Use small daddr_t to avoid code bloat 84 1.5 mhitch DEFS+= -D__daddr_t=int32_t 85 1.1 mhitch 86 1.1 mhitch .c.o: 87 1.20 matt ${_MKTARGET_COMPILE} 88 1.1 mhitch ${CC} ${CFLAGS} -S $< -o $*.s 89 1.1 mhitch ${TXLT} < $*.s | ${AS} ${AFLAGS} -o $*.o 90 1.1 mhitch rm $*.s 91 1.1 mhitch 92 1.20 matt .s.o: 93 1.20 matt ${_MKTARGET_COMPILE} 94 1.20 matt ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $< 95 1.20 matt 96 1.20 matt .S.o: 97 1.20 matt ${_MKTARGET_COMPILE} 98 1.20 matt ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $< 99 1.1 mhitch 100 1.26 rin bootxx_ffsv1: x.out 101 1.26 rin ${_MKTARGET_CREATE} 102 1.26 rin ${RELOC2BB} x.out $@ || (${NM} -u x.out && false) 103 1.26 rin 104 1.26 rin bootxx_ffsv2: x.out 105 1.20 matt ${_MKTARGET_CREATE} 106 1.17 mrg ${RELOC2BB} x.out $@ || (${NM} -u x.out && false) 107 1.1 mhitch 108 1.1 mhitch bootxx_fd: f.out 109 1.20 matt ${_MKTARGET_CREATE} 110 1.17 mrg ${RELOC2BB} -F f.out $@ || (${NM} -u f.out && false) 111 1.1 mhitch 112 1.1 mhitch x.out: xxstart.o libboot.a 113 1.20 matt ${_MKTARGET_LINK} 114 1.20 matt ${LD} ${LDFLAGS} -r -dc -e start -o $@ $> 115 1.1 mhitch ${SIZE} $@ 116 1.1 mhitch ${NM} -u $@ 117 1.1 mhitch 118 1.1 mhitch f.out: fdstart.o libboot.a 119 1.20 matt ${_MKTARGET_LINK} 120 1.20 matt ${LD} ${LDFLAGS} -r -dc -e start -o $@ $> 121 1.1 mhitch ${SIZE} $@ 122 1.1 mhitch ${NM} -u $@ 123 1.1 mhitch 124 1.1 mhitch xxstart.o: ${.CURDIR}/../boot/bbstart.s 125 1.20 matt ${_MKTARGET_COMPILE} 126 1.1 mhitch ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \ 127 1.1 mhitch -o $@ -c $> 128 1.1 mhitch 129 1.1 mhitch fdstart.o: ${.CURDIR}/../boot//bbstart.s 130 1.20 matt ${_MKTARGET_COMPILE} 131 1.1 mhitch ${CC} -DAUTOLOAD=8192 ${CAFLAGS} ${COPTS} -x assembler-with-cpp \ 132 1.1 mhitch -o $@ -c $> 133 1.1 mhitch 134 1.1 mhitch libboot.a: ${OBJS} 135 1.20 matt ${_MKTARGET_BUILD} 136 1.20 matt ${AR} crs $@ $> && ${RANLIB} $@ 137 1.1 mhitch 138 1.1 mhitch # make sure these are built: 139 1.1 mhitch 140 1.1 mhitch ${COBJS}: ${TXLT} 141 1.1 mhitch ${FILES}: ${RELOC2BB} 142 1.2 aymeric 143 1.2 aymeric .include "${.CURDIR}/../Makefile.booters" 144