2 WEBFETCH := curl -H Pragma: -O -R -S --fail --show-error
8 drupal-URL1 := http://ftp.drupal.org/files/projects/drupal-$(version).tar.gz
9 drupal-URL2 := http://mirror.onelab.eu/third-party/drupal-$(version).tar.gz
10 drupal-SHA1SUM := c9f767e6c2cd873c4b0bef1986e2821febfc7e34
11 drupal := $(notdir $(drupal-URL1))
14 taxo-URL1 := http://build.planet-lab.org/third-party/taxonomy_block-4.7.x-1.x-dev.tar.gz
15 taxo-URL2 := http://mirror.onelab.eu/third-party/taxonomy_block-4.7.x-1.x-dev.tar.gz
16 taxo-SHA1SUM := 9d926df1695c0092a74446154b00579d4ccbcb60
17 taxo := $(notdir $(taxo-URL1))
22 ##############################
23 define download_target
27 @if [ ! -e "$($(1))" ] ; then \
28 { echo Using primary; echo "$(WEBFETCH) $($(1)-URL1)" ; $(WEBFETCH) $($(1)-URL1) ; } || \
29 { echo Using secondary; echo "$(WEBFETCH) $($(1)-URL2)" ; $(WEBFETCH) $($(1)-URL2) ; } ; fi
30 @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
31 @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
32 echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
33 echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
34 echo "In Makefile: $($(1)-SHA1SUM)" ; \
41 $(eval $(call download_target,drupal))
42 $(eval $(call download_target,taxo))
48 # default - overridden by the build
49 SPECFILE = drupal.spec
53 RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
55 rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
58 rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
60 TARGET ?= $(shell uname -m)
62 rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
65 rm -f *.rpm *.tgz *.bz2 *.gz
67 ++%: varname=$(subst +,,$@)
69 @echo "$(varname)=$($(varname))"
70 +%: varname=$(subst +,,$@)