summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-06-25 13:20:38 -0400
committerArtem Bityutskiy <dedekind1@gmail.com>2011-06-27 09:07:33 +0300
commitfdb28b9abed0f1a573168dba565f2d57e322158f (patch)
tree9a04eaf2a7a07c659502974bc6511cf2c26542a1 /Makefile
parent3285a49dd871d54c1ec13076173ad617443baae1 (diff)
autogenerate version.h from build system
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 10 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index bd5ada3..8f871c6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
# -*- sh -*-
+VERSION = 1.4.5
+
CPPFLAGS += -I./include -I./ubi-utils/include $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
ifeq ($(WITHOUT_XATTR), 1)
@@ -36,6 +38,8 @@ TARGETS = $(BINS)
TARGETS += lib/libmtd.a
TARGETS += ubi-utils/libubi.a
+OBJDEPS = $(BUILDDIR)/include/version.h
+
include common.mk
clean::
@@ -49,6 +53,7 @@ endif
find $(BUILDDIR)/ -xdev \
'(' -name '*.[ao]' -o -name '.*.c.dep' ')' \
-exec rm -f {} +
+ rm -f $(BUILDDIR)/include/version.h
$(MAKE) -C $(TESTS) clean
install:: ${BINS} ${SCRIPTS}
@@ -63,6 +68,11 @@ tests::
cscope:
cscope -bR
+$(BUILDDIR)/include/version.h: $(BUILDDIR)/include/version.h.tmp
+ $(Q)cmp -s $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@
+$(BUILDDIR)/include/version.h.tmp:
+ $(Q)echo '#define VERSION "$(VERSION)"' > $@
+
#
# Utils in top level
#