initial commit
[freebsd-arm:freebsd-arm.git] / boot / arm / ixp425 / boot2 / Makefile
1 #  $FreeBSD$
2
3 # We get a lot of the std lib functions from here.
4 .PATH: ${.CURDIR}/../../at91/libat91
5
6 # Enable to get debug msgs
7 #DEBUG=yes
8
9 # Hack to search through the kernel for ufs:ad0s1a and replace it with
10 # the correct one for the active slice/partition.
11 FIXUP_BOOT_DRV=yes
12
13 P=boot2
14 FILES=${P}
15 SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:L}_board.c
16 SRCS+=memchr.c memcmp.c memcpy.c memmem.c memset.c printf.c strcmp.c strcpy.c
17 SRCS+=strlen.c ashldi3.c divsi3.S muldi3.c
18 NO_MAN=
19
20 KERNPHYSADDR=0x180000
21 KERNVIRTADDR=${KERNPHYSADDR}
22 BOOT_STACK=0x200000-4
23 M=${MACHINE_ARCH}
24 LDFLAGS=-e ${KERNPHYSADDR} -EB -T ldscript.${M}
25 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
26 S=${.CURDIR}/../../../..
27
28 CFLAGS+= \
29         -DBOOT_STACK=${BOOT_STACK} \
30         -I${.CURDIR}/../../../common \
31         -I${.CURDIR}
32
33 .if defined(FIXUP_BOOT_DRV)
34 CFLAGS+=-DFIXUP_BOOT_DRV
35 .endif
36 .if defined(DEBUG)
37 CFLAGS+=-DDEBUG
38 .endif
39
40 ldscript.$M:    $S/conf/ldscript.$M
41         cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
42           sed s/KERNVIRTADDR/${KERNVIRTADDR}/g | \
43           sed s/" + SIZEOF_HEADERS"// > ldscript.$M
44
45 ${P}:   ldscript.$M
46
47 CLEANFILES+=ldscript.$M
48
49 memchr.c:       $S/../lib/libc/string/memchr.c
50         sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memchr.c > \
51           ${.TARGET}
52
53 memmem.c:       $S/../lib/libc/string/memmem.c
54         sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memmem.c > \
55           ${.TARGET}
56
57 CLEANFILES+=memchr.c memmem.c
58
59 ashldi3.o:      $S/libkern/ashldi3.c
60         ${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
61
62 divsi3.o:       $S/libkern/${M}/divsi3.S
63         ${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
64
65 muldi3.o:       $S/libkern/${M}/muldi3.c
66         ${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
67
68 inflate.c:      $S/kern/inflate.c
69         sed -e 's/extern void putstr (char/extern void putstr (const char/' < \
70             $S/kern/inflate.c > ${.TARGET}
71
72 CLEANFILES+=inflate.c
73
74 .include <bsd.prog.mk>
75