svn merge -r 12308:13112 https://svn.planet-lab.org/svn/Monitor/branches/2.0/
[monitor.git] / Makefile
1 # $Id$
2 CURL    := curl -H Pragma: -O -R -S --fail --show-error
3 SHA1SUM = sha1sum
4
5 # default - overridden by the build
6 SPECFILE = zabbix.spec
7
8 #main.URL       := http://voxel.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.6.1.tar.gz 
9 #main.SHA1SUM   := 6e66efdbbdf23dc3de01379b30ded7b005fb49d9
10 #main.URL       := http://superb-east.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.6.2.tar.gz
11 #main.SHA1SUM   := 575c443adec1703c2c242dbf353de9dc3bb4cafb
12 main.URL        := http://build.planet-lab.org/third-party/zabbix-1.6.2.tar.gz
13 main.SHA1SUM    := 575c443adec1703c2c242dbf353de9dc3bb4cafb
14 main.FILE       := $(notdir $(main.URL))
15
16 # Thierry - when called from within the build, PWD is /build
17 SOURCEFILES := $(main.FILE)
18
19 $(main.FILE): #FORCE
20         @if [ ! -e "$@" ] ; then echo "$(CURL) $(main.URL)" ; $(CURL) $(main.URL) ; fi
21         @if [ ! -e "$@" ] ; then echo "Could not download source file: $@ does not exist" ; exit 1 ; fi
22         @if test "$$(sha1sum $@ | awk '{print $$1}')" != "$(main.SHA1SUM)" ; then \
23             echo "sha1sum of the downloaded $@ does not match the one from 'sources' file" ; \
24             echo "Local copy: $$(sha1sum $@)" ; \
25             echo "In sources: $$(grep $@ sources)" ; \
26             exit 1 ; \
27         else \
28             ls -l $@ ; \
29         fi
30
31 sources: $(SOURCEFILES)
32 .PHONY: sources
33
34 PWD=$(shell pwd)
35 PREPARCH ?= noarch
36 RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
37
38 trees: sources
39         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
40
41 srpm: sources
42         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
43
44 TARGET ?= $(shell uname -m)
45 rpm: sources
46         rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
47
48 clean:
49         rm -f *.rpm *.tgz *.bz2 *.gz
50 clean:
51         rm *.pyc *.dat *.log