Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / x68k / stand / boot_ustar / Makefile
blob47177f02cef4305315e5f3bc14baffd43b87b89e
1 # $NetBSD: Makefile,v 1.15 2008/10/25 22:27:38 apb Exp $
3 NOMAN= # defined
5 .include <bsd.own.mk>
7 BOOT= boot_ustar
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= 002000 # Primary (me)
15 BOOT_TEXT= 006000 # Secondary (/boot)
17 PROG= fd$(BOOT)
18 BINDIR= /usr/mdec
19 STRIPFLAG=
20 BINMODE= 444
22 S= ${.CURDIR}/../../../..
23 M= $S/arch/x68k
24 COMMONDIR= $M/stand/common
25 LIBIOCS= $M/stand/libiocs
26 SRCS= boot_ustar.S
28 SRCS+= vers.c
29 CLEANFILES+= vers.c
30 vers.c: ${VERSIONFILE}
31 ${_MKTARGET_CREATE}
32 ${HOST_SH} ${S}/conf/newvers_stand.sh -DM ${.ALLSRC} ${MACHINE} ${NEWVERSWHAT}
34 CPPFLAGS+= -DTEXTADDR="0x$(TEXT)" -DBOOT_TEXTADDR="0x$(BOOT_TEXT)"
35 CPPFLAGS+= -DBOOT=\"$(BOOT)\" -DBOOT_VERS=\"$(VERSION)\"
36 CPPFLAGS+= -I${COMMONDIR} -I${LIBIOCS} -I${S} -I. -D_STANDALONE
37 AFLAGS= ${CFLAGS:M-[ID]*}
38 AFLAGS+= -Wa,-mc68000
39 .if ${OBJECT_FMT} == "ELF"
40 LINKFLAGS= -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript -M
41 LINKFLAGS+= -noinhibit-exec # XXX
42 .else
43 LINKFLAGS= -n -Bstatic -Ttext ${TEXT} -M
44 OBJCOPY?= objcopy
45 .endif
47 .include "${.CURDIR}/../Makefile.booters"
48 .include "${S}/../common/lib/libc/Makefile.inc"
50 CLEANFILES+= ${PROG}.x $(PROG).map
53 ${PROG}: $(OBJS)
54 ${_MKTARGET_LINK}
55 $(LD) $(LINKFLAGS) -o ${PROG} $(OBJS) $(LDADD) > $(PROG).map
56 @grep first_kbyte $(PROG).map
57 .if ${OBJECT_FMT} == "ELF"
58 @if [ `(echo ibase=16; \
59 ${TOOL_SED} -n \
60 's/^.*0x\([0-9a-f]*\).* first_kbyte$$/\1-$(TEXT)-400/p' \
61 $(PROG).map | \
62 tr a-f A-F) | bc` -gt 0 ]; \
63 then echo '$(BOOT): first_kbyte exceeds the first killobyte'; \
64 rm $(PROG) ; exit 1; \
66 @if [ `(echo ibase=16; \
67 ${TOOL_SED} -n \
68 's/^.*0x\([0-9a-f]*\).* _edata *= *\.$$/\1-$(TEXT)-2000/p' \
69 $(PROG).map | \
70 tr a-f A-F) | bc` -gt 0 ]; \
71 then echo '$(BOOT): text+data is too large'; \
72 rm $(PROG) ; exit 1; \
74 .else
75 mv $(PROG) $(PROG).x
76 $(OBJCOPY) -I a.out-m68k-netbsd -O binary $(PROG).x $(PROG)
77 @rm -f $(PROG).x
78 @if [ `(echo ibase=16; \
79 ${TOOL_SED} -n \
80 's/ first_kbyte:.*0x\(.*\),.*$$/\1-$(TEXT)-400/p' \
81 $(PROG).map | \
82 tr a-f A-F) | bc` -gt 0 ]; \
83 then echo '$(BOOT): first_kbyte exceeds the first killobyte'; \
84 rm $(PROG) ; exit 1; \
86 @if [ `(echo ibase=16; \
87 ${TOOL_SED} -n \
88 's/ _edata:.*0x\(.*\),.*$$/\1-$(TEXT)-2000/p' \
89 $(PROG).map | \
90 tr a-f A-F) | bc` -gt 0 ]; \
91 then echo '$(BOOT): text+data is too large'; \
92 rm $(PROG) ; exit 1; \
94 .endif
96 .include <bsd.prog.mk>