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