1 1.1 itohy # $NetBSD: Makefile,v 1.1 1998/09/01 20:02:32 itohy Exp $ 2 1.1 itohy 3 1.1 itohy BOOT= xxboot 4 1.1 itohy VERSION=0.3 5 1.1 itohy 6 1.1 itohy # text and bss addresses in hex 7 1.1 itohy TEXT= 3f0000 8 1.1 itohy BSS= 3f2000 9 1.1 itohy 10 1.1 itohy PROG= $(BOOT) 11 1.1 itohy BINDIR= /usr/mdec 12 1.1 itohy PROGNAME= sdboot 13 1.1 itohy LINKS= ${BINDIR}/sdboot ${BINDIR}/fdboot 14 1.1 itohy STRIPFLAG= 15 1.1 itohy BINMODE= 444 16 1.1 itohy SCRIPTSMODE= 555 17 1.1 itohy SCRIPTS= installboot.sh 18 1.1 itohy NOMAN= noman 19 1.1 itohy 20 1.1 itohy STRIP?= strip 21 1.1 itohy 22 1.1 itohy SRCS= xxboot.S bootufs.c unzip.c 23 1.1 itohy .PATH: ${.CURDIR}/gunzip 24 1.1 itohy 25 1.1 itohy CFLAGS= -O -fomit-frame-pointer 26 1.1 itohy CFLAGS+= -W -Wall -Wconversion -Wstrict-prototypes -Wmissing-prototypes 27 1.1 itohy CFLAGS+= -DTEXTADDR="0x$(TEXT)" -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\" 28 1.1 itohy CFLAGS+= -DGZIP -DSCSI_ADHOC_BOOTPART 29 1.1 itohy CFLAGS+= -DTITLE_IMAGE -DIMAGE_EXTRA=100 30 1.1 itohy #CFLAGS+= -DBOOT_DEBUG 31 1.1 itohy AFLAGS= ${CFLAGS:M-[ID]*} 32 1.1 itohy LDFLAGS=-n -Bstatic -T $(TEXT) 33 1.1 itohy #LDADD= -lc 34 1.1 itohy 35 1.1 itohy CLEANFILES= $(BOOT).x s.x x.s x.o 36 1.1 itohy CLEANFILES+= ej2sjesc.lo ej2sjesc *.o.c *.o.s *.o.o 37 1.1 itohy 38 1.1 itohy .c.o: 39 1.1 itohy ./ej2sjesc ${.IMPSRC} ${.TARGET}.c 40 1.1 itohy @echo '${CC} -fall-bsr ${CFLAGS} ${CPPFLAGS} -o ${.TARGET} -c ${.TARGET}.c' 41 1.1 itohy @${CC} ${CFLAGS} ${CPPFLAGS} -S ${.TARGET}.c -o ${.TARGET}.s 42 1.1 itohy @${CC} -c -o ${.TARGET}.o ${.TARGET}.s 43 1.1 itohy @${NM} ${.TARGET}.o | ${.CURDIR}/all_bsr.sh ${.TARGET}.s | ${AS} -o ${.TARGET} 44 1.1 itohy @rm -f ${.TARGET}.c ${.TARGET}.s ${.TARGET}.o 45 1.1 itohy 46 1.1 itohy $(BOOT): $(OBJS) 47 1.1 itohy $(LD) $(LDFLAGS) -o $(BOOT).x $(OBJS) $(LDADD) 48 1.1 itohy @$(NM) $(BOOT).x | sed -n '/T first_kbyte/p' 49 1.1 itohy @if [ `(echo ibase=16; \ 50 1.1 itohy $(NM) $(BOOT).x | sed -n 's/T first_kbyte/-$(TEXT)-400/p' | \ 51 1.1 itohy tr a-f A-F) | bc` -gt 0 ];\ 52 1.1 itohy then echo '$(BOOT): first_kbyte exceeds the first killobyte'; exit 1; fi 53 1.1 itohy @$(SIZE) $(BOOT).x 54 1.1 itohy @if [ `(echo ibase=16; \ 55 1.1 itohy $(NM) $(BOOT).x | sed -n 's/D _edata/-$(BSS)/p' | tr a-f A-F) |\ 56 1.1 itohy bc` -gt 0 ];\ 57 1.1 itohy then echo '$(BOOT): text+data is too large'; exit 1; fi 58 1.1 itohy @cp $(BOOT).x s.x 59 1.1 itohy @$(STRIP) s.x 60 1.1 itohy @dd bs=32 skip=1 count=256 if=s.x of=$(BOOT) 2>/dev/null 61 1.1 itohy @rm s.x 62 1.1 itohy 63 1.1 itohy bootufs.o unzip.o: ej2sjesc 64 1.1 itohy 65 1.1 itohy # helper program running on the host 66 1.1 itohy ej2sjesc: ej2sjesc.lo 67 1.1 itohy ${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} 68 1.1 itohy 69 1.1 itohy .include <bsd.prog.mk> 70