1 1.28.2.1 rmind # $NetBSD: Makefile,v 1.28.2.1 2013/08/28 23:59:23 rmind 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.22 apb VERSION!= ${TOOL_AWK} -F: '$$1 ~ /^[0-9.]*$$/ { it = $$1; } \ 10 1.22 apb END { print it }' ${VERSIONFILE} 11 1.6 minoura NEWVERSWHAT= "${BOOT}" 12 1.1 minoura 13 1.1 minoura # text and bss addresses in hex 14 1.1 minoura TEXT= 0f0000 # Primary (me) 15 1.1 minoura BOOT_TEXT= 006000 # Secondary (/boot) 16 1.1 minoura 17 1.5 minoura PROG= xx$(BOOT) 18 1.5 minoura LINKS= ${BINDIR}/xx$(BOOT) ${BINDIR}/sd$(BOOT) 19 1.8 minoura LINKS+= ${BINDIR}/xx$(BOOT) ${BINDIR}/fd$(BOOT) 20 1.1 minoura BINDIR= /usr/mdec 21 1.1 minoura STRIPFLAG= 22 1.1 minoura BINMODE= 444 23 1.1 minoura 24 1.6 minoura S= ${.CURDIR}/../../../.. 25 1.6 minoura M= $S/arch/${MACHINE} 26 1.6 minoura LIBKERN= $S/lib/libkern/arch/${MACHINE_ARCH} 27 1.6 minoura COMMONDIR= $M/stand/common 28 1.6 minoura LIBIOCS= $M/stand/libiocs 29 1.1 minoura .PATH: ${LIBKERN} ${COMMONDIR} 30 1.11 minoura SRCS= boot.S bootmain.c readufs.c readufs_ffs.c readufs_lfs.c 31 1.1 minoura SRCS+= exec_image.S memset.S strcmp.S 32 1.6 minoura 33 1.6 minoura SRCS+= vers.c 34 1.6 minoura CLEANFILES+= vers.c 35 1.6 minoura vers.c: ${VERSIONFILE} 36 1.20 lukem ${_MKTARGET_CREATE} 37 1.25 joerg ${HOST_SH} ${S}/conf/newvers_stand.sh \ 38 1.25 joerg ${.ALLSRC} ${MACHINE} ${NEWVERSWHAT} 39 1.1 minoura 40 1.28.2.1 rmind CFLAGS= -Os -fomit-frame-pointer -fno-unwind-tables 41 1.28 christos CFLAGS+= -m68020-60 42 1.21 isaki CFLAGS+= -W -Wall -Wstrict-prototypes -Wmissing-prototypes 43 1.1 minoura CPPFLAGS+= -DTEXTADDR="0x$(TEXT)" -DBOOT_TEXTADDR="0x$(BOOT_TEXT)" 44 1.1 minoura CPPFLAGS+= -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\" 45 1.1 minoura CPPFLAGS+= -DSCSI_ADHOC_BOOTPART 46 1.1 minoura #CPPFLAGS+= -DBOOT_DEBUG 47 1.26 tsutsui CPPFLAGS+= -DUSE_FFS -DUSE_LFS -DUSE_UFS1 -DUSE_UFS2 48 1.16 itohy CPPFLAGS+= -I${COMMONDIR} -I${LIBIOCS} -I${S} -I. -D_STANDALONE 49 1.1 minoura AFLAGS= ${CFLAGS:M-[ID]*} 50 1.19 lukem LINKFLAGS= -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript -M 51 1.19 lukem LINKFLAGS+= -noinhibit-exec # XXX 52 1.15 he 53 1.15 he .include "${.CURDIR}/../Makefile.booters" 54 1.18 he .include "${S}/../common/lib/libc/Makefile.inc" 55 1.1 minoura 56 1.7 minoura CLEANFILES+= $(PROG).x $(PROG).map 57 1.1 minoura 58 1.1 minoura 59 1.5 minoura $(PROG): $(OBJS) 60 1.20 lukem ${_MKTARGET_LINK} 61 1.16 itohy : 62 1.16 itohy : Note: "relocation truncated to fit: R_68K_16" messages are expected. 63 1.16 itohy : Other errors are fatal. 64 1.16 itohy : 65 1.19 lukem $(LD) $(LINKFLAGS) -o $(PROG).x $(OBJS) $(LDADD) >$(PROG).map 66 1.7 minoura @grep first_kbyte $(PROG).map 67 1.16 itohy @if [ `(echo ibase=16; \ 68 1.23 apb ${TOOL_SED} -n -e '/[ ]first_kbyte/{' \ 69 1.16 itohy -e 's/.*0x\([0-9a-fA-F]*\).*/\1-$(TEXT)-400/p' \ 70 1.16 itohy -e '}' $(PROG).map | \ 71 1.16 itohy tr a-f A-F) | bc` -gt 0 ]; \ 72 1.16 itohy then echo '$(BOOT): first_kbyte exceeds the first killobyte'; \ 73 1.16 itohy exit 1; \ 74 1.16 itohy fi 75 1.16 itohy mv -f $(PROG).x $(PROG) 76 1.1 minoura 77 1.1 minoura .include <bsd.prog.mk> 78