From fdb28b9abed0f1a573168dba565f2d57e322158f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 25 Jun 2011 13:20:38 -0400 Subject: autogenerate version.h from build system Signed-off-by: Mike Frysinger --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Makefile') 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 # -- cgit v1.2.3