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