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