xref: /netbsd-src/sys/arch/pmax/stand/Makefile.booters (revision 3b435a73967be44dfb4a27315acd72bfacde430c)
1#	$NetBSD: Makefile.booters,v 1.24 1999/07/21 13:34:34 mrg 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 libkern/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### find out what to use for libkern
49KERN_AS=	library
50.include "${S}/lib/libkern/Makefile.inc"
51LIBKERN=	${KERNLIB}
52
53.else	# ${PROG} == "bootxx"
54LIBZ=
55.endif
56
57PMAX_STAND_DIR?= $S/arch/pmax/stand
58### find out what to use for libpmax
59PMAXDIR= ${PMAX_STAND_DIR}/lib
60.include "${PMAXDIR}/Makefile.inc"
61LIBPMAX=		${PMAXLIB}
62
63LIBS=	${LIBPMAX} ${LIBKERN} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBPMAX}
64VERS_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
74CLEANFILES+=${PROG}.map
75.if ${VERS_O} != ""
76CLEANFILES+=vers.c vers.o
77.endif
78
79cleandir distclean: cleanlibdir
80
81cleanlibdir:
82	rm -rf lib
83
84.include <bsd.prog.mk>
85
86# be sure to turn off any PIC flags for standalone library code.
87CPICFLAGS=
88CAPICFLAGS=
89CPPPICFLAGS=
90APICFLAGS=
91