1#	$NetBSD: Makefile,v 1.10 2011/01/21 15:59:06 joerg Exp $
2.include <bsd.own.mk>
3
4ROMICE?=	no
5
6S=	${.CURDIR}/../../../../
7
8PROG=	lcboot.out
9SREC=	lcboot.srec
10MKMAN=	no
11WARNS=	1
12SRCS=	start.S main.c com.c conf.c dev_flash.c dev_net.c \
13	devopen.c i28f128.c if_cs.c
14
15#CPPFLAGS+=	-DDEBUG -DNET_DEBUG -DNETIF_DEBUG -DARP_DEBUG \
16#		-DETHER_DEBUG -DBOOTP_DEBUG
17
18STARTOBJS=
19
20NEWVERSWHAT=    "L-Card+ Boot"
21VERSIONFILE=    ${S}/arch/hpcmips/stand/lcboot/version
22
23
24# Make sure we override any optimization options specified by the user.
25#COPTS=  -Os
26COPTS=
27DBG=
28
29AFLAGS+=	-D_LOCORE -D_KERNEL
30AFLAGS+=	-x assembler-with-cpp -mips2 -mno-abicalls
31INCLUDES=	-I${.OBJDIR} -I${S} -I${S}/arch
32CPPFLAGS+=	${INCLUDES} -nostdinc -D_STANDALONE -DHEAP_LIMIT=0x8002ffff
33CFLAGS+=	-mips2 -EL -mno-abicalls -ffreestanding -mmemcpy
34LD_SCRIPT=	lcboot.ldscript
35
36.if defined(ROMICE) && (${ROMICE} == "yes")
37CPPFLAGS+=	-DROMICE
38.endif
39
40.if !make(obj) && !make(clean) && !make(cleandir)
41.BEGIN:
42	@([ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine)
43	@[ -h mips ] || ln -s ${S}/arch/mips/include mips
44.NOPATH: machine
45.endif
46CLEANFILES+= machine mips
47
48${OBJS}: machine mips
49
50### find out what to use for libkern
51.include "${S}/lib/libkern/Makefile.inc"
52LIBKERN=	${KERNLIB}
53
54### find out what to use for libz
55.include "${S}/lib/libz/Makefile.inc"
56LIBZ=	${ZLIB}
57
58### find out what to use for libsa
59SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
60SAMISCMAKEFLAGS+="SA_USE_CREAD=yes"
61.include "${S}/lib/libsa/Makefile.inc"
62LIBSA=	${SALIB}
63
64LIBLIST=	${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN} ${LIBSA}
65
66# if there is a 'version' file, add rule for vers.c and add it to SRCS
67# and CLEANFILES
68.if exists (${VERSIONFILE})
69SRCS+=	vers.c
70CLEANFILES+=	vers.c
71.PHONY: vers.c
72vers.c: ${VERSIONFILE}
73	${HOST_SH} ${S}/conf/newvers_stand.sh ${${MKREPRO} == "yes" :?:-D} \
74	    ${.ALLSRC} 'hpcmips' ${NEWVERSWHAT}
75.endif
76
77CLEANFILES+=	${PROG}
78${PROG}: ${OBJS} ${LIBKERN} ${LIBSA} ${LIBZ}
79	${LD} -o ${PROG} -T ${LD_SCRIPT} ${OBJS} ${LIBLIST}
80
81CLEANFILES+=	${SREC}
82all: ${SREC}
83${SREC}: ${PROG}
84	${OBJCOPY} -S -O srec ${PROG} ${SREC}
85
86.include <bsd.prog.mk>
87