X-Git-Url: http://git.onelab.eu/?p=util-vserver.git;a=blobdiff_plain;f=Makefile;fp=Makefile;h=4fda659dc4968faa6b7f9580efaf7be4978bf22c;hp=0000000000000000000000000000000000000000;hb=db5ef3f969fc6ad34aeb5903e44d0049b2e50791;hpb=95e2774070e989fe9cf9f48dae5fa054e55e2a3e diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4fda659 --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ +# $Id$ +# $URL$ +# +WEBFETCH := wget +SHA1SUM := sha1sum + +ALL += util-vserver +util-vserver-URL := http://build.planet-lab.org/third-party/util-vserver-0.30.216-pre2883.tar.bz2 +util-vserver-SHA1SUM := 232282d9093adecb5b365cc8afb669fd2910c5f9 +util-vserver := $(notdir $(util-vserver-URL)) + +all: $(ALL) +.PHONY: all + +############################## +define download_target +$(1): $($(1)) +.PHONY: $($(1)) +$($(1)): + @if [ ! -e "$($(1))" ] ; then echo "$(WEBFETCH) $($(1)-URL)" ; $(WEBFETCH) $($(1)-URL) ; fi + @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi + @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \ + echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \ + echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \ + echo "In Makefile: $($(1)-SHA1SUM)" ; \ + false ; \ + else \ + ls -l $($(1)) ; \ + fi +endef + +$(eval $(call download_target,util-vserver)) + +sources: $(ALL) +.PHONY: sources + +#################### +# default - overridden by the build +SPECFILE = util-vserver.spec + +PWD=$(shell pwd) +PREPARCH ?= noarch +RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)" +trees: sources + rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE) + +srpm: sources + rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE) + +TARGET ?= $(shell uname -m) +rpm: sources + rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE) + +clean: + rm -f *.rpm *.tgz *.bz2 *.gz + +++%: varname=$(subst +,,$@) +++%: + @echo "$(varname)=$($(varname))" ++%: varname=$(subst +,,$@) ++%: + @echo "$($(varname))"