xref: /netbsd-src/sys/arch/arc/stand/boot/Makefile (revision fad4c9f71477ae11cea2ee75ec82151ac770a534)
1# $NetBSD: Makefile,v 1.4 2005/12/28 08:04:44 skrll 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
15SRCS=	start.S
16SRCS+=	boot.c bootinfo.c conf.c devopen.c disk.c getchar.c getopt.c putchar.c
17
18# XXX SHOULD NOT NEED TO DEFINE THESE!
19LIBCRT0=
20LIBC=
21LIBCRTBEGIN=
22LIBCRTEND=
23
24AFLAGS=    -x assembler-with-cpp -traditional-cpp -mno-abicalls -mips2
25AFLAGS+=   -D_LOCORE -D_KERNEL
26CFLAGS=    -Os -mmemcpy -G 1024
27CFLAGS+=   -ffreestanding -mno-abicalls -msoft-float -mips2
28CFLAGS+=   -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
29CPPFLAGS+= -nostdinc -I. -I${S}
30CPPFLAGS+= -D_STANDALONE -DNO_ABICALLS -D${MACHINE}
31CPPFLAGS+= -DLIBSA_USE_MEMSET -DLIBSA_USE_MEMCPY
32CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
33#CPPFLAGS+= -DBOOT_DEBUG
34LDSCRIPT=  ${S}/arch/mips/conf/stand.ldscript
35TEXTADDR=  0x80f00000
36
37.if !make(obj) && !make(clean) && !make(cleandir)
38.BEGIN: machine mips
39.NOPATH: machine mips
40
41machine::
42	-rm -f $@
43	ln -s ${S}/arch/${MACHINE}/include $@
44
45mips::
46	-rm -f $@
47	ln -s ${S}/arch/mips/include $@
48.endif
49
50CLEANFILES+= machine mips
51
52# if there is a 'version' file, add rule for vers.c and add it to SRCS
53# and CLEANFILES
54.if exists(version)
55.PHONY: vers.c
56vers.c: ${.CURDIR}/version
57	${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version ${MACHINE}
58
59SRCS+=	vers.c
60CLEANFILES+= vers.c
61.endif
62
63### find out what to use for libsa
64SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
65.include "${S}/lib/libsa/Makefile.inc"
66LIBSA=   ${SALIB}
67
68### find out what to use for libkern
69.include "${S}/lib/libkern/Makefile.inc"
70LIBKERN= ${KERNLIB}
71
72### find out what to use for libz
73.include "${S}/lib/libz/Makefile.inc"
74LIBZ=    ${ZLIB}
75
76LIBS=  ${LIBSA} ${LIBKERN} ${LIBZ}
77
78cleandir distclean: cleanlibdir
79cleanlibdir:
80	-rm -rf lib
81
82${PROG}: ${OBJS} ${LIBS}
83	${LD} -Map ${PROG}.map -N -x -Ttext ${TEXTADDR} -T ${LDSCRIPT} \
84	    -e start -o ${PROG}.elf ${OBJS} ${LIBS}
85	@${SIZE} ${PROG}.elf
86	${OBJCOPY} --impure -O ecoff-littlemips \
87	    -R .pdr -R .mdebug.abi32 -R .comment -R .ident \
88	    ${PROG}.elf ${.TARGET}
89
90CLEANFILES+=	${PROG}.elf ${PROG}.map
91
92.include <bsd.prog.mk>
93