No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / hp700 / stand / xxboot / Makefile
blobb20145451c4b02d1b2714995c8c9fc4976470c5b
1 # $NetBSD: Makefile,v 1.13 2009/01/12 07:19:08 tsutsui Exp $
3 PROG= xxboot
4 NOMAN= # defined
5 SRCS= start.S main.c readufs.c readufs_ffs.c readufs_lfs.c milli_tiny.S
7 .PATH: ${.CURDIR}/../common
9 CPPFLAGS+= -mpa-risc-1-0 -I${.CURDIR}/../../../.. -I. -D_STANDALONE
10 # configuration for readufs module
11 CPPFLAGS+= -DUSE_LFS -DUSE_FFS -DUSE_UFS1 -DUSE_UFS2
12 # IODC can handle only 2GB, so this is enough
13 CPPFLAGS+= -D__daddr_t=int32_t
14 # ANSI C feature prevents from being relocatable
15 #CPPFLAGS+= -traditional # would be best
16 CPPFLAGS+= -Dconst=
17 COPTS+= -funsigned-char -mdisable-fpregs
19 .include <bsd.own.mk>
21 .if defined(HAVE_GCC) && ${HAVE_GCC} != 4
22 COPTS+= -fwritable-strings
23 .endif
25 LINKS= ${BINDIR}/${PROG} ${BINDIR}/sdboot
27 BINDIR= /usr/mdec
28 STRIPFLAG=
29 BINMODE= 444
31 # standalone program
32 LIBCRTBEGIN=
33 LIBCRT0=
34 LIBCRTEND=
35 LIBC=
37 S= ${.CURDIR}/../../../..
39 ${PROG}: iplsum ${OBJS}
40 ${_MKTARGET_LINK}
41 ${LD} -Ttext 0 -Tdata 0 -e '$$START$$' -N -o $@1 $(OBJS)
42 ${LD} -Ttext 0x100 -Tdata 0x23456780 -e '$$START$$' -N -o $@2 $(OBJS)
43 ${SIZE} $@1
44 ${OBJCOPY} -O binary -j .data $@1 $@1.bin
45 ${OBJCOPY} -O binary -j .data $@2 $@2.bin
46 cmp $@1.bin $@2.bin # should be same
47 ${OBJCOPY} -O binary -j .text $@1 $@2.bin
48 test ! -s $@2.bin # text section must be empty
49 ${_MKMSG} " iplsum " ${.TARGET}
50 ./iplsum $@1.bin $@
52 iplsum: iplsum.c
53 ${_MKTARGET_LINK}
54 ${HOST_CC} -o $@ ${.CURDIR}/iplsum.c
56 CLEANFILES+= ${PROG}1 ${PROG}2 ${PROG}1.bin ${PROG}2.bin ${PROG}.bin iplsum
57 CLEANFILES+= ${SRCS:M*.c:S/.c$/.o.S/}
59 .include <bsd.prog.mk>
60 .include <bsd.klinks.mk>
62 # override default rules
64 # Place code to data section.
65 .S.o:
66 ${_MKTARGET_COMPILE}
67 ${TOOL_SED} -e 's/\.code/.data/' \
68 -e 's/\.bss/.section .bss,"aw",@nobits/' \
69 -e 's/\.allow$$/.level 1.0/' -e 's/\.allow/.level/' \
70 ${.IMPSRC} | ${AS} -o ${.TARGET}
72 # Place code to data section, and make sure all address calculations
73 # are relative to $global$.
74 .c.o:
75 ${_MKTARGET_COMPILE}
76 ${CC} ${CFLAGS} ${CPPFLAGS} -o $@.S -S ${.IMPSRC}
77 grep -i 'ldil' $@.S | egrep -v "ldil L'-?[0-9]*," > /dev/null 2>&1; \
78 if [ $$? = 0 ]; then \
79 echo 'found non-relocatable code' >&2 && exit 1; \
81 ${TOOL_SED} -e 's/\.text/.data/' $@.S | ${AS} -o ${.TARGET}