Makefile revision 1.1
11.1Soki#	$NetBSD: Makefile,v 1.1 1997/10/19 11:00:51 oki Exp $
21.1Soki
31.1Soki# Define all target-dependent utilities as macros in case of cross compilation.
41.1Soki# These definitions can be overridden by  <sys.mk>
51.1SokiLD?=	ld
61.1SokiAS?=	as
71.1SokiNM?=	nm
81.1SokiXSTRIP?=strip
91.1SokiSIZE?=	size
101.1Soki
111.1Soki# text and bss addresses in hex
121.1SokiTEXT=	3f0000
131.1SokiBSS=	3f2000
141.1Soki
151.1SokiBOOT=	xxboot
161.1SokiVERSION=0.2
171.1Soki
181.1SokiSRCS=	xxboot.S bootufs.c unzip.c
191.1SokiOBJS=	xxboot.o bootufs.o unzip.o
201.1Soki.PATH:  ${.CURDIR}/gunzip
211.1Soki
221.1Soki#G=-g
231.1Soki#M=-m68020 -fall-bsr
241.1SokiCFLAGS=	-O -fomit-frame-pointer -Wall $M $G -DGZIP -DBOOT=\"$(BOOT)\"
251.1Soki#LDFLAGS=-N -Bstatic -Ttext 0x$(TEXT) -Tbss 0x$(BSS)
261.1SokiLDFLAGS=-n -Bstatic -T $(TEXT)
271.1Soki#LDADD=	-lc
281.1Soki
291.1SokiCLEANFILES=	$(BOOT) $(BOOT).x s.x x.s x.o $(BOOT)-$(VERSION){,.tar.gz}
301.1Soki
311.1Soki.SUFFIXES: .S
321.1Soki
331.1Soki.if 0
341.1Soki# saves about 60bytes...
351.1Soki.c.o:
361.1Soki	@echo ${CC} -fall-bsr ${CFLAGS} ${CPPFLAGS} -c ${.IMPSRC}
371.1Soki	@${CC} ${CFLAGS} ${CPPFLAGS} -S ${.IMPSRC} -o x.s
381.1Soki	@${CC} -c -o x.o x.s
391.1Soki	@${NM} x.o | ${.CURDIR}/all_bsr.sh x.s | ${AS} -o ${.TARGET}
401.1Soki	@rm -f x.s x.o
411.1Soki.endif
421.1Soki
431.1Soki.S.o .s.o:
441.1Soki	${CPP} ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
451.1Soki		${AS} -o ${.TARGET}
461.1Soki
471.1Sokiall: $(BOOT)
481.1Soki
491.1Soki$(BOOT): $(OBJS)
501.1Soki	@echo loading $(BOOT)
511.1Soki	@$(LD) $(LDFLAGS) -o $(BOOT).x $(OBJS) $(LDADD)
521.1Soki	@if [ `(echo ibase=16; \
531.1Soki		$(NM) $(BOOT).x | sed -n 's/D _edata/-$(BSS)/p' | tr a-f A-F) |\
541.1Soki			bc` -gt 0 ];\
551.1Soki	then	echo $(BOOT): text+data is too large; exit 1; fi
561.1Soki	@cp $(BOOT).x s.x
571.1Soki	@$(XSTRIP) s.x
581.1Soki	@dd bs=32 skip=1 count=256 if=s.x of=$(BOOT) 2> /dev/null
591.1Soki	@rm s.x
601.1Soki	@$(SIZE) $(BOOT).x
611.1Soki
621.1Soki#
631.1Soki# installation
641.1Soki#
651.1Soki${DESTDIR}/usr/mdec/sdboot!
661.1Soki	install -c -o bin -g bin -m 444 $(BOOT) ${DESTDIR}/usr/mdec/sdboot
671.1Soki
681.1Soki${DESTDIR}/usr/mdec/fdboot:	${DESTDIR}/usr/mdec/sdboot
691.1Soki	rm -f ${DESTDIR}/usr/mdec/fdboot
701.1Soki	ln ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/fdboot
711.1Soki
721.1Sokiinstall: ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/fdboot
731.1Soki	install -c -o bin -g bin -m 755 writefdboot ${DESTDIR}/usr/mdec
741.1Soki
751.1Soki# make package
761.1Sokidist: ${.CURDIR}/$(BOOT)
771.1Soki	rm -f $(BOOT)-$(VERSION); ln -s ${.CURDIR} $(BOOT)-$(VERSION); \
781.1Soki	tar --exclude \*/$(BOOT)-$(VERSION)\* --exclude RCS --exclude tmp \
791.1Soki		--exclude obj --exclude obj.${MACHINE} \
801.1Soki		-czhf $(BOOT)-$(VERSION).tar.gz $(BOOT)-$(VERSION); \
811.1Soki	rm -f $(BOOT)-$(VERSION) ${.CURDIR}/$(BOOT)
821.1Soki
831.1Soki${.CURDIR}/$(BOOT): $(BOOT)
841.1Soki	-ln -f $(BOOT) ${.CURDIR}/$(BOOT)	2>/dev/null
851.1Soki
861.1Soki.include <bsd.prog.mk>
87