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
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 SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_INCLUDE_NET=yes
35 .include "${S}/lib/libsa/Makefile.inc"
36 LIBSA= ${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
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 .else # ${PROG} == "bootxx"
49 LIBZ=
50 .endif
51
52 PMAX_STAND_DIR?= $S/arch/pmax/stand
53 ### find out what to use for libpmax
54 PMAXDIR= ${PMAX_STAND_DIR}/lib
55 .include "${PMAXDIR}/Makefile.inc"
56 LIBPMAX= ${PMAXLIB}
57
58 LIBS= ${LIBPMAX} ${LIBSA} ${LIBZ} ${LIBPMAX}
59 VERS_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
69 CLEANFILES+=${PROG}.map
70 .if ${VERS_O} != ""
71 CLEANFILES+=vers.c vers.o
72 .endif
73
74 cleandir distclean: cleanlibdir
75
76 cleanlibdir:
77 rm -rf lib
78
79 .include <bsd.prog.mk>
80
81 # be sure to turn off any PIC flags for standalone library code.
82 CPICFLAGS=
83 CAPICFLAGS=
84 CPPPICFLAGS=
85 APICFLAGS=
86