aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware/etherboot/Makefile
blob: b5fc17edc750135fc824531dacd9bdd0dccad489 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
override XEN_TARGET_ARCH = x86_32
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/Rules.mk
include Config

ifeq ($(GIT_HTTP),y)
IPXE_GIT_URL := http://git.ipxe.org/ipxe.git
else
IPXE_GIT_URL := git://git.ipxe.org/ipxe.git
endif

IPXE_GIT_TAG := v1.0.0

D=ipxe
T=ipxe-git-snapshot.tar.gz

ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(NICS)))

.NOTPARALLEL:

.PHONY: all
all: eb-roms.h

%.rom: $D/src/arch/i386/Makefile
	$(MAKE) -C $D/src bin/$(*F).rom

eb-roms.h.new: $(ROMS)
	cat $^ | ../hvmloader/mkhex etherboot >$@

eb-roms.h: Config
	$(MAKE) NO_WERROR=1 $@.new
	mv -f $@.new $@

$T:
	$(GIT) clone $(IPXE_GIT_URL) $D.git
	cd $D.git && \
	$(GIT) archive --format=tar --prefix=$D/ $(IPXE_GIT_TAG) | gzip >../$T
	rm -rf $D.git

$D/src/arch/i386/Makefile: $T Config
	rm -rf $D
	gzip -dc $T | tar xf -
	for i in $$(cat patches/series) ; do                 \
	    patch -d $D -p1 --quiet <patches/$$i || exit 1 ; \
	done
	cat Config >>$@

$D/src/bin/NIC: $D/src/arch/i386/Makefile
	$(MAKE) -C $D/src bin/NIC

.PHONY: clean
clean:
	rm -rf $D $D.git *~ eb-roms.h

.PHONY: distclean
distclean: clean
	rm -rf $T