1 1.8.2.1 thorpej # $NetBSD: Makefile,v 1.8.2.1 2002/01/10 19:50:40 thorpej 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.8.2.1 thorpej NOMAN= # defined 19 1.1 itohy 20 1.7 tsutsui 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.8.2.1 thorpej .include <bsd.own.mk> 26 1.8.2.1 thorpej 27 1.1 itohy CFLAGS= -O -fomit-frame-pointer 28 1.1 itohy CFLAGS+= -W -Wall -Wconversion -Wstrict-prototypes -Wmissing-prototypes 29 1.1 itohy CFLAGS+= -DTEXTADDR="0x$(TEXT)" -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\" 30 1.1 itohy CFLAGS+= -DGZIP -DSCSI_ADHOC_BOOTPART 31 1.5 minoura CFLAGS+= -DTITLE_IMAGE -DIMAGE_EXTRA=100 32 1.1 itohy #CFLAGS+= -DBOOT_DEBUG 33 1.1 itohy AFLAGS= ${CFLAGS:M-[ID]*} 34 1.8 minoura LDFLAGS=-N -Bstatic -Ttext $(TEXT) -e top 35 1.8.2.1 thorpej .if ${OBJECT_FMT} == "ELF" 36 1.8.2.1 thorpej LDFLAGS+= -noinhibit-exec # XXX 37 1.8.2.1 thorpej .endif 38 1.1 itohy #LDADD= -lc 39 1.1 itohy 40 1.1 itohy CLEANFILES= $(BOOT).x s.x x.s x.o 41 1.1 itohy CLEANFILES+= ej2sjesc.lo ej2sjesc *.o.c *.o.s *.o.o 42 1.1 itohy 43 1.1 itohy .c.o: 44 1.1 itohy ./ej2sjesc ${.IMPSRC} ${.TARGET}.c 45 1.1 itohy @echo '${CC} -fall-bsr ${CFLAGS} ${CPPFLAGS} -o ${.TARGET} -c ${.TARGET}.c' 46 1.1 itohy @${CC} ${CFLAGS} ${CPPFLAGS} -S ${.TARGET}.c -o ${.TARGET}.s 47 1.1 itohy @${CC} -c -o ${.TARGET}.o ${.TARGET}.s 48 1.1 itohy @${NM} ${.TARGET}.o | ${.CURDIR}/all_bsr.sh ${.TARGET}.s | ${AS} -o ${.TARGET} 49 1.1 itohy @rm -f ${.TARGET}.c ${.TARGET}.s ${.TARGET}.o 50 1.1 itohy 51 1.1 itohy $(BOOT): $(OBJS) 52 1.1 itohy $(LD) $(LDFLAGS) -o $(BOOT).x $(OBJS) $(LDADD) 53 1.1 itohy @$(NM) $(BOOT).x | sed -n '/T first_kbyte/p' 54 1.1 itohy @if [ `(echo ibase=16; \ 55 1.1 itohy $(NM) $(BOOT).x | sed -n 's/T first_kbyte/-$(TEXT)-400/p' | \ 56 1.1 itohy tr a-f A-F) | bc` -gt 0 ];\ 57 1.1 itohy then echo '$(BOOT): first_kbyte exceeds the first killobyte'; exit 1; fi 58 1.1 itohy @$(SIZE) $(BOOT).x 59 1.1 itohy @if [ `(echo ibase=16; \ 60 1.8.2.1 thorpej $(NM) $(BOOT).x | sed -n 's/[AD] _edata/-$(BSS)/p' | tr a-f A-F) |\ 61 1.1 itohy bc` -gt 0 ];\ 62 1.1 itohy then echo '$(BOOT): text+data is too large'; exit 1; fi 63 1.1 itohy @cp $(BOOT).x s.x 64 1.7 tsutsui @$(STRIP) s.x 65 1.8 minoura @$(OBJCOPY) -O binary s.x $(BOOT) 66 1.1 itohy @rm s.x 67 1.1 itohy 68 1.1 itohy bootufs.o unzip.o: ej2sjesc 69 1.1 itohy 70 1.1 itohy # helper program running on the host 71 1.1 itohy ej2sjesc: ej2sjesc.lo 72 1.1 itohy ${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC} 73 1.1 itohy 74 1.1 itohy .include <bsd.prog.mk> 75