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