Makefile revision 1.1
11.1Sitohy#	$NetBSD: Makefile,v 1.1 1998/09/01 20:02:32 itohy Exp $
21.1Sitohy
31.1SitohyBOOT=	xxboot
41.1SitohyVERSION=0.3
51.1Sitohy
61.1Sitohy# text and bss addresses in hex
71.1SitohyTEXT=	3f0000
81.1SitohyBSS=	3f2000
91.1Sitohy
101.1SitohyPROG=		$(BOOT)
111.1SitohyBINDIR=		/usr/mdec
121.1SitohyPROGNAME=	sdboot
131.1SitohyLINKS=		${BINDIR}/sdboot ${BINDIR}/fdboot
141.1SitohySTRIPFLAG=
151.1SitohyBINMODE=	444
161.1SitohySCRIPTSMODE=	555
171.1SitohySCRIPTS=	installboot.sh
181.1SitohyNOMAN=		noman
191.1Sitohy
201.1SitohySTRIP?=	strip
211.1Sitohy
221.1SitohySRCS=	xxboot.S bootufs.c unzip.c
231.1Sitohy.PATH:	${.CURDIR}/gunzip
241.1Sitohy
251.1SitohyCFLAGS=	-O -fomit-frame-pointer
261.1SitohyCFLAGS+= -W -Wall -Wconversion -Wstrict-prototypes -Wmissing-prototypes
271.1SitohyCFLAGS+= -DTEXTADDR="0x$(TEXT)" -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\"
281.1SitohyCFLAGS+= -DGZIP -DSCSI_ADHOC_BOOTPART
291.1SitohyCFLAGS+= -DTITLE_IMAGE -DIMAGE_EXTRA=100
301.1Sitohy#CFLAGS+= -DBOOT_DEBUG
311.1SitohyAFLAGS=	${CFLAGS:M-[ID]*}
321.1SitohyLDFLAGS=-n -Bstatic -T $(TEXT)
331.1Sitohy#LDADD=	-lc
341.1Sitohy
351.1SitohyCLEANFILES=	$(BOOT).x s.x x.s x.o
361.1SitohyCLEANFILES+=	ej2sjesc.lo ej2sjesc *.o.c *.o.s *.o.o
371.1Sitohy
381.1Sitohy.c.o:
391.1Sitohy	./ej2sjesc ${.IMPSRC} ${.TARGET}.c
401.1Sitohy	@echo '${CC} -fall-bsr ${CFLAGS} ${CPPFLAGS} -o ${.TARGET} -c ${.TARGET}.c'
411.1Sitohy	@${CC} ${CFLAGS} ${CPPFLAGS} -S ${.TARGET}.c -o ${.TARGET}.s
421.1Sitohy	@${CC} -c -o ${.TARGET}.o ${.TARGET}.s
431.1Sitohy	@${NM} ${.TARGET}.o | ${.CURDIR}/all_bsr.sh ${.TARGET}.s | ${AS} -o ${.TARGET}
441.1Sitohy	@rm -f ${.TARGET}.c ${.TARGET}.s ${.TARGET}.o
451.1Sitohy
461.1Sitohy$(BOOT): $(OBJS)
471.1Sitohy	$(LD) $(LDFLAGS) -o $(BOOT).x $(OBJS) $(LDADD)
481.1Sitohy	@$(NM) $(BOOT).x | sed -n '/T first_kbyte/p'
491.1Sitohy	@if [ `(echo ibase=16; \
501.1Sitohy		$(NM) $(BOOT).x | sed -n 's/T first_kbyte/-$(TEXT)-400/p' | \
511.1Sitohy				tr a-f A-F) | bc` -gt 0 ];\
521.1Sitohy	then echo '$(BOOT): first_kbyte exceeds the first killobyte'; exit 1; fi
531.1Sitohy	@$(SIZE) $(BOOT).x
541.1Sitohy	@if [ `(echo ibase=16; \
551.1Sitohy		$(NM) $(BOOT).x | sed -n 's/D _edata/-$(BSS)/p' | tr a-f A-F) |\
561.1Sitohy			bc` -gt 0 ];\
571.1Sitohy	then	echo '$(BOOT): text+data is too large'; exit 1; fi
581.1Sitohy	@cp $(BOOT).x s.x
591.1Sitohy	@$(STRIP) s.x
601.1Sitohy	@dd bs=32 skip=1 count=256 if=s.x of=$(BOOT) 2>/dev/null
611.1Sitohy	@rm s.x
621.1Sitohy
631.1Sitohybootufs.o unzip.o: ej2sjesc
641.1Sitohy
651.1Sitohy# helper program running on the host
661.1Sitohyej2sjesc: ej2sjesc.lo
671.1Sitohy	${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC}
681.1Sitohy
691.1Sitohy.include <bsd.prog.mk>
70