[ragel-users] [PATCH 4/6] Remove need for version.mk file.

Adrian Thurston thurs... at cs.queensu.ca
Mon Oct 6 17:34:21 UTC 2008


Again, is there a reason why this is better?

-Adrian

Diego 'Flameeyes' Pettenò wrote:
> Use autoconf to generate version.tex and the man pages, instead of
> using Makefile and version.mk. Also define PACKAGE_PUBDATE and
> PACKAGE_VERSION through autoconf/autoheader.
> ---
> 
>  Makefile.in              |    2 --
>  common/Makefile.in       |    6 +-----
>  configure.in             |   12 ++++++++----
>  doc/Makefile.in          |   14 ++------------
>  doc/ragel.1.in           |    2 +-
>  doc/rlgen-cd.1.in        |    2 +-
>  doc/rlgen-dot.1.in       |    2 +-
>  doc/rlgen-java.1.in      |    2 +-
>  doc/rlgen-ruby.1.in      |    2 +-
>  doc/version.tex.in       |    2 ++
>  ragel/main.cpp           |    2 +-
>  ragel/parsedata.cpp      |    4 ++--
>  redfsm/Makefile.in       |    2 --
>  redfsm/xmlparse.kl       |    2 +-
>  rlgen-cd/Makefile.in     |    2 --
>  rlgen-csharp/Makefile.in |    2 --
>  rlgen-csharp/main.cpp    |    2 +-
>  rlgen-dot/Makefile.in    |    2 --
>  rlgen-java/Makefile.in   |    2 --
>  rlgen-ruby/Makefile.in   |    2 --
>  version.mk               |    2 --
>  21 files changed, 23 insertions(+), 47 deletions(-)
>  create mode 100644 doc/version.tex.in
>  delete mode 100644 version.mk
> 
> diff --git a/Makefile.in b/Makefile.in
> index 2666c48..4619bb5 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -27,8 +27,6 @@ ALL_SUBDIRS = $(BUILD_COMMON) $(BUILD_SUBDIRS) test examples doc
>  # Programs
>  CXX = @CXX@
>  
> -# Get the version info.
> -include version.mk
>  
>  # build targets
>  all: $(BUILD_SUBDIRS)
> diff --git a/common/Makefile.in b/common/Makefile.in
> index 112e59c..e79d6a4 100644
> --- a/common/Makefile.in
> +++ b/common/Makefile.in
> @@ -40,8 +40,6 @@ RANLIB = @RANLIB@
>  OBJS = $(CC_SRCS:%.cpp=%.o)
>  DEPS = $(CC_SRCS:%.cpp=.%.d)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # rules
>  
> @@ -51,9 +49,7 @@ common.a: $(GEN_SRC) $(OBJS)
>  	$(AR) -cr $@ $(OBJS) 
>  	$(RANLIB) $@
>  
> -version.h: ../version.mk
> -	echo '#define VERSION "$(VERSION)"' > version.h
> -	echo '#define PUBDATE "$(PUBDATE)"' >> version.h
> +version.h:
>  	echo '#define PREFIX "$(prefix)"' >> version.h
>  
>  %.o: %.cpp
> diff --git a/configure.in b/configure.in
> index 3995551..85e93b0 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -16,11 +16,15 @@ dnl   GNU General Public License for more details.
>  dnl   
>  dnl   You should have received a copy of the GNU General Public License
>  dnl   along with Ragel; if not, write to the Free Software
> -dnl   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
> -  
> -AC_INIT(ragel/main.cpp)
> +dnl   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> +
> +AC_INIT(ragel/main.cpp, 6.3)
>  AC_CONFIG_HEADER(common/config.h)
>  
> +PACKAGE_PUBDATE="August 2008"
> +AC_SUBST(PACKAGE_PUBDATE)
> +AC_DEFINE_UNQUOTED([PACKAGE_PUBDATE], ["$PACKAGE_PUBDATE"], [Package publication date])
> +
>  dnl You need to enable this unless the generated files are included
>  dnl and don't need to be built.
>  AC_ARG_ENABLE([parsers],
> @@ -107,6 +111,6 @@ AC_CHECK_PROG(GMCS, gmcs, gmcs)
>  AC_SUBST(GMCS)
>  
>  dnl write output files
> -AC_OUTPUT(Makefile common/Makefile ragel/Makefile redfsm/Makefile rlgen-cd/Makefile rlgen-java/Makefile rlgen-ruby/Makefile rlgen-dot/Makefile rlgen-csharp/Makefile doc/Makefile test/Makefile test/runtests)
> +AC_OUTPUT(Makefile common/Makefile ragel/Makefile redfsm/Makefile rlgen-cd/Makefile rlgen-java/Makefile rlgen-ruby/Makefile rlgen-dot/Makefile rlgen-csharp/Makefile doc/Makefile test/Makefile test/runtests doc/ragel.1 doc/rlgen-cd.1 doc/rlgen-java.1 doc/rlgen-ruby.1 doc/rlgen-dot.1 doc/version.tex)
>  
>  echo "configuration of ragel complete"
> diff --git a/doc/Makefile.in b/doc/Makefile.in
> index a6ff456..6178f0d 100644
> --- a/doc/Makefile.in
> +++ b/doc/Makefile.in
> @@ -24,8 +24,6 @@ INPUT = version.tex ragel-guide.tex
>  FIGURES = $(wildcard *.fig)
>  PDFFIGS = $(FIGURES:%.fig=%.pdf)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # Installation locations.
>  PACKAGE     = ragel
> @@ -49,19 +47,11 @@ ragel-guide.pdf: $(PDFFIGS) $(INPUT)
>  	pdflatex -interaction=nonstopmode $< >/dev/null
>  	pdflatex -interaction=nonstopmode $< >/dev/null
>  
> -version.tex: ../version.mk
> -	echo '|def|version{$(VERSION)}' | tr '|' '\\' > version.tex
> -	echo '|def|pubdate{$(PUBDATE)}' | tr '|' '\\' >> version.tex
> -
> -%.1: %.1.in ../version.mk
> -	cat $< | sed 's/@PUBDATE@/$(PUBDATE)/' \
> -		| sed 's/@VERSION@/$(VERSION)/' > $@
> -
>  clean:
> -	rm -f $(MANPAGES) *.bak *.aux *.dvi *.log *.toc *.pdf
> +	rm -f *.bak *.aux *.dvi *.log *.toc *.pdf
>  
>  distclean: clean
> -	rm -f Makefile
> +	rm -f Makefile $(MANPAGES) version.tex
>  
>  man: $(MANPAGES)
>  
> diff --git a/doc/ragel.1.in b/doc/ragel.1.in
> index 68142e2..66753cc 100644
> --- a/doc/ragel.1.in
> +++ b/doc/ragel.1.in
> @@ -21,7 +21,7 @@
>  .\"   Process this file with
>  .\"   groff -man -Tascii ragel.1
>  .\"
> -.TH RAGEL 1 "@PUBDATE@" "Ragel @VERSION@" "Ragel State Machine Compiler"
> +.TH RAGEL 1 "@PACKAGE_PUBDATE@" "Ragel @PACKAGE_VERSION@" "Ragel State Machine Compiler"
>  .SH NAME
>  ragel \- compile regular languages into executable state machines 
>  .SH SYNOPSIS
> diff --git a/doc/rlgen-cd.1.in b/doc/rlgen-cd.1.in
> index 33cc088..0d0087f 100644
> --- a/doc/rlgen-cd.1.in
> +++ b/doc/rlgen-cd.1.in
> @@ -21,7 +21,7 @@
>  .\"   Process this file with
>  .\"   groff -man -Tascii rlgen-cd.1
>  .\"
> -.TH RLGEN-CD 1 "@PUBDATE@" "Ragel @VERSION@" "Ragel State Machine Compiler"
> +.TH RLGEN-CD 1 "@PACKAGE_PUBDATE@" "Ragel @PACKAGE_VERSION@" "Ragel State Machine Compiler"
>  .SH NAME
>  rlgen-cd \- code generator for Ragel State Machine Compiler
>  .SH SYNOPSIS
> diff --git a/doc/rlgen-dot.1.in b/doc/rlgen-dot.1.in
> index 5c24091..c7a7cbe 100644
> --- a/doc/rlgen-dot.1.in
> +++ b/doc/rlgen-dot.1.in
> @@ -21,7 +21,7 @@
>  .\"   Process this file with
>  .\"   groff -man -Tascii rlgen-dot.1
>  .\"
> -.TH RLGEN-DOT 1 "@PUBDATE@" "Ragel @VERSION@" "Ragel State Machine Compiler"
> +.TH RLGEN-DOT 1 "@PACKAGE_PUBDATE@" "Ragel @PACKAGE_VERSION@" "Ragel State Machine Compiler"
>  .SH NAME
>  rlgen-dot \- Dotfile generator for Ragel State Machine Compiler
>  .SH SYNOPSIS
> diff --git a/doc/rlgen-java.1.in b/doc/rlgen-java.1.in
> index c143d15..5528a2f 100644
> --- a/doc/rlgen-java.1.in
> +++ b/doc/rlgen-java.1.in
> @@ -21,7 +21,7 @@
>  .\"   Process this file with
>  .\"   groff -man -Tascii rlgen-java.1
>  .\"
> -.TH RLGEN-JAVA 1 "@PUBDATE@" "Ragel @VERSION@" "Ragel State Machine Compiler"
> +.TH RLGEN-JAVA 1 "@PACKAGE_PUBDATE@" "Ragel @PACKAGE_VERSION@" "Ragel State Machine Compiler"
>  .SH NAME
>  rlgen-java \- code generator for Ragel State Machine Compiler
>  .SH SYNOPSIS
> diff --git a/doc/rlgen-ruby.1.in b/doc/rlgen-ruby.1.in
> index 9aecfe2..08f1dce 100644
> --- a/doc/rlgen-ruby.1.in
> +++ b/doc/rlgen-ruby.1.in
> @@ -21,7 +21,7 @@
>  .\"   Process this file with
>  .\"   groff -man -Tascii rlgen-ruby.1
>  .\"
> -.TH RLGEN-RUBY 1 "@PUBDATE@" "Ragel @VERSION@" "Ragel State Machine Compiler"
> +.TH RLGEN-RUBY 1 "@PACKAGE_PUBDATE@" "Ragel @PACKAGE_VERSION@" "Ragel State Machine Compiler"
>  .SH NAME
>  rlgen-ruby \- code generator for Ragel State Machine Compiler
>  .SH SYNOPSIS
> diff --git a/doc/version.tex.in b/doc/version.tex.in
> new file mode 100644
> index 0000000..3c0fc35
> --- /dev/null
> +++ b/doc/version.tex.in
> @@ -0,0 +1,2 @@
> +\def\version{@PACKAGE_VERSION@}
> +\def\pubdate{@PACKAGE_PUBDATE@}
> diff --git a/ragel/main.cpp b/ragel/main.cpp
> index 1e7ccc0..56095db 100644
> --- a/ragel/main.cpp
> +++ b/ragel/main.cpp
> @@ -153,7 +153,7 @@ void usage()
>  /* Print version information and exit. */
>  void version()
>  {
> -	cout << "Ragel State Machine Compiler version " VERSION << " " PUBDATE << endl <<
> +	cout << "Ragel State Machine Compiler version " PACKAGE_VERSION " " PACKAGE_PUBDATE << endl <<
>  			"Copyright (c) 2001-2007 by Adrian Thurston" << endl;
>  	exit(0);
>  }
> diff --git a/ragel/parsedata.cpp b/ragel/parsedata.cpp
> index 73f52c6..3985b2f 100644
> --- a/ragel/parsedata.cpp
> +++ b/ragel/parsedata.cpp
> @@ -1482,7 +1482,7 @@ void writeMachines( std::ostream &out, std::string hostData,
>  		}
>  
>  		if ( gblErrorCount == 0 ) {
> -			out << "<ragel version=\"" VERSION "\" filename=\"" << inputFileName << "\"";
> +			out << "<ragel version=\"" PACKAGE_VERSION "\" filename=\"" << inputFileName << "\"";
>  			writeLanguage( out );
>  			out << ">\n";
>  			for ( ParserDict::Iter parser = parserDict; parser.lte(); parser++ ) {
> @@ -1523,7 +1523,7 @@ void writeMachines( std::ostream &out, std::string hostData,
>  			/* Section/Machine to emit was found. Prepare and emit it. */
>  			parseData->prepareMachineGen( graphDictEl );
>  			if ( gblErrorCount == 0 ) {
> -				out << "<ragel version=\"" VERSION "\" filename=\"" << inputFileName << "\"";
> +				out << "<ragel version=\"" PACKAGE_VERSION "\" filename=\"" << inputFileName << "\"";
>  				writeLanguage( out );
>  				out << ">\n";
>  				parseData->generateXML( out );
> diff --git a/redfsm/Makefile.in b/redfsm/Makefile.in
> index 951de79..8e67233 100644
> --- a/redfsm/Makefile.in
> +++ b/redfsm/Makefile.in
> @@ -41,8 +41,6 @@ RANLIB = @RANLIB@
>  OBJS = $(CC_SRCS:%.cpp=%.o)
>  DEPS = $(CC_SRCS:%.cpp=.%.d)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # Rules.
>  all: redfsm.a
> diff --git a/redfsm/xmlparse.kl b/redfsm/xmlparse.kl
> index e725fcc..6ce677a 100644
> --- a/redfsm/xmlparse.kl
> +++ b/redfsm/xmlparse.kl
> @@ -108,7 +108,7 @@ tag_ragel_head: TAG_ragel
>  		Attribute *versionAttr = $1->tag->findAttr( "version" );
>  		if ( versionAttr == 0 )
>  			error($1->loc) << "tag <ragel> requires a version attribute" << endp;
> -		if ( strcmp( versionAttr->value, VERSION ) != 0 )
> +		if ( strcmp( versionAttr->value, PACKAGE_VERSION ) != 0 )
>  			error($1->loc) << "version mismatch between frontend and backend" << endp;
>  
>  		/* Check for file name attribute. */
> diff --git a/rlgen-cd/Makefile.in b/rlgen-cd/Makefile.in
> index 49031e3..7b06285 100644
> --- a/rlgen-cd/Makefile.in
> +++ b/rlgen-cd/Makefile.in
> @@ -45,8 +45,6 @@ RANLIB = @RANLIB@
>  OBJS = $(CC_SRCS:%.cpp=%.o)
>  DEPS = $(CC_SRCS:%.cpp=.%.d)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # Rules.
>  all: rlgen-cd.a
> diff --git a/rlgen-csharp/Makefile.in b/rlgen-csharp/Makefile.in
> index fa57e49..fc5380f 100644
> --- a/rlgen-csharp/Makefile.in
> +++ b/rlgen-csharp/Makefile.in
> @@ -45,8 +45,6 @@ RANLIB = @RANLIB@
>  OBJS = $(CC_SRCS:%.cpp=%.o)
>  DEPS = $(CC_SRCS:%.cpp=.%.d)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # Rules.
>  all: rlgen-csharp.a
> diff --git a/rlgen-csharp/main.cpp b/rlgen-csharp/main.cpp
> index 1a78848..8a6fa4b 100644
> --- a/rlgen-csharp/main.cpp
> +++ b/rlgen-csharp/main.cpp
> @@ -92,7 +92,7 @@ void csharp_usage()
>  void csharp_version()
>  {
>  	cout << "Ragel Code Generator for C#" << endl <<
> -			"Version " VERSION << ", " PUBDATE << endl <<
> +			"Version " PACKAGE_VERSION ", " PACKAGE_PUBDATE << endl <<
>  			"Copyright (c) 2001-2007 by Adrian Thurston" << endl;
>  }
>  
> diff --git a/rlgen-dot/Makefile.in b/rlgen-dot/Makefile.in
> index 5d33931..c5611c2 100644
> --- a/rlgen-dot/Makefile.in
> +++ b/rlgen-dot/Makefile.in
> @@ -41,8 +41,6 @@ RANLIB = @RANLIB@
>  OBJS = $(CC_SRCS:%.cpp=%.o)
>  DEPS = $(CC_SRCS:%.cpp=.%.d)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # Rules.
>  all: rlgen-dot.a
> diff --git a/rlgen-java/Makefile.in b/rlgen-java/Makefile.in
> index 2fe5cd7..c429dde 100644
> --- a/rlgen-java/Makefile.in
> +++ b/rlgen-java/Makefile.in
> @@ -42,8 +42,6 @@ RANLIB = @RANLIB@
>  OBJS = $(CC_SRCS:%.cpp=%.o)
>  DEPS = $(CC_SRCS:%.cpp=.%.d)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # Rules.
>  all: rlgen-java.a
> diff --git a/rlgen-ruby/Makefile.in b/rlgen-ruby/Makefile.in
> index a0a2d52..96d5399 100644
> --- a/rlgen-ruby/Makefile.in
> +++ b/rlgen-ruby/Makefile.in
> @@ -43,8 +43,6 @@ RANLIB = @RANLIB@
>  OBJS = $(CC_SRCS:%.cpp=%.o)
>  DEPS = $(CC_SRCS:%.cpp=.%.d)
>  
> -# Get the version info.
> -include ../version.mk
>  
>  # Rules.
>  all: rlgen-ruby.a
> diff --git a/version.mk b/version.mk
> deleted file mode 100644
> index 12353fa..0000000
> --- a/version.mk
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -VERSION = 6.3
> -PUBDATE = August 2008
> 
> 
> 



More information about the ragel-users mailing list