use onelab mirror for now
[madwifi.git] / Makefile
1 # $Id$
2 #WEBFETCH       := curl -H Pragma: -O -R -S --fail --show-error
3 WEBFETCH        := wget
4 SHA1SUM = sha1sum
5
6 # default - overridden by the build
7 SPECFILE = madwifi.spec
8
9 main.URL        := http://mirror.onelab.eu/third-party/madwifi-trunk-r4099-20091230.tar.gz
10 main.SHA1SUM    := 9af68baf89c1303d5e69c8bb9c75cc9be1085668  
11 main.FILE       := $(notdir $(main.URL))
12
13 # Thierry - when called from within the build, PWD is /build
14 SOURCEFILES := $(main.FILE)
15
16 $(main.FILE): #FORCE
17         @if [ ! -e "$@" ] ; then echo "$(WEBFETCH) $(main.URL)" ; $(WEBFETCH) $(main.URL) ; fi
18         @if [ ! -e "$@" ] ; then echo "Could not download source file: $@ does not exist" ; exit 1 ; fi
19         @if test "$$(sha1sum $@ | awk '{print $$1}')" != "$(main.SHA1SUM)" ; then \
20             echo "sha1sum of the downloaded $@ does not match the one from 'sources' file" ; \
21             echo "Local copy: $$(sha1sum $@)" ; \
22             echo "In sources: $$(grep $@ sources)" ; \
23             exit 1 ; \
24         else \
25             ls -l $@ ; \
26         fi
27
28 sources: $(SOURCEFILES)
29 .PHONY: sources
30
31 PWD=$(shell pwd)
32 PREPARCH ?= noarch
33 RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
34 trees: sources
35         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
36
37 srpm: sources
38         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
39
40 TARGET ?= $(shell uname -m)
41 rpm: sources
42         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
43
44 clean:
45         rm -f *.rpm *.tgz *.bz2 *.gz
46
47 ++%: varname=$(subst +,,$@)
48 ++%:
49         @echo "$(varname)=$($(varname))"
50 +%: varname=$(subst +,,$@)
51 +%:
52         @echo "$($(varname))"