1 # $NetBSD: Makefile,v 1.1 1997/10/19 11:00:51 oki Exp $ 2 3 # Define all target-dependent utilities as macros in case of cross compilation. 4 # These definitions can be overridden by <sys.mk> 5 LD?= ld 6 AS?= as 7 NM?= nm 8 XSTRIP?=strip 9 SIZE?= size 10 11 # text and bss addresses in hex 12 TEXT= 3f0000 13 BSS= 3f2000 14 15 BOOT= xxboot 16 VERSION=0.2 17 18 SRCS= xxboot.S bootufs.c unzip.c 19 OBJS= xxboot.o bootufs.o unzip.o 20 .PATH: ${.CURDIR}/gunzip 21 22 #G=-g 23 #M=-m68020 -fall-bsr 24 CFLAGS= -O -fomit-frame-pointer -Wall $M $G -DGZIP -DBOOT=\"$(BOOT)\" 25 #LDFLAGS=-N -Bstatic -Ttext 0x$(TEXT) -Tbss 0x$(BSS) 26 LDFLAGS=-n -Bstatic -T $(TEXT) 27 #LDADD= -lc 28 29 CLEANFILES= $(BOOT) $(BOOT).x s.x x.s x.o $(BOOT)-$(VERSION){,.tar.gz} 30 31 .SUFFIXES: .S 32 33 .if 0 34 # saves about 60bytes... 35 .c.o: 36 @echo ${CC} -fall-bsr ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC} 37 @${CC} ${CFLAGS} ${CPPFLAGS} -S ${.IMPSRC} -o x.s 38 @${CC} -c -o x.o x.s 39 @${NM} x.o | ${.CURDIR}/all_bsr.sh x.s | ${AS} -o ${.TARGET} 40 @rm -f x.s x.o 41 .endif 42 43 .S.o .s.o: 44 ${CPP} ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ 45 ${AS} -o ${.TARGET} 46 47 all: $(BOOT) 48 49 $(BOOT): $(OBJS) 50 @echo loading $(BOOT) 51 @$(LD) $(LDFLAGS) -o $(BOOT).x $(OBJS) $(LDADD) 52 @if [ `(echo ibase=16; \ 53 $(NM) $(BOOT).x | sed -n 's/D _edata/-$(BSS)/p' | tr a-f A-F) |\ 54 bc` -gt 0 ];\ 55 then echo $(BOOT): text+data is too large; exit 1; fi 56 @cp $(BOOT).x s.x 57 @$(XSTRIP) s.x 58 @dd bs=32 skip=1 count=256 if=s.x of=$(BOOT) 2> /dev/null 59 @rm s.x 60 @$(SIZE) $(BOOT).x 61 62 # 63 # installation 64 # 65 ${DESTDIR}/usr/mdec/sdboot! 66 install -c -o bin -g bin -m 444 $(BOOT) ${DESTDIR}/usr/mdec/sdboot 67 68 ${DESTDIR}/usr/mdec/fdboot: ${DESTDIR}/usr/mdec/sdboot 69 rm -f ${DESTDIR}/usr/mdec/fdboot 70 ln ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/fdboot 71 72 install: ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/fdboot 73 install -c -o bin -g bin -m 755 writefdboot ${DESTDIR}/usr/mdec 74 75 # make package 76 dist: ${.CURDIR}/$(BOOT) 77 rm -f $(BOOT)-$(VERSION); ln -s ${.CURDIR} $(BOOT)-$(VERSION); \ 78 tar --exclude \*/$(BOOT)-$(VERSION)\* --exclude RCS --exclude tmp \ 79 --exclude obj --exclude obj.${MACHINE} \ 80 -czhf $(BOOT)-$(VERSION).tar.gz $(BOOT)-$(VERSION); \ 81 rm -f $(BOOT)-$(VERSION) ${.CURDIR}/$(BOOT) 82 83 ${.CURDIR}/$(BOOT): $(BOOT) 84 -ln -f $(BOOT) ${.CURDIR}/$(BOOT) 2>/dev/null 85 86 .include <bsd.prog.mk> 87