Makefile revision 1.14
1# $NetBSD: Makefile,v 1.14 2014/01/12 15:26:28 tsutsui Exp $
2
3.include <bsd.own.mk>
4.include <bsd.sys.mk>	# for ${HOST_SH}
5
6S!= cd ${.CURDIR}/../../../..; pwd
7
8PROG= boot
9MKMAN= no		# defined
10STRIPFLAG=
11BINMODE= 444
12
13NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
14
15.PATH:		${S}/dev/arcbios
16
17SRCS=	start.S arcbios_calls.S
18SRCS+=	boot.c bootinfo.c conf.c devopen.c disk.c getchar.c getopt.c putchar.c
19
20.include "${S}/dev/arcbios/Makefile.inc"
21
22# XXX SHOULD NOT NEED TO DEFINE THESE!
23LIBCRT0=
24LIBCRTI=
25LIBC=
26LIBCRTBEGIN=
27LIBCRTEND=
28
29AFLAGS=    -x assembler-with-cpp -mno-abicalls -mips2 -mabi=32
30AFLAGS+=   -D_LOCORE -D_KERNEL
31CFLAGS=    -Os -mmemcpy -G 1024
32CFLAGS+=   -ffreestanding -mno-abicalls -msoft-float -mips2 -mabi=32
33CFLAGS+=   -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
34CPPFLAGS+= -nostdinc -I. -I${S}
35CPPFLAGS+= -D_STANDALONE -DNO_ABICALLS -D${MACHINE}
36CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
37#CPPFLAGS+= -DBOOT_DEBUG
38LDSCRIPT=  ${S}/arch/mips/conf/stand.ldscript
39TEXTADDR=  0x80f00000
40LD+=		-m elf32ltsmip
41
42# if there is a 'version' file, add rule for vers.c and add it to SRCS
43# and CLEANFILES
44.if exists(version)
45.PHONY: vers.c
46vers.c: ${.CURDIR}/version
47	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
48	    ${.CURDIR}/version ${MACHINE}
49
50SRCS+=	vers.c
51CLEANFILES+= vers.c
52.endif
53
54### find out what to use for libsa
55SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
56.include "${S}/lib/libsa/Makefile.inc"
57LIBSA=   ${SALIB}
58
59### find out what to use for libkern
60.include "${S}/lib/libkern/Makefile.inc"
61LIBKERN= ${KERNLIB}
62
63### find out what to use for libz
64.include "${S}/lib/libz/Makefile.inc"
65LIBZ=    ${ZLIB}
66
67LIBS=  ${LIBSA} ${LIBKERN} ${LIBZ}
68
69cleandir distclean: .WAIT cleanlibdir
70cleanlibdir:
71	-rm -rf lib
72
73${PROG}: ${OBJS} ${LIBS}
74	${LD} -Map ${PROG}.map -N -x -Ttext ${TEXTADDR} -T ${LDSCRIPT} \
75	    -e start -o ${PROG}.elf ${OBJS} ${LIBS}
76	@${SIZE} ${PROG}.elf
77	${OBJCOPY} --impure -O ecoff-littlemips \
78	    -R .pdr -R .mdebug.abi32 -R .comment -R .ident \
79	    ${PROG}.elf ${.TARGET}
80
81CLEANFILES+=	${PROG}.elf ${PROG}.map
82
83.include <bsd.klinks.mk>
84.include <bsd.prog.mk>
85