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