Update to libvirt-0.10.1
[libvirt.git] / Makefile
1 WEBFETCH                := wget
2 SHA1SUM                 := sha1sum
3
4 ALL                     += libvirt
5 libvirt-URL            := ftp://libvirt.org/libvirt/libvirt-0.10.1.tar.gz
6 libvirt-SHA1SUM        := d079d549fa3852dcc7aab05577deaf6c4777ca7d
7 libvirt                := $(notdir $(libvirt-URL))
8
9 all: $(ALL)
10 .PHONY: all
11
12 ##############################
13 define download_target
14 $(1): $($(1))
15 .PHONY: $($(1))
16 $($(1)): 
17                 @if [ ! -e "$($(1))" ] ; then echo "$(WEBFETCH) $($(1)-URL)" ; $(WEBFETCH) $($(1)-URL) ; fi
18                 @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
19                 @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
20                         echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
21                         echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
22                         echo "In Makefile: $($(1)-SHA1SUM)" ; \
23                         false ; \
24                 else \
25                         ls -l $($(1)) ; \
26                 fi
27 endef
28
29 $(eval $(call download_target,libvirt))
30
31 sources: $(ALL) 
32 .PHONY: sources
33
34 ####################
35 # default - overridden by the build
36 SPECFILE = libvirt.spec
37
38 PWD=$(shell pwd)
39 PREPARCH ?= noarch
40 RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
41 BUILDOPTS = --without xen --without qemu --without hyperv --without phyp --without esx \
42                         --without netcf --without avahi --without polkit --without sasl --without audit \
43                         --without storage-iscsi --without storage-scsi --without storage-disk \
44                         --without storage-rbd --without selinux --without dtrace --without sanlock \
45                         --without libxl --with capng --with udev --with interface \
46                         --define 'packager PlanetLab'
47
48 trees: sources
49         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
50
51 srpm: sources
52         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
53
54 TARGET ?= $(shell uname -m)
55 rpm: sources
56         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) $(BUILDOPTS) -bb $(SPECFILE)
57
58 clean:
59         rm -f *.rpm *.tgz *.bz2 *.gz
60
61 ++%: varname=$(subst +,,$@)
62 ++%:
63                 @echo "$(varname)=$($(varname))"
64 +%: varname=$(subst +,,$@)
65 +%:
66                 @echo "$($(varname))"
67