Setting tag oml-2.6.1-1
[oml.git] / Makefile
1 #
2 WEBFETCH                := curl -H Pragma: -O -R -S --fail --show-error
3 SHA1SUM                 := sha1sum
4
5 # initial from http://oml.mytestbed.net/attachments/download/496/oml2-2.5.1.tar.gz
6 REPO := http://mirror.onelab.eu/third-party/
7
8 ALL += oml
9 oml-URL                 := $(REPO)/oml2-2.6.1.tar.gz
10 oml-SHA1SUM             := 529b23cc1199cac1bcd6066f9df9d8063a76da23
11 oml                     := $(notdir $(oml-URL))
12 ALL += oml
13
14 all: $(ALL)
15 .PHONY: all
16
17 ##############################
18 define download_target
19 $(1): $($(1))
20 .PHONY: $($(1))
21 $($(1)): 
22         @if [ ! -e "$($(1))" ] ; then echo "$(WEBFETCH) $($(1)-URL)" ; $(WEBFETCH) $($(1)-URL) ; 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 CLEAN += $($(1))
33 endef
34
35 $(eval $(call download_target,oml))
36
37 clean:
38         rm -f $(CLEAN)
39 .PHONY: clean
40
41 #################### convenience, for debugging only
42 # make +foo : prints the value of $(foo)
43 # make ++foo : idem but verbose, i.e. foo=$(foo)
44 ++%: varname=$(subst +,,$@)
45 ++%:
46         @echo "$(varname)=$($(varname))"
47 +%: varname=$(subst +,,$@)
48 +%:
49         @echo "$($(varname))"