No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / landisk / stand / bootxx / Makefile.bootxx
blob421dbc771919ce6816d1d0f8b2cd905d73068a1a
1 #       $NetBSD: Makefile.bootxx,v 1.2 2009/04/03 10:38:13 tsutsui Exp $
3 PROG?=          bootxx_${FS}
5 BOOTXX_SECTORS?= 15
6 BOOTXX_MAXSIZE?= (( ${BOOTXX_SECTORS} * 512 ))
8 SRCS=           pbr.S label.S bootxx.S boot1.c
10 .if ${FS} == ustarfs
11 SRCS+=          bios.S
12 .endif
14 LDFLAGS+=       -e start
16 CFLAGS=
17 CPPFLAGS+=      -DBOOTXX
18 CPPFLAGS+=      -DBOOTXX_SECTORS=${BOOTXX_SECTORS}
19 CPPFLAGS+=      -DPRIMARY_LOAD_ADDRESS=${PRIMARY_LOAD_ADDRESS}
20 CPPFLAGS+=      -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS}
21 CPPFLAGS+=      -DXXfs_open=${FS}_open
22 CPPFLAGS+=      -DXXfs_close=${FS}_close
23 CPPFLAGS+=      -DXXfs_read=${FS}_read
24 CPPFLAGS+=      -DXXfs_stat=${FS}_stat
25 CPPFLAGS+=      -DFS=${FS}
27 CPPFLAGS+= -DLIBSA_SINGLE_FILESYSTEM=xxfs \
28                 -DLIBSA_NO_TWIDDLE \
29                 -DLIBSA_NO_FD_CHECKING \
30                 -DLIBSA_NO_RAW_ACCESS \
31                 -DLIBSA_NO_FS_WRITE \
32                 -DLIBSA_NO_FS_SEEK \
33                 -DLIBSA_SINGLE_DEVICE=blkdev \
34                 -DLIBKERN_OPTIMISE_SPACE \
35                 -D"blkdevioctl(x,y,z)=EINVAL" \
36                 -D"blkdevclose(f)=0" \
37                 -D"devopen(f,n,fl)=(*(fl)=(void *)n,0)" \
38                 -DLIBSA_NO_DISKLABEL_MSGS
40 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
42 .include "../Makefile.bootprogs"
44 LIBLIST=        ${LIBSA} ${LIBKERN}
46 CLEANFILES+=    ${PROG}.sym ${PROG}.map
48 ${PROG}: ${OBJS} ${LIBLIST}
49         ${LD} -o ${PROG}.sym ${LDFLAGS} -Ttext ${PRIMARY_LOAD_ADDRESS} \
50                 -Map ${PROG}.map -cref ${OBJS} ${LIBLIST}
51         ${OBJCOPY} -O binary ${PROG}.sym ${PROG}
52         @ sz=$$(ls -ln ${PROG} | tr -s ' ' | cut -d' ' -f5); \
53         if [ "$$sz" -gt "$$${BOOTXX_MAXSIZE}" ]; then \
54                 echo "### ${PROG} size $$sz is larger than ${BOOTXX_MAXSIZE}" >&2 \
55                 rm -f ${PROG}; \
56                 ! :; \
57         else \
58                 : pad to sector boundary; \
59                 pad=$$(( 512 - ( $$sz & 511 ) )); \
60                 [ $$pad = 512 ] || \
61                     dd if=/dev/zero bs=1 count=$$pad >>${PROG} 2>/dev/null; \
62                 echo "${PROG} size $$sz, $$((${BOOTXX_MAXSIZE} - $$sz)) free"; \
63         fi
65 .include <bsd.prog.mk>