1 # $NetBSD: Makefile,v 1.22 2008/10/19 22:05:22 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
= 0f0000
# Primary (me)
15 BOOT_TEXT
= 006000 # Secondary (/boot)
18 LINKS
= ${BINDIR}/xx
$(BOOT
) ${BINDIR}/sd
$(BOOT
)
19 LINKS
+= ${BINDIR}/xx
$(BOOT
) ${BINDIR}/fd
$(BOOT
)
24 S
= ${.CURDIR
}/..
/..
/..
/..
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
35 vers.c
: ${VERSIONFILE}
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
52 LINKFLAGS
= -n
-Bstatic
-Ttext
${TEXT} -M
56 .
include "${.CURDIR}/../Makefile.booters"
57 .
include "${S}/../common/lib/libc/Makefile.inc"
59 CLEANFILES
+= $(PROG
).x
$(PROG
).map
64 .if
${OBJECT_FMT} == "ELF"
66 : Note
: "relocation truncated to fit: R_68K_16" messages are expected.
67 : Other errors are fatal.
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'; \
80 .if
${OBJECT_FMT} == "ELF"
81 mv
-f
$(PROG
).x
$(PROG
)
83 $(OBJCOPY
) -O binary
$(PROG
).x
$(PROG
)
86 .
include <bsd.prog.mk
>