1 # $NetBSD: Makefile,v 1.7 2003/10/25 03:14:33 mhitch Exp $ 2 3 ### what we need: 4 5 DIR_TOP= ${.CURDIR}/../../../../.. 6 DIR_SA = ${DIR_TOP}/lib/libsa 7 DIR_KERN= ${DIR_TOP}/lib/libkern 8 DIR_KERN_MD= ${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH) 9 10 .PATH: ${.CURDIR}/../boot $(DIR_SA) $(DIR_KERN) $(DIR_KERN_MD) 11 12 # prefer our assembler versions over assembler, and assembler over C: 13 14 .SUFFIXES: 15 .SUFFIXES: .out .o .po .so .s .S .c .cc .C .f .y .l .ln .m4 .sh 16 17 FILES= bootxx_ffs bootxx_fd 18 BINDIR=/usr/mdec 19 20 COBJS = main.o console.o xd.o twiddle.o bzero.o gets.o 21 COBJS+= lseek.o open.o read.o close.o dev.o errno.o 22 COBJS+= ufs.o ustarfs.o panic.o vers.o files.o 23 24 SOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o 25 SOBJS += strlen.o strcmp.o fstat.o 26 SOBJS += libstubs.o memcmp.o memmove.o memset.o strncmp.o 27 28 OBJS= $(SOBJS) $(COBJS) 29 30 DEFS = -D_STANDALONE -DINSECURE -D_PRIMARY_BOOT 31 32 .NOPATH: ${OBJS} x.out f.out libboot.a xxstart.o 33 34 ### main target: ### 35 36 realall: machine m68k ${FILES} 37 38 CLEANFILES += bootxx_ffs bootxx_fd x.out f.out xxstart.o fdstart.o libboot.a vers.c machine m68k 39 40 .include <bsd.prog.mk> 41 42 ### special rules for bootblocks ### 43 44 INCPATH = -nostdinc -I${DIR_TOP} -I${DIR_TOP}/lib/libsa -I${.CURDIR} 45 INCPATH += -I${.CURDIR}/../boot -I${.CURDIR}/../../.. 46 INCPATH += -I${.CURDIR}/../aout2bb -I$(.CURDIR) -I${DESTDIR}/usr/include 47 48 AFLAGS += -m68030 -l 49 CAFLAGS += -Wa,-l -Wa,-m68030 ${INCPATH} -D_PRIMARY_BOOT 50 51 COPTIM= -Os -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks -Wa,-l -m68060 -Wa,-m68030 52 CFLAGS= -ffreestanding ${COPTIM} ${INCPATH} ${DEFS} -Wall #-Wstrict-prototypes 53 54 NETBSD_VERS!= sh ${.CURDIR}/../../../../../conf/osrelease.sh 55 DEFS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 56 57 # Use small daddr_t to avoid code bloat 58 DEFS+= -D__daddr_t=int32_t 59 60 .c.o: 61 ${CC} ${CFLAGS} -S $< -o $*.s 62 ${TXLT} < $*.s | ${AS} ${AFLAGS} -o $*.o 63 rm $*.s 64 65 .s.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $< 66 67 .S.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $< 68 69 bootxx_ffs: x.out 70 ${RELOC2BB} x.out $@ || ${NM} -u x.out 71 72 bootxx_fd: f.out 73 ${RELOC2BB} -F f.out $@ || ${NM} -u f.out 74 75 x.out: xxstart.o libboot.a 76 ${LD} ${LDFLAGS} -r -dc -e _start -o $@ $> 77 ${SIZE} $@ 78 ${NM} -u $@ 79 80 f.out: fdstart.o libboot.a 81 ${LD} ${LDFLAGS} -r -dc -e _start -o $@ $> 82 ${SIZE} $@ 83 ${NM} -u $@ 84 85 xxstart.o: ${.CURDIR}/../boot/bbstart.s 86 ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \ 87 -o $@ -c $> 88 89 fdstart.o: ${.CURDIR}/../boot//bbstart.s 90 ${CC} -DAUTOLOAD=8192 ${CAFLAGS} ${COPTS} -x assembler-with-cpp \ 91 -o $@ -c $> 92 93 libboot.a: ${OBJS} 94 ${AR} r $@ $> && ${RANLIB} $@ 95 96 .PHONY: vers.c 97 vers.c: ${.CURDIR}/../boot/version 98 sh ${DIR_TOP}/conf/newvers_stand.sh -NDM ${.CURDIR}/../boot/version "amiga" 99 100 machine: 101 -rm -f $@ 102 ln -s ${DIR_TOP}/arch/amiga/include $@ 103 104 m68k: 105 -rm -f $@ 106 ln -s ${DIR_TOP}/arch/m68k/include $@ 107 108 # make sure these are built: 109 110 ${COBJS}: ${TXLT} 111 ${FILES}: ${RELOC2BB} 112 113 .include "${.CURDIR}/../Makefile.booters" 114