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