1
2override XEN_TARGET_ARCH = x86_32
3XEN_ROOT = $(CURDIR)/../../..
4include $(XEN_ROOT)/tools/Rules.mk
5include Config
6
7ifeq ($(GIT_HTTP),y)
8IPXE_GIT_URL ?= http://git.ipxe.org/ipxe.git
9else
10IPXE_GIT_URL ?= git://git.ipxe.org/ipxe.git
11endif
12
13IPXE_GIT_TAG := 1dd56dbd11082fb622c2ed21cfaced4f47d798a6
14
15IPXE_TARBALL_URL ?= $(XEN_EXTFILES_URL)/ipxe-git-$(IPXE_GIT_TAG).tar.gz
16
17D=ipxe
18T=ipxe.tar.gz
19
20ROMS = $(addprefix $D/src/bin/, $(addsuffix .rom, $(ETHERBOOT_NICS)))
21ROM = $D/src/bin/ipxe.bin
22
23.NOTPARALLEL:
24
25.PHONY: all
26all: $(ROM)
27
28$(ROM): $(ROMS)
29	cat $^ > $@.tmp
30	mv -f $@.tmp $@
31
32%.rom: $D/src/arch/i386/Makefile
33	$(MAKE) -C $D/src bin/$(*F).rom
34
35$T:
36	set -e; if ! $(FETCHER) _$T $(IPXE_TARBALL_URL); then \
37		$(GIT) clone $(IPXE_GIT_URL) $D.git; \
38		(cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \
39		$(IPXE_GIT_TAG) | gzip -n >../_$T); \
40		rm -rf $D.git; \
41	fi
42	mv _$T $T
43
44$D/src/arch/i386/Makefile: $T Config
45	rm -rf $D
46	gzip -dc $T | tar xf -
47	for i in $$(cat patches/series) ; do                 \
48	    patch -d $D -p1 --quiet <patches/$$i || exit 1 ; \
49	done
50	cat Config >>$@
51
52$D/src/bin/NIC: $D/src/arch/i386/Makefile
53	$(MAKE) -C $D/src bin/NIC
54
55.PHONY: clean
56clean:
57	rm -rf $D $D.git *~ _$T $T
58
59.PHONY: distclean
60distclean: clean
61	rm -rf $T
62