lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 906d442 1/5: Use multiline variables directly


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 906d442 1/5: Use multiline variables directly in the makefile
Date: Sun, 12 Mar 2017 21:12:54 -0400 (EDT)

branch: master
commit 906d442e37e5323897fc7abcdf9ec53e76d00b79
Author: Vadim Zeitlin <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Use multiline variables directly in the makefile
    
    Use GNU make "define" mechanism to define the variables we need
    naturally and "export" to let the shell expand them.
    
    This frees us from the need to write "\n"s and then use "printf %b" to
    expand them.
---
 GNUmakefile | 64 +++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 29 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 1dfdeaf..5536408 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -189,15 +189,23 @@ date:
 # useful because releases can easily be found with this command:
 #   git log --follow version.hpp
 
+define version_hpp_text
+$(gpl_notices)
+
+#ifndef version_hpp
+#define version_hpp
+
+#include "config.hpp"
+
+#define LMI_VERSION "$(yyyymmddhhmm)"
+
+#endif // version_hpp
+endef
+export version_hpp_text
+
 .PHONY: release_candidate
 release_candidate:
-       @printf '%b' \
-         $(gpl_notices) \
-         '#ifndef version_hpp\n' \
-         '#define version_hpp\n\n' \
-         '#include "config.hpp"\n\n' \
-         '#define LMI_VERSION "$(yyyymmddhhmm)"\n\n' \
-         '#endif // version_hpp\n' \
+       @$(ECHO) "$$version_hpp_text" \
          | $(SED) -e 's/^ *//' \
          | $(TR) --delete '\r' \
          > version.hpp
@@ -227,28 +235,26 @@ quoted_gpl_html: COPYING
        | $(TR) --delete '\r' \
        >$(src_dir)/$@
 
-gpl_notices := \
-"\
-// Copyright (C) $(yyyy) Gregory W. Chicares.\n\
-//\n\
-// This program is free software; you can redistribute it and/or modify\n\
-// it under the terms of the GNU General Public License version 2 as\n\
-// published by the Free Software Foundation.\n\
-//\n\
-// This program is distributed in the hope that it will be useful,\n\
-// but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
-// GNU General Public License for more details.\n\
-//\n\
-// You should have received a copy of the GNU General Public License\n\
-// along with this program; if not, write to the Free Software Foundation,\n\
-// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA\n\
-//\n\
-// http://savannah.nongnu.org/projects/lmi\n\
-// email: <address@hidden>\n\
-// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA\n\
-\n\
-"
+define gpl_notices :=
+// Copyright (C) $(yyyy) Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// http://savannah.nongnu.org/projects/lmi
+// email: <address@hidden>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+endef
 
 
################################################################################
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]