Setting tag pyaspects-0.4.1-3
[pyaspects.git] / Makefile
1 #
2 WEBFETCH                := wget
3 SHA1SUM                 := sha1sum
4
5 ALL                     += pyaspects
6 pyaspects-URL1          := http://build.planet-lab.org/third-party/pyaspects-0.4.1.tar.gz
7 pyaspects-URL2          := http://mirror.onelab.eu/third-party/pyaspects-0.4.1.tar.gz
8 pyaspects-SHA1SUM       := 6b9f0b5711b98ed2a6c6a85713325158de96193a
9 pyaspects               := $(notdir $(pyaspects-URL1))
10
11 all: $(ALL)
12 .PHONY: all
13
14 ##############################
15 define download_target
16 $(1): $($(1))
17 .PHONY: $(1)
18 $($(1)): 
19         @if [ ! -e "$($(1))" ] ; then \
20         { echo Using primary; echo "$(WEBFETCH) $($(1)-URL1)" ; $(WEBFETCH) $($(1)-URL1) ; } || \
21         { echo Using secondary; echo "$(WEBFETCH) $($(1)-URL2)" ; $(WEBFETCH) $($(1)-URL2) ; } ; fi
22         @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
23         @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
24             echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
25             echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
26             echo "In Makefile: $($(1)-SHA1SUM)" ; \
27             false ; \
28         else \
29             ls -l $($(1)) ; \
30         fi
31 endef
32
33 $(eval $(call download_target,pyaspects))
34
35 sources: $(ALL) 
36 .PHONY: sources
37
38 ####################
39 # default - overridden by the build
40 SPECFILE = pyaspects.spec
41
42 PWD=$(shell pwd)
43 PREPARCH ?= noarch
44 RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
45 trees: sources
46         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
47
48 srpm: sources
49         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
50
51 TARGET ?= $(shell uname -m)
52 rpm: sources
53         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
54
55 clean:
56         rm -f *.rpm *.tgz *.bz2 *.gz
57
58 ++%: varname=$(subst +,,$@)
59 ++%:
60         @echo "$(varname)=$($(varname))"
61 +%: varname=$(subst +,,$@)
62 +%:
63         @echo "$($(varname))"