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