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