Makefile revision 1.12
1# $NetBSD: Makefile,v 1.12 2011/02/20 07:52:43 matt 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=
24LIBC=
25LIBCRTBEGIN=
26LIBCRTEND=
27
28AFLAGS=    -x assembler-with-cpp -mno-abicalls -mips2
29AFLAGS+=   -D_LOCORE -D_KERNEL
30CFLAGS=    -Os -mmemcpy -G 1024
31CFLAGS+=   -ffreestanding -mno-abicalls -msoft-float -mips2 -mabi=32
32CFLAGS+=   -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
33CPPFLAGS+= -nostdinc -I. -I${S}
34CPPFLAGS+= -D_STANDALONE -DNO_ABICALLS -D${MACHINE}
35CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
36#CPPFLAGS+= -DBOOT_DEBUG
37LDSCRIPT=  ${S}/arch/mips/conf/stand.ldscript
38TEXTADDR=  0x80f00000
39
40# if there is a 'version' file, add rule for vers.c and add it to SRCS
41# and CLEANFILES
42.if exists(version)
43.PHONY: vers.c
44vers.c: ${.CURDIR}/version
45	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
46	    ${.CURDIR}/version ${MACHINE}
47
48SRCS+=	vers.c
49CLEANFILES+= vers.c
50.endif
51
52### find out what to use for libsa
53SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
54.include "${S}/lib/libsa/Makefile.inc"
55LIBSA=   ${SALIB}
56
57### find out what to use for libkern
58.include "${S}/lib/libkern/Makefile.inc"
59LIBKERN= ${KERNLIB}
60
61### find out what to use for libz
62.include "${S}/lib/libz/Makefile.inc"
63LIBZ=    ${ZLIB}
64
65LIBS=  ${LIBSA} ${LIBKERN} ${LIBZ}
66
67cleandir distclean: .WAIT cleanlibdir
68cleanlibdir:
69	-rm -rf lib
70
71${PROG}: ${OBJS} ${LIBS}
72	${LD} -Map ${PROG}.map -N -x -Ttext ${TEXTADDR} -T ${LDSCRIPT} \
73	    -e start -o ${PROG}.elf ${OBJS} ${LIBS}
74	@${SIZE} ${PROG}.elf
75	${OBJCOPY} --impure -O ecoff-littlemips \
76	    -R .pdr -R .mdebug.abi32 -R .comment -R .ident \
77	    ${PROG}.elf ${.TARGET}
78
79CLEANFILES+=	${PROG}.elf ${PROG}.map
80
81.include <bsd.klinks.mk>
82.include <bsd.prog.mk>
83