No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / mipsco / stand / Makefile.booters
blobbdbf659d8c65ae2872fbcee710c50b3f4fa8a860
1 #       $NetBSD: Makefile.booters,v 1.14 2009/03/17 00:35:08 he Exp $
3 .include <bsd.sys.mk>           # for HOST_SH
5 S=      ${.CURDIR}/../../../..
6 MIPS=   ${S}/arch/mips
7 MIPSCO= ${S}/arch/mipsco
9 .PATH:  ${.CURDIR}/../common
11 NOMAN=          # defined
12 BINMODE?= 444
14 # XXX SHOULD NOT NEED TO DEFINE THESE!
15 LIBCRT0=
16 LIBC=
17 LIBCRTBEGIN=
18 LIBCRTEND=
20 .PHONY:         machine-links
21 beforedepend: machine-links
23 machine-links:  machine mipsco mips
24 machine mipsco:
25         -rm -f ${.TARGET}
26         ln -s ${MIPSCO}/include ${.TARGET}
28 mips:
29         -rm -f ${.TARGET}
30         ln -s ${MIPS}/include ${.TARGET}
32 CLEANFILES+=    machine mipsco mips
34 realall: machine-links ${PROG}
36 AFLAGS+=        -D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls
37 # -I${.CURDIR}/../.. done by Makefile.inc
38 CPPFLAGS+=      -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
39 CPPFLAGS+=      -I${.OBJDIR} -I${S}
40 # compiler flags for smallest code size
41 #CFLAGS=                -Os -mmemcpy -mno-abicalls -G 128
42 CFLAGS=         -Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
43 CFLAGS+=        -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
45 NETBSD_VERS!=   ${HOST_SH} ${S}/conf/osrelease.sh
46 CPPFLAGS+=      -DNETBSD_VERS='"${NETBSD_VERS}"'
48 PRIMARY_LOAD_ADDRESS?=  0x80600000
49 SECONDARY_LOAD_ADDRESS?=0x80610000
51 LDSCRIPT?=      ${MIPSCO}/conf/stand.ldscript
53 .include <bsd.own.mk>
55 .if defined(PRIMARY_PROG)
56 PROG=           ${PRIMARY_PROG}
57 SRCS =          start.S bootxx.c callvec.c
58 SRCS+=          devopen.c conf.c saio.c
59 SRCS+=          prom.S
61 LOAD_ADDRESS=   ${PRIMARY_LOAD_ADDRESS}
63 CPPFLAGS+=      -DPRIMARY_BOOTBLOCK \
64                 -DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
65                 -DNO_GETCHAR \
66                 -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
67                 -DLIBSA_NO_FS_CLOSE \
68                 -DLIBSA_NO_DEV_CLOSE \
69                 -DLIBSA_NO_DEV_IOCTL \
70                 -DLIBSA_SINGLE_DEVICE=saio \
71                 -D"saioioctl(x,y,z)=EINVAL" -D"saioclose(f)=0" \
72                 -DLIBSA_NO_TWIDDLE \
73                 -DLIBSA_NO_FD_CHECKING \
74                 -DLIBSA_NO_DISKLABEL_MSGS \
75                 -DLIBSA_NO_RAW_ACCESS \
76                 -DALLOC_FIRST_FIT
79 CHECKSIZE_CMD?= SIZE=${SIZE} ${HOST_SH} ${.CURDIR}/../common/checksize.sh
81 STRIPSECTIONS?= -R .reginfo -R .mdebug.abi32 -R .comment -R .pdr
83 .elif defined(SECONDARY_PROG)
84 PROG=           ${SECONDARY_PROG}
85 LOAD_ADDRESS=   ${SECONDARY_LOAD_ADDRESS}
86 CPPFLAGS+=      -DSECONDARY_BOOTBLOCK
87 SRCS+=  vers.c
88 CLEANFILES+= vers.c
89 .else
91 .endif
93 ### find out what to use for libkern
94 KERN_AS=        library
95 .include "${S}/lib/libkern/Makefile.inc"
96 LIBKERN=        ${KERNLIB}
98 ### find out what to use for libz
99 .if defined(PRIMARY_PROG)
100 LIBZ=
101 .else
102 Z_AS=           library
103 .include "${S}/lib/libz/Makefile.inc"
104 LIBZ=           ${ZLIB}
105 .endif
107 ### find out what to use for libsa
108 SA_AS=          library
109 .if defined(PRIMARY_PROG)
110 SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
111 .endif
112 .if defined(SECONDARY_PROG)
113 SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
114 # for now:
115 SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
116 .endif
117 .include "${S}/lib/libsa/Makefile.inc"
118 LIBSA=          ${SALIB}
120 LIBS=           ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
122 .PHONY: vers.c
123 vers.c: ${.CURDIR}/version
124         ${HOST_SH} ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "mipsco"
126 ${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
127         ${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
128             -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
129         @${SIZE} ${PROG}
130 .if defined(PRIMARY_PROG)
131         mv ${PROG} ${PROG}.elf
132         ${OBJCOPY} --strip-all -O ecoff-bigmips ${STRIPSECTIONS} \
133             ${PROG}.elf ${PROG}
134 .endif
135 .if defined(CHECKSIZE_CMD)
136         @${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} || \
137             (rm -f ${PROG} ; false)
138 .endif
140 CLEANFILES+=    ${PROG}.map ${PROG}.elf
142 cleandir distclean: cleanlibdir
144 cleanlibdir:
145         -rm -rf lib
147 .include <bsd.prog.mk>