1 # $NetBSD: Makefile,v 1.13 2009/01/12 07:19:08 tsutsui Exp $
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
17 COPTS
+= -funsigned-char
-mdisable-fpregs
21 .if defined
(HAVE_GCC
) && ${HAVE_GCC} != 4
22 COPTS
+= -fwritable-strings
25 LINKS
= ${BINDIR}/${PROG} ${BINDIR}/sdboot
37 S
= ${.CURDIR
}/..
/..
/..
/..
39 ${PROG}: iplsum
${OBJS}
41 ${LD} -Ttext
0 -Tdata
0 -e
'$$START$$' -N
-o
$@
1 $(OBJS
)
42 ${LD} -Ttext
0x100 -Tdata
0x23456780 -e
'$$START$$' -N
-o
$@
2 $(OBJS
)
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
}
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.
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$.
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
}