No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / pmax / stand / Makefile.booters
blob00549380f929ad165783d17ecedba624c1d31d80
1 # $NetBSD: Makefile.booters,v 1.50 2009/04/23 16:35:20 tsutsui Exp $
3 .include <bsd.sys.mk>           # for HOST_SH
5 # $S must correspond to the top of the 'sys' tree
6 S=      ${.CURDIR}/../../../..
8 BINMODE?=       444
10 # XXX SHOULD NOT NEED TO DEFINE THESE!
11 LIBCRT0=
12 LIBC=
13 LIBCRTBEGIN=
14 LIBCRTEND=
16 .PATH:          ${.CURDIR}/../common
17 AFLAGS+=        -D_LOCORE -D_KERNEL -mno-abicalls
18 # -I${.CURDIR}/../.. done by Makefile.inc
19 CPPFLAGS+=      -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES \
20                 -I${.OBJDIR} -I${S}
21 # compiler flags for smallest code size
22 CFLAGS=         -ffreestanding -Os -g -mmemcpy -mno-abicalls -G 128
23 CFLAGS+=        -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
24 CFLAGS+=        -Werror
25 LDBUG=          -T $S/arch/mips/conf/stand.ldscript
27 NETBSD_VERS!=   ${HOST_SH} ${.CURDIR}/../../../../conf/osrelease.sh
28 CPPFLAGS+=      -DNETBSD_VERS='"${NETBSD_VERS}"'
30 PRIMARY_LOAD_ADDRESS?=  0x80700000
31 SECONDARY_LOAD_ADDRESS?=0x80710000
33 NOMAN=          # defined
35 .if defined(PRIMARY_PROG)
36 PROG=           ${PRIMARY_PROG}
37 SRCS =          start.S bootxx.c callvec.c
38 SRCS+=          devopen.c conf.c rz.c
39 SRCS+=          bootinit.S bootread.S clear_cache.S printf.S
41 LOAD_ADDRESS=   ${PRIMARY_LOAD_ADDRESS}
42 # Pick a number, any number...
43 PRIMARY_MAX_TOTAL!=     expr 16 \* 1024
45 CPPFLAGS+=      -DPRIMARY_BOOTBLOCK \
46                 -DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
47                 -DNO_GETCHAR \
48                 -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
49                 -DLIBSA_NO_FS_CLOSE \
50                 -DLIBSA_NO_DEV_CLOSE \
51                 -DLIBSA_NO_DEV_IOCTL \
52                 -DLIBSA_SINGLE_DEVICE=rz \
53                 -D"rzioctl(x,y,z)=EINVAL" -D"rzclose(f)=0" \
54                 -DLIBSA_NO_TWIDDLE \
55                 -DLIBSA_NO_FD_CHECKING \
56                 -DLIBSA_NO_RAW_ACCESS \
57                 -DLIBSA_NO_DISKLABEL_MSGS \
58                 -DALLOC_FIRST_FIT
60 CHECKSIZE_CMD?= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
62 .elif defined(SECONDARY_PROG)
63 PROG=           ${SECONDARY_PROG}
64 LOAD_ADDRESS=   ${SECONDARY_LOAD_ADDRESS}
65 CPPFLAGS+=      -DSECONDARY_BOOTBLOCK
66 SRCS+=  vers.c
67 CLEANFILES+= vers.c
68 .else
69 # XXX ?
70 .endif
72 ### find out what to use for libkern
73 KERN_AS=        library
74 .include "${S}/lib/libkern/Makefile.inc"
75 LIBKERN=        ${KERNLIB}
77 ### find out what to use for libz
78 .if defined(PRIMARY_PROG)
79 LIBZ=
80 .else
81 Z_AS=           library
82 .include "${S}/lib/libz/Makefile.inc"
83 LIBZ=           ${ZLIB}
84 .endif
86 ### find out what to use for libsa
87 SA_AS=          library
88 .if defined(PRIMARY_PROG)
89 SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
90 .endif
91 .if defined(SECONDARY_PROG)
92 SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
93 SAMISCMAKEFLAGS+=SA_INCLUDE_NET=yes
94 .endif
95 .include "${S}/lib/libsa/Makefile.inc"
96 LIBSA=          ${SALIB}
98 LIBS=           ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
100 .include <bsd.own.mk>
102 vers.c: ${.CURDIR}/version
103         ${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "pmax"
105 ${PROG}: ${OBJS} ${LIBS}
106         ${LD} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
107             ${LDBUG} -e start -o ${PROG} ${OBJS} ${LIBS}
108         @${SIZE} ${PROG}
109 .if defined(CHECKSIZE_CMD)
110         @${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} ${PRIMARY_MAX_TOTAL} || \
111             (rm -f ${PROG} ; false)
112 .endif
113 .if defined(DO_ECOFF_BINARY)
114         @echo -n "Creating ECOFF binary... "
115         @mv ${PROG} ${PROG}.elf
116         @${ELF2ECOFF} ${PROG}.elf ${PROG}
117         @echo done.
118 .endif
120 .include <bsd.klinks.mk>
121 .include <bsd.prog.mk>
123 CLEANFILES+=    ${PROG}.map ${PROG}.elf
125 cleandir distclean: cleanlibdir
127 cleanlibdir:
128         -rm -rf lib