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