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