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