Home | History | Annotate | Line # | Download | only in boot_ufs
Makefile revision 1.6.4.3
      1  1.6.4.3  nathanw #	$NetBSD: Makefile,v 1.6.4.3 2002/04/01 07:43:43 nathanw Exp $
      2  1.6.4.2  nathanw 
      3  1.6.4.2  nathanw NOMAN=		# defined
      4  1.6.4.2  nathanw 
      5  1.6.4.2  nathanw .include <bsd.own.mk>
      6  1.6.4.2  nathanw 
      7  1.6.4.2  nathanw BOOT=	boot_ufs
      8  1.6.4.2  nathanw VERSIONFILE=	${.CURDIR}/version
      9  1.6.4.2  nathanw VERSION!=	awk -F: '$$1 ~ /^[0-9.]*$$/ { it = $$1; } END { print it }' ${VERSIONFILE}
     10  1.6.4.2  nathanw NEWVERSWHAT=	"${BOOT}"
     11  1.6.4.2  nathanw 
     12  1.6.4.2  nathanw # text and bss addresses in hex
     13  1.6.4.2  nathanw TEXT=		0f0000		# Primary (me)
     14  1.6.4.2  nathanw BOOT_TEXT=	006000		# Secondary (/boot)
     15  1.6.4.2  nathanw 
     16  1.6.4.2  nathanw PROG=		xx$(BOOT)
     17  1.6.4.2  nathanw LINKS=		${BINDIR}/xx$(BOOT) ${BINDIR}/sd$(BOOT)
     18  1.6.4.2  nathanw LINKS+=		${BINDIR}/xx$(BOOT) ${BINDIR}/fd$(BOOT)
     19  1.6.4.2  nathanw BINDIR=		/usr/mdec
     20  1.6.4.2  nathanw STRIPFLAG=
     21  1.6.4.2  nathanw BINMODE=	444
     22  1.6.4.2  nathanw 
     23  1.6.4.2  nathanw S=		${.CURDIR}/../../../..
     24  1.6.4.2  nathanw M=		$S/arch/${MACHINE}
     25  1.6.4.2  nathanw LIBKERN=	$S/lib/libkern/arch/${MACHINE_ARCH}
     26  1.6.4.2  nathanw COMMONDIR=	$M/stand/common
     27  1.6.4.2  nathanw LIBIOCS=	$M/stand/libiocs
     28  1.6.4.2  nathanw .PATH:		${LIBKERN} ${COMMONDIR}
     29  1.6.4.3  nathanw SRCS=	boot.S bootmain.c readufs.c readufs_ffs.c readufs_lfs.c
     30  1.6.4.2  nathanw SRCS+=	exec_image.S memset.S strcmp.S
     31  1.6.4.2  nathanw 
     32  1.6.4.2  nathanw SRCS+=		vers.c
     33  1.6.4.2  nathanw CLEANFILES+=	vers.c
     34  1.6.4.2  nathanw vers.c:	${VERSIONFILE}
     35  1.6.4.2  nathanw 	sh ${S}/conf/newvers_stand.sh -DM ${.ALLSRC} ${MACHINE} ${NEWVERSWHAT}
     36  1.6.4.2  nathanw 
     37  1.6.4.2  nathanw CFLAGS=	-Os -fomit-frame-pointer
     38  1.6.4.2  nathanw CFLAGS+= -W -Wall -Wconversion -Wstrict-prototypes -Wmissing-prototypes
     39  1.6.4.2  nathanw CPPFLAGS+= -DTEXTADDR="0x$(TEXT)" -DBOOT_TEXTADDR="0x$(BOOT_TEXT)"
     40  1.6.4.2  nathanw CPPFLAGS+= -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\"
     41  1.6.4.2  nathanw CPPFLAGS+= -DSCSI_ADHOC_BOOTPART
     42  1.6.4.2  nathanw #CPPFLAGS+= -DBOOT_DEBUG
     43  1.6.4.3  nathanw CPPFLAGS+= -DUSE_FFS -DUSE_LFS
     44  1.6.4.2  nathanw CPPFLAGS+= -I${COMMONDIR} -I${LIBIOCS}
     45  1.6.4.2  nathanw AFLAGS=	   ${CFLAGS:M-[ID]*}
     46  1.6.4.2  nathanw .if ${OBJECT_FMT} == "ELF"
     47  1.6.4.2  nathanw LDFLAGS=   -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript -M
     48  1.6.4.2  nathanw LDFLAGS+=  -noinhibit-exec	# XXX
     49  1.6.4.2  nathanw .else
     50  1.6.4.2  nathanw LDFLAGS=   -n -Bstatic -Ttext ${TEXT} -M
     51  1.6.4.2  nathanw OBJCOPY?=  objcopy
     52  1.6.4.2  nathanw .endif
     53  1.6.4.2  nathanw 
     54  1.6.4.2  nathanw CLEANFILES+=	$(PROG).x $(PROG).map
     55  1.6.4.2  nathanw 
     56  1.6.4.2  nathanw 
     57  1.6.4.2  nathanw $(PROG): $(OBJS)
     58  1.6.4.2  nathanw 	$(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD) > $(PROG).map
     59  1.6.4.2  nathanw 	@grep first_kbyte $(PROG).map
     60  1.6.4.2  nathanw .if ${OBJECT_FMT} == "ELF"
     61  1.6.4.2  nathanw 	@if [ `(echo ibase=16; 						   \
     62  1.6.4.2  nathanw 	    sed -n 's/^.*0x\([0-9a-f]*\).* first_kbyte$$/\1-$(TEXT)-400/p' \
     63  1.6.4.2  nathanw 		$(PROG).map | 						   \
     64  1.6.4.2  nathanw 	    tr a-f A-F) | bc` -gt 0 ]; 					   \
     65  1.6.4.2  nathanw 	then echo '$(BOOT): first_kbyte exceeds the first killobyte';	   \
     66  1.6.4.2  nathanw 	    rm $(PROG) ; exit 1; 					   \
     67  1.6.4.2  nathanw 	fi
     68  1.6.4.2  nathanw .else
     69  1.6.4.2  nathanw 	mv $(PROG) $(PROG).x
     70  1.6.4.2  nathanw 	$(OBJCOPY) -I a.out-m68k-netbsd -O binary $(PROG).x $(PROG)
     71  1.6.4.2  nathanw 	@rm -f $(PROG).x
     72  1.6.4.2  nathanw 	@if [ `(echo ibase=16; 						   \
     73  1.6.4.2  nathanw 	    sed -n 's/  first_kbyte:.*0x\(.*\),.*$$/\1-$(TEXT)-400/p'	   \
     74  1.6.4.2  nathanw 		$(PROG).map | 						   \
     75  1.6.4.2  nathanw 	    tr a-f A-F) | bc` -gt 0 ]; 					   \
     76  1.6.4.2  nathanw 	then echo '$(BOOT): first_kbyte exceeds the first killobyte';	   \
     77  1.6.4.2  nathanw 	    rm $(PROG) ; exit 1; 					   \
     78  1.6.4.2  nathanw 	fi
     79  1.6.4.2  nathanw .endif
     80  1.6.4.2  nathanw 
     81  1.6.4.2  nathanw .include <bsd.prog.mk>
     82