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