xref: /titanic_52/usr/src/boot/sys/boot/i386/pxeldr/Makefile (revision a71a9b4041b747842ca055046d2e2b9c3564a4a8)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2015 Toomas Soome <tsoome@me.com>
14#
15
16include $(SRC)/Makefile.master
17
18ROOT_BOOT = $(ROOT)/boot
19
20CC=	$(GCC_ROOT)/bin/gcc
21LD=	$(GNU_ROOT)/bin/gld
22DD=	/usr/bin/dd
23CFLAGS= -O2 -I../../..
24CCASFLAGS= -Wa,--divide
25
26include ../Makefile.inc
27
28BTXDIR=../btx
29
30PROG=	${LDR}
31INTERNALPROG=
32FILES=	${BOOT}
33MAN=	${BOOT}.8
34SRCS=	${LDR}.S
35OBJS=	${LDR}.o
36CLEANFILES= ${BOOT} ${OBJS}
37
38BOOT=	pxeboot
39LDR=	pxeldr
40ORG=	0x7c00
41LOADER=	loader
42FILEMODE=0444
43
44#CFLAGS +=	-DPROBE_KEYBOARD
45
46#.if defined(BOOT_PXELDR_ALWAYS_SERIAL)
47#CFLAGS+=-DALWAYS_SERIAL
48#.endif
49
50CFLAGS +=-I../common
51
52LOADERBIN= ../loader/zfsloader.bin
53
54CLEANFILES += ${BOOT}.tmp
55
56${BOOT}: ${LDR} ${LOADER}
57	$(CAT) ${LDR} ${LOADER} > $@.tmp
58	$(DD) if=$@.tmp of=$@ obs=2k conv=sync
59	$(RM) $@.tmp
60
61LDFLAGS +=-e start -Ttext ${ORG} -N -S --oformat binary
62
63CLEANFILES += ${LOADER} ${LDR}
64
65${LDR}: ${OBJS}
66	${LD} ${LDFLAGS} -o $@ $^
67
68${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN}
69	$(BTXLD) -f aout -e ${LOADER_ADDRESS} -o $@ -l ${BTXLDR} \
70	    -b ${BTXKERN} ${LOADERBIN}
71
72all: ${BOOT}
73
74install: $(BOOT:%=$(ROOT_BOOT)/%)
75
76clobber: clean
77clean:
78	$(RM) $(CLEANFILES)
79
80.S.o:
81	$(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $<
82
83$(ROOT_BOOT)/%: %
84	$(INS.file)
85