omf-expctl is also updated
[omf.git] / Makefile
1 # $Id: Makefile 16421 2010-01-04 11:29:55Z thierry $
2 # $URL: svn+ssh://thierry@svn.planet-lab.org/svn/madwifi/trunk/Makefile $
3 #
4 WEBFETCH                := curl -H Pragma: -O -R -S --fail --show-error
5 SHA1SUM                 := sha1sum
6
7 #REPO :=        http://pkg.mytestbed.net/omf-5.3-federation-v1.1/yum/base/8/i386/
8 REPO := http://mirror.onelab.eu/third-party/omf-5.3-federation-v1.1
9
10 ALL += omf-resctl
11 omf-resctl-URL          := $(REPO)/omf-resctl-5.3-1ubuntu7-2.noarch.rpm
12 omf-resctl-SHA1SUM      := c757123d216e7a11ab971101d2e9fdf450dd301d
13 omf-resctl              := $(notdir $(omf-resctl-URL))
14 ALL += omf-common
15 omf-common-URL          := $(REPO)/omf-common-5.3-1ubuntu6-2.noarch.rpm
16 omf-common-SHA1SUM      := f79ecfc7e6bad69fa4b980c8e8ec3ea35723f83c
17 omf-common              := $(notdir $(omf-common-URL))
18 ALL += liblog4r
19 liblog4r-URL            := $(REPO)/liblog4r-ruby1.8-1.2-1.noarch.rpm
20 liblog4r-SHA1SUM        := 4301cc01e65fdd1c136356ea8735ef935d997ccc
21 liblog4r                := $(notdir $(liblog4r-URL))
22 ALL += libxmpp4r
23 libxmpp4r-URL           := $(REPO)/libxmpp4r-ruby1.8-1.0-1.noarch.rpm
24 libxmpp4r-SHA1SUM       := 3332f38a3de90a9e0947d50d48d955cb946eba35
25 libxmpp4r               := $(notdir $(libxmpp4r-URL))
26 ALL += imagezip
27 imagezip-URL            := $(REPO)/imagezip-1.0.0-3.i386.rpm
28 imagezip-SHA1SUM        := 88088ca0aed57edc2b6ad6acc65a0038486fe67e
29 imagezip                := $(notdir $(imagezip-URL))
30
31 ALL += omf-expctl
32 omf-expctl-URL          := $(REPO)/omf-expctl-5.3-1ubuntu6-2.noarch.rpm
33 omf-expctl-SHA1SUM      := 6db226d88849da4519bbdb19fd90dbfd1c2571e7
34 omf-expctl              := $(notdir $(omf-expctl-URL))
35
36 all: $(ALL)
37 .PHONY: all
38
39 ##############################
40 define download_target
41 $(1): $($(1))
42 .PHONY: $($(1))
43 $($(1)): 
44         @if [ ! -e "$($(1))" ] ; then echo "$(WEBFETCH) $($(1)-URL)" ; $(WEBFETCH) $($(1)-URL) ; fi
45         @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
46         @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
47             echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
48             echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
49             echo "In Makefile: $($(1)-SHA1SUM)" ; \
50             false ; \
51         else \
52             ls -l $($(1)) ; \
53         fi
54 CLEAN += $($(1))
55 endef
56
57 $(eval $(call download_target,omf-resctl))
58 $(eval $(call download_target,omf-common))
59 $(eval $(call download_target,liblog4r))
60 $(eval $(call download_target,libxmpp4r))
61 $(eval $(call download_target,imagezip))
62
63 $(eval $(call download_target,omf-expctl))
64
65 clean:
66         rm -f $(CLEAN)
67 .PHONY: clean
68
69 repobase:=$(subst http://pkg.mytestbed.net/,,$(subst /yum/base/8/i386/,,$(REPO)))
70 # this echoes a script that can be ran on the mirror
71 mirror: 
72         @( echo mkdir -p $(repobase); echo cd $(repobase) ; \
73           $(foreach target,$(ALL), echo curl -O $(REPO)/$($(target)) ; ) )
74
75 .PHONY: mirror
76
77 #################### convenience, for debugging only
78 # make +foo : prints the value of $(foo)
79 # make ++foo : idem but verbose, i.e. foo=$(foo)
80 ++%: varname=$(subst +,,$@)
81 ++%:
82         @echo "$(varname)=$($(varname))"
83 +%: varname=$(subst +,,$@)
84 +%:
85         @echo "$($(varname))"