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