xref: /illumos-gate/usr/src/boot/i386/pxeldr/Makefile (revision 8c0b080c8ed055a259d8cd26b9f005211c6a9753)
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
17include $(SRC)/boot/Makefile.inc
18
19ROOT_BOOT = $(ROOT)/boot
20
21DD=		/usr/bin/dd
22
23CPPFLAGS += -I../../sys
24CPPFLAGS += -I../common
25
26CCASFLAGS= -Wa,--divide
27
28include ../Makefile.inc
29
30BTXDIR= ../btx
31
32PROG=	$(LDR)
33INTERNALPROG=
34FILES=	$(BOOT)
35MAN=	$(BOOT).8
36SRCS=	$(LDR).S
37OBJS=	$(LDR).o
38CLEANFILES= $(BOOT) $(OBJS)
39
40BOOT=	pxeboot
41LDR=	pxeldr
42ORG=	0x7c00
43LOADER=	loader
44FILEMODE=0444
45
46#CFLAGS +=	-DPROBE_KEYBOARD
47
48#.if defined(BOOT_PXELDR_ALWAYS_SERIAL)
49#CFLAGS+=-DALWAYS_SERIAL
50#.endif
51
52LOADERBIN= ../loader/loader.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 += $(GLDTARGET) -e start -Ttext $(ORG) -N -S --oformat binary
62
63CLEANFILES += $(LOADER) $(LDR)
64
65$(LDR): $(OBJS)
66	$(GLD) $(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$(ROOT_BOOT)/%: %
81	$(INS.file)
82