diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-06-25 13:20:38 -0400 |
---|---|---|
committer | Artem Bityutskiy <dedekind1@gmail.com> | 2011-06-27 09:07:33 +0300 |
commit | fdb28b9abed0f1a573168dba565f2d57e322158f (patch) | |
tree | 9a04eaf2a7a07c659502974bc6511cf2c26542a1 | |
parent | 3285a49dd871d54c1ec13076173ad617443baae1 (diff) |
autogenerate version.h from build system
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | common.mk | 2 | ||||
-rw-r--r-- | flash_erase.c | 1 | ||||
-rw-r--r-- | include/common.h | 1 | ||||
-rw-r--r-- | nanddump.c | 1 | ||||
-rw-r--r-- | nandwrite.c | 1 |
7 files changed, 13 insertions, 4 deletions
@@ -50,6 +50,7 @@ # # Generated include files # +/include/version.h # stgit generated dirs patches-* @@ -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 # @@ -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" @@ -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> |