1 # $NetBSD: Makefile,v 1.15 2008/10/25 22:27:38 apb Exp $
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)
22 S
= ${.CURDIR
}/..
/..
/..
/..
24 COMMONDIR
= $M/stand
/common
25 LIBIOCS
= $M/stand
/libiocs
30 vers.c
: ${VERSIONFILE}
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
]*}
39 .if
${OBJECT_FMT} == "ELF"
40 LINKFLAGS
= -n
-Bstatic
-T
${.CURDIR
}/${BOOT}.ldscript
-M
41 LINKFLAGS
+= -noinhibit-exec
# XXX
43 LINKFLAGS
= -n
-Bstatic
-Ttext
${TEXT} -M
47 .
include "${.CURDIR}/../Makefile.booters"
48 .
include "${S}/../common/lib/libc/Makefile.inc"
50 CLEANFILES
+= ${PROG}.x
$(PROG
).map
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; \
60 's/^.*0x\([0-9a-f]*\).* first_kbyte$$/\1-$(TEXT)-400/p' \
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; \
68 's/^.*0x\([0-9a-f]*\).* _edata *= *\.$$/\1-$(TEXT)-2000/p' \
70 tr a-f A-F) | bc` -gt
0 ]; \
71 then echo
'$(BOOT): text+data is too large'; \
72 rm $(PROG
) ; exit
1; \
76 $(OBJCOPY
) -I a.out-m68k-netbsd
-O binary
$(PROG
).x
$(PROG
)
78 @if
[ `(echo ibase=16; \
80 's/ first_kbyte:.*0x\(.*\),.*$$/\1-$(TEXT)-400/p' \
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; \
88 's/ _edata:.*0x\(.*\),.*$$/\1-$(TEXT)-2000/p' \
90 tr a-f A-F) | bc` -gt
0 ]; \
91 then echo
'$(BOOT): text+data is too large'; \
92 rm $(PROG
) ; exit
1; \
96 .
include <bsd.prog.mk
>