# git and lsb_release are required, and these rules must be run from within a git working copy
-export DISTRIB_CODENAME=$(shell lsb_release -cs)
+DISTRIB_CODENAME := $(shell lsb_release -cs)
+COMMITDESC := $(shell git describe --tags | sed -e 's/$$/-0/' -e 's/v\([^-]\+-[^-]\+\)\(-g[0-9a-f-]\+\|\)/\1/')
+COMMITDATE := $(shell git show -s --format=%cD)
ifeq ($(DISTRIB_CODENAME),)
DISTRIB_CODENAME=$(error Unable to identify distribution)
PKGVERSIONSUFFIX=~${DISTRIB_CODENAME}+1
endif
+
+BUILDDEPS := $(shell grep -v '^\s*(\#|$$$$)' debian/deps/build-$(DISTRIB_CODENAME) | tr '\n' ' ')
+BINDEPS := $(shell egrep -v '^\s*(\#|$$$$)' debian/deps/bin-$(DISTRIB_CODENAME) | tr '\n' ' ')
+
debian/control: debian/control.in debian/deps/build-$(DISTRIB_CODENAME) debian/deps/bin-$(DISTRIB_CODENAME)
- @BUILDDEPS=$$(egrep -v '^\s*(#|$$$$)' debian/deps/build-$(DISTRIB_CODENAME) | tr '\n' ' '); \
- BINDEPS=$$(egrep -v '^\s*(#|$$$$)' debian/deps/bin-$(DISTRIB_CODENAME) | tr '\n' ' '); \
- sed -e "s/%BUILDDEPS%/$$BUILDDEPS/" -e "s/%BINDEPS%/$$BINDEPS/" $< > $@
+ sed -e "s/%BUILDDEPS%/$(BUILDDEPS)/" -e "s/%BINDEPS%/$(BINDEPS)/" $< > $@
debian/changelog: debian/changelog.in debian/control
- @COMMITDESC=$$(git describe --tags | sed -e 's/$$/-0/' -e 's/v\([^-]\+-[^-]\+\)\(-g[0-9a-f-]\+\|\)/\1/') \
- COMMITDATE=$$(git show -s --format=%cD) && \
- sed -e "s/%COMMITDESC%/$$COMMITDESC${PKGVERSIONSUFFIX}/" -e "s/%COMMITDATE%/$$COMMITDATE/" \
- -e "s/%DIST%/$$DISTRIB_CODENAME/" $< > $@
+ sed -e "s/%COMMITDESC%/$(COMMITDESC)${PKGVERSIONSUFFIX}/" -e "s/%COMMITDATE%/$(COMMITDATE)/" \
+ -e "s/%DIST%/$(DISTRIB_CODENAME)/" $< > $@
CLEANFILES=debian/changelog debian/control