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