Compute version only once

In a make-file the =-assignment is replaced textually each time it is
referenced, which leads to the shell fragments to be executed each time.
Use the :=-assignment instead, which computes the value only once.

Signed-off-by: Andrew McMillan <andrew@morphoss.com>
This commit is contained in:
Philipp Matthias Hahn 2012-01-11 23:14:24 +01:00 committed by Andrew McMillan
parent 83b11a162d
commit 05613124ce

View File

@ -1,11 +1,11 @@
#!/usr/bin/make -f
#
package=davical
majorversion = $(shell sed -n 's:\([0-9\.]*\)[-a-f0-9-]*:\1:p' VERSION)
gitrev = 0
version = $(majorversion)
issnapshot = 0
package := davical
majorversion := $(shell sed -n 's:\([0-9\.]*\)[-a-f0-9-]*:\1:p' VERSION)
gitrev := 0
version := $(majorversion)
issnapshot := 0
snapshot : gitrev = $(shell git rev-parse --short HEAD)
snapshot : version = $(majorversion)-git$(gitrev)
snapshot : issnapshot = 1