AMD64 - Fix native-built sys/boot install
[dragonfly.git] / sys / boot / pc32 / pxeldr / Makefile
1 # $FreeBSD: src/sys/boot/i386/pxeldr/Makefile,v 1.9 2003/09/03 08:12:20 phk Exp $
2 # $DragonFly: src/sys/boot/pc32/pxeldr/Makefile,v 1.5 2004/07/18 23:40:09 dillon Exp $
3
4 ORG=            0x7c00
5
6 LDR=            pxeldr
7 BOOT?=          pxeboot
8 LOADER?=        loader
9 PROG=           ${BOOT}
10 MAN=            ${BOOT}.8
11 STRIP=
12 BINDIR?=        /boot
13
14 .if defined(BOOT_PXELDR_PROBE_KEYBOARD)
15 CFLAGS+=        -DPROBE_KEYBOARD
16 .endif
17
18 .if defined(BOOT_PXELDR_ALWAYS_SERIAL)
19 CFLAGS+=        -DALWAYS_SERIAL
20 .endif
21
22
23 .if exists(${.OBJDIR}/../loader)
24 LOADERBIN?=     ${.OBJDIR}/../loader/loader.bin
25 .else
26 LOADERBIN?=     ${.CURDIR}/../loader/loader.bin
27 .endif
28
29 # BTX components
30 .if exists(${.OBJDIR}/../btx)
31 BTXDIR=         ${.OBJDIR}/../btx
32 .else
33 BTXDIR=         ${.CURDIR}/../btx
34 .endif
35 BTXLDR=         ${BTXDIR}/btxldr/btxldr
36 BTXKERN=        ${BTXDIR}/btx/btx
37 BTXCRT=         ${BTXDIR}/lib/crt0.o
38
39 ${BOOT}: ${LDR} ${LOADER}
40         cat ${LDR} ${LOADER} > ${.TARGET}.tmp
41         dd if=${.TARGET}.tmp of=${.TARGET} obs=2k conv=osync
42         rm ${.TARGET}.tmp
43
44 ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN} ${BTXCRT}
45         btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
46             -b ${BTXKERN} ${LOADERBIN}
47
48 ${LDR}: ${LDR}.o
49         ${LD} ${LDFLAGS} -N -e start -Ttext ${ORG} -o ${LDR}.out ${LDR}.o
50         objcopy -S -O binary ${LDR}.out ${.TARGET}
51
52 ${LDR}.o: ${LDR}.S
53         ${CC} ${CFLAGS} ${.IMPSRC} -o ${LDR}.o -c
54
55 CLEANFILES+= ${LDR} ${LDR}.out ${LDR}.o ${BOOT}.tmp ${LOADER}
56
57 .include <bsd.prog.mk>