Merge from vendor branch GDB:
[dragonfly.git] / sys / boot / powerpc / loader / Makefile
1 # $FreeBSD: src/sys/boot/powerpc/loader/Makefile,v 1.11 2003/08/16 02:48:20 obrien Exp $
2 # $DragonFly: src/sys/boot/powerpc/loader/Makefile,v 1.1 2003/11/10 06:08:40 dillon Exp $
3
4 BASE=           loader
5 PROG=           ${BASE}
6 NOMAN=
7 STRIP=
8 NEWVERSWHAT=    "bootstrap loader" OpenFirmware/PowerPC
9 BINDIR?=        /boot
10 INSTALLFLAGS=   -b
11
12 LOADER_DISK_SUPPORT?=   yes
13 LOADER_NET_SUPPORT?=    yes
14
15 CFLAGS+=        -ffreestanding
16 # load address
17 RELOC?=         0x6c0000
18 CFLAGS+=        -DRELOC=${RELOC}
19
20 # architecture-specific loader code
21 SRCS=           conf.c metadata.c
22
23 # Pull in common loader code
24 .PATH:          ${.CURDIR}/../../ofw/common
25 .include        <${.CURDIR}/../../ofw/common/Makefile.inc>
26
27 .if defined(LOADER_DISK_SUPPORT)
28 CFLAGS+=        -DLOADER_DISK_SUPPORT
29 .endif
30 .if defined(LOADER_NET_SUPPORT)
31 CFLAGS+=        -DLOADER_NET_SUPPORT
32 .endif
33
34 ###.if !defined(NOFORTH)
35 #### Enable BootForth
36 ###BOOT_FORTH=  yes
37 ###CFLAGS+=     -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
38 ###.if exists(${.OBJDIR}/../../ficl/libficl.a)
39 ###LIBFICL=     ${.OBJDIR}/../../ficl/libficl.a
40 ###.else
41 ###LIBFICL=     ${.CURDIR}/../../ficl/libficl.a
42 ###.endif
43 ###.endif
44
45 # Always add MI sources 
46 .PATH:          ${.CURDIR}/../../common
47 .include        <${.CURDIR}/../../common/Makefile.inc>
48 CFLAGS+=        -I${.CURDIR}/../../common
49 CFLAGS+=        -I${.CURDIR}/../../.. -I.
50
51 CLEANFILES+=    vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help
52
53 LDFLAGS=        -nostdlib -static -Ttext ${RELOC}
54
55 # OpenFirmware standalone support library
56 LIBOFW=         ${.OBJDIR}/../../ofw/libofw/libofw.a
57 CFLAGS+=        -I${.CURDIR}/../../ofw/libofw
58
59 # where to get libstand from
60 #XXX need a better way to do this
61 LIBSTAND=       ${.CURDIR}/../../../../lib/libstand/libstand.a
62 .if !exists(${LIBSTAND})
63 LIBSTAND=       ${.OBJDIR}/../../../../lib/libstand/libstand.a
64 .if !exists(${LIBSTAND})
65 LIBSTAND=       -lstand
66 .endif
67 .endif
68 CFLAGS+=        -I${.CURDIR}/../../../../lib/libstand/
69
70 # OpenFirmware is expecting ELF components
71 CFLAGS+=        -elf
72
73 # Debug me!
74 CFLAGS+=        -g
75 LDFLAGS+=       -g
76
77 vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
78         sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
79         ${CC} -c vers.c
80
81 ${BASE}.help: help.common help.ofw
82         cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
83
84 beforeinstall:
85 .if exists(${.OBJDIR}/loader.help)
86         ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
87                 ${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
88 .else
89         ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
90                 ${.CURDIR}/${BASE}.help ${DESTDIR}/boot
91 .endif
92 .if !exists(${DESTDIR}/boot/loader.rc)
93         ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
94                 ${.CURDIR}/../../forth/loader.rc ${DESTDIR}/boot
95 .endif
96         ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
97                 ${.CURDIR}/../../forth/loader.4th ${DESTDIR}/boot
98         ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
99                 ${.CURDIR}/../../forth/support.4th ${DESTDIR}/boot
100         ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
101                 ${.CURDIR}/../../forth/loader.conf ${DESTDIR}/boot/defaults
102
103 ${PROG}: ${OBJS} ${LIBOFW} ${LIBSTAND} ${LIBFICL} start.o vers.o
104         ${LD} ${LDFLAGS} -o ${.TARGET} start.o ${OBJS} \
105                 vers.o ${LIBFICL} ${LIBOFW} ${LIBSTAND}
106
107 machine:
108         ln -sf ${.CURDIR}/../../../powerpc/include machine
109
110 # Cannot use ${OBJS} above this line
111 .include <bsd.prog.mk>
112
113 beforedepend ${OBJS}: machine
114
115 CLEANFILES+=    machine setdefs.h setdef0.c setdef1.c setdef0.o setdef1.o \
116                 start.o