summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile10
-rw-r--r--common.mk2
-rw-r--r--flash_erase.c1
-rw-r--r--include/common.h1
-rw-r--r--nanddump.c1
-rw-r--r--nandwrite.c1
7 files changed, 13 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 849265d..86aee63 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,6 +50,7 @@
#
# Generated include files
#
+/include/version.h
# stgit generated dirs
patches-*
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
#
diff --git a/common.mk b/common.mk
index d0e207d..ba87377 100644
--- a/common.mk
+++ b/common.mk
@@ -75,7 +75,7 @@ $(BUILDDIR)/%.a:
$(Q)$(AR) cr $@ $^
$(Q)$(RANLIB) $@
-$(BUILDDIR)/%.o: %.c
+$(BUILDDIR)/%.o: %.c $(OBJDEPS)
ifneq ($(BUILDDIR),$(CURDIR))
$(Q)mkdir -p $(dir $@)
endif
diff --git a/flash_erase.c b/flash_erase.c
index e0d2d4c..220f85a 100644
--- a/flash_erase.c
+++ b/flash_erase.c
@@ -19,7 +19,6 @@
*/
#define PROGRAM_NAME "flash_erase"
-#define VERSION "2.1.0"
#include <inttypes.h>
#include <stdio.h>
diff --git a/include/common.h b/include/common.h
index 7ea282c..65ec086 100644
--- a/include/common.h
+++ b/include/common.h
@@ -25,6 +25,7 @@
#include <string.h>
#include <fcntl.h>
#include <errno.h>
+#include "version.h"
#ifndef PROGRAM_NAME
# error "You must define PROGRAM_NAME before including this header"
diff --git a/nanddump.c b/nanddump.c
index 54198ae..27b0f7a 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -14,7 +14,6 @@
*/
#define PROGRAM_NAME "nanddump"
-#define VERSION "1.31"
#define _GNU_SOURCE
#include <ctype.h>
diff --git a/nandwrite.c b/nandwrite.c
index 6e986c5..1700d61 100644
--- a/nandwrite.c
+++ b/nandwrite.c
@@ -20,7 +20,6 @@
*/
#define PROGRAM_NAME "nandwrite"
-#define VERSION "$Revision: 1.32 $"
#define _GNU_SOURCE
#include <ctype.h>