OSDN Git Service

Defer generation of version.c until "make" time.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 25 Sep 2012 19:38:41 +0000 (20:38 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Tue, 25 Sep 2012 19:38:41 +0000 (20:38 +0100)
--HG--
rename : version.c.in => src/version.c.in

ChangeLog
Makefile.in
configure.ac
src/version.c.in [moved from version.c.in with 62% similarity]

index 56bee2f..f060ecc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2012-09-25  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Defer generation of version.c until "make" time.
+
+       * version.c.in: Move it...
+       * src/version.c.in: ...to here.
+       (PACKAGE_NAME, PACKAGE_VERSION, COPYRIGHT_HOLDER, YEARS_OF_ISSUE):
+       Change substitution field marker character from "@" to "%".
+
+       * configure.ac (AC_CONFIG_FILES): Remove version.c
+
+       * Makefile.in (TAG_SCRIPT): New macro, factored out from...
+       (RC_SCRIPT): ...here, whence use it; also use it to implement...
+       (VERSION_SCRIPT): ...this further new macro; use it in...
+       (%.c): ...this generic template rule for version.c
+       (time-stamp, %.time, %.tagged.time, %.tag): New generic build
+       goals; use them to track package release progression via...
+       (build.tag): ...this new intermediate; make it a pre-requisite...
+       (guidata.OBJEXT, version.c): ...of these.
+
 2012-09-21  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Implement framework for GUI sash window layout controller.
index 3727572..ec9be79 100644 (file)
@@ -55,11 +55,18 @@ ARFLAGS = @ARFLAGS@
 
 RC = @RC@
 RC_SCRIPT = tag=$(BUILD_TAG); \
-  test "x$$tag" != x && tag="-$(GUI_RELEASE_CLASS)-$$tag"; sed \
-    -e "s!%PACKAGE_NAME%!$(PACKAGE_TARNAME)!g" \
-    -e "s!%PACKAGE_VERSION%!$(PACKAGE_VERSION)$$tag!g" \
-    -e "s!%COPYRIGHT_HOLDER%!@COPYRIGHT_HOLDER@!g" \
-    -e "s!%YEARS_OF_ISSUE%!@YEARS_OF_ISSUE@!g"
+  test "x$$tag" != x && tag="-$(GUI_RELEASE_CLASS)-$$tag"; \
+    $(TAG_SCRIPT)
+
+VERSION_SCRIPT = tag=$(BUILD_TAG); \
+  test "x$$tag" != x && tag="-$(CLI_RELEASE_CLASS)-$$tag"; \
+    $(TAG_SCRIPT)
+
+TAG_SCRIPT = sed \
+  -e "s!%PACKAGE_NAME%!$(PACKAGE_TARNAME)!g" \
+  -e "s!%PACKAGE_VERSION%!$(PACKAGE_VERSION)$$tag!g" \
+  -e "s!%COPYRIGHT_HOLDER%!@COPYRIGHT_HOLDER@!g" \
+  -e "s!%YEARS_OF_ISSUE%!@YEARS_OF_ISSUE@!g"
 
 RC_INCLUDES = -I ${srcdir}/src -I ${srcdir}/icons
 
@@ -137,6 +144,28 @@ sinclude *.d
 %.$(OBJEXT): %.ico
        echo $* ICON $*.ico | $(RC) -I ${srcdir}/icons -o $@
 
+# Release tagging...
+#
+time-stamp:
+%.tagged.time: time-stamp
+       > $*.time
+
+%.time:
+       > $*.time
+
+%.tag: %.tagged.time
+       >> $@; tag=`date +%Y%m%d`; \
+         tag=`awk -F- -v today=$$tag ' \
+           BEGIN { tag = 1 } $$1 == today { tag += $$2 } \
+           END { print today "-" tag }' $@`; \
+         echo $$tag > $@
+
+%.c: %.c.in
+       $(VERSION_SCRIPT) $< > $@
+
+version.c: build.time
+guidata.$(OBJEXT): build.time
+
 # Installation tools and directory paths...
 #
 mkinstalldirs = @MKDIR_P@
index 1072844..8af450c 100644 (file)
 
 # Establish the product version banner, and create a makefile
 #
-  AC_CONFIG_FILES([version.c Makefile])
+  AC_CONFIG_FILES([Makefile])
   MINGW_AC_OUTPUT
 #
 # $RCSfile$: end of file
similarity index 62%
rename from version.c.in
rename to src/version.c.in
index b70c820..7cf172c 100644 (file)
@@ -1,12 +1,15 @@
 /*
- * @configure_input@
+ * version.c
  *
+ * File automatically generated -- do not edit in place!!!
+ *
+ * Generated from template:
  * $Id$
  *
  */
 const char *version_identification =
-"@PACKAGE_NAME@ version @PACKAGE_VERSION@\n"
-"Copyright (C) @YEARS_OF_ISSUE@, @COPYRIGHT_HOLDER@\n"
+"%PACKAGE_NAME% version %PACKAGE_VERSION%\n"
+"Copyright (C) %YEARS_OF_ISSUE%, %COPYRIGHT_HOLDER%\n"
 "\n"
 "This is free software; see the product documentation, or source code,\n"
 "for copying and redistribution conditions.  There is NO WARRANTY; not\n"