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 := 356f6c1b64d7a97746d1816cef8ca22bdd8d0b5d
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)))
21
22.NOTPARALLEL:
23
24.PHONY: all
25all: $(ROMS)
26
27%.rom: $D/src/arch/i386/Makefile
28	$(MAKE) -C $D/src bin/$(*F).rom
29
30$T:
31	if ! $(FETCHER) _$T $(IPXE_TARBALL_URL); then \
32		$(GIT) clone $(IPXE_GIT_URL) $D.git; \
33		(cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \
34		$(IPXE_GIT_TAG) | gzip -n >../_$T); \
35		rm -rf $D.git; \
36	fi
37	mv _$T $T
38
39$D/src/arch/i386/Makefile: $T Config
40	rm -rf $D
41	gzip -dc $T | tar xf -
42	for i in $$(cat patches/series) ; do                 \
43	    patch -d $D -p1 --quiet <patches/$$i || exit 1 ; \
44	done
45	cat Config >>$@
46
47$D/src/bin/NIC: $D/src/arch/i386/Makefile
48	$(MAKE) -C $D/src bin/NIC
49
50.PHONY: clean
51clean:
52	rm -rf $D $D.git *~ _$T $T
53
54.PHONY: distclean
55distclean: clean
56	rm -rf $T
57