Makefile.booters revision 1.25
1#	$NetBSD: Makefile.booters,v 1.25 1999/11/12 01:37:42 simonb Exp $
2#
3#	NOTE: $S must correspond to the top of the 'sys' tree
4
5.BEGIN: ${.OBJDIR}/machine ${.OBJDIR}/mips
6${PROG} depend all: ${.OBJDIR}/machine ${.OBJDIR}/mips
7CLEANFILES+= machine mips
8
9${.OBJDIR}/machine:
10	-rm -f ${.TARGET}
11	ln -s $S/arch/${MACHINE}/include ${.TARGET}
12
13${.OBJDIR}/mips:
14	-rm -f ${.TARGET}
15	ln -s $S/arch/mips/include mips
16
17# Tailor C compilation for standalone environment.
18COPTS=	-Os				# -Os gives smaller code
19
20C_MACHDEP=-mmemcpy -mno-abicalls -G 128	# even smaller code
21
22DEFS?=	-D_STANDALONE -D_NO_PROM_DEFINES -DNO_ABICALLS \
23	${BOOTDEFADD}
24INCL?=	-nostdinc -I${.OBJDIR} -I$S -I${PMAX_STAND_DIR}/lib -I$S/lib/libsa
25
26CFLAGS+=	${CWARN} ${C_MACHDEP}
27AFLAGS+=	-D_LOCORE -D_KERNEL
28CPPFLAGS+=	${DEFS} ${INCL}
29
30LDBUG=	-T $S/arch/mips/conf/stand.ldscript
31
32### find out what to use for libsa
33SA_AS=		library
34SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_INCLUDE_NET=yes
35.include "${S}/lib/libsa/Makefile.inc"
36LIBSA=		${SALIB}
37
38# We don't need libz for the first stage bootblocks
39.if ${PROG} != "bootxx"
40
41### find out what to use for libz
42Z_AS=		library
43.include "${S}/lib/libz/Makefile.inc"
44LIBZ=		${ZLIB}
45# and use compressed read in libsa
46SAMISCMAKEFLAGS+=SA_USE_CREAD=yes
47
48.else	# ${PROG} == "bootxx"
49LIBZ=
50.endif
51
52PMAX_STAND_DIR?= $S/arch/pmax/stand
53### find out what to use for libpmax
54PMAXDIR= ${PMAX_STAND_DIR}/lib
55.include "${PMAXDIR}/Makefile.inc"
56LIBPMAX=		${PMAXLIB}
57
58LIBS=	${LIBPMAX} ${LIBSA} ${LIBZ} ${LIBPMAX}
59VERS_O?=vers.o
60
61${PROG}: ${OBJS} ${LIBS}
62.if ${VERS_O} != ""
63	sh ${PMAX_STAND_DIR}/lib/newvers.sh ${VERSIONFILE} ${NEWVERSWHAT}
64	${COMPILE.c} vers.c
65.endif
66	ld -Map ${PROG}.map -N -x -Ttext ${RELOC} ${LDBUG} -e start \
67	    ${OBJS} ${VERS_O} ${LIBS} -o ${PROG}
68
69CLEANFILES+=${PROG}.map
70.if ${VERS_O} != ""
71CLEANFILES+=vers.c vers.o
72.endif
73
74cleandir distclean: cleanlibdir
75
76cleanlibdir:
77	rm -rf lib
78
79.include <bsd.prog.mk>
80
81# be sure to turn off any PIC flags for standalone library code.
82CPICFLAGS=
83CAPICFLAGS=
84CPPPICFLAGS=
85APICFLAGS=
86