automake
[Top][All Lists]
Advanced

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

Re: Lex support for Makefile.am


From: Stefano Lattarini
Subject: Re: Lex support for Makefile.am
Date: Sat, 26 Nov 2011 11:58:43 +0100
User-agent: KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; )

On Friday 25 November 2011, kishoramballi  wrote:
> 
> I have a lex file in my project, the source file name is dmllex.lxx.
> 
> I want to generate dmllex.h and dmlex.cxx from the above file.
> 
> I want to know the lines to be put in my Makefile.am to generate these two
> files.
> 
> at present I have hardcoded the following lines in my Makefile.am.
> 
> dmlex.cxx: dmllex.lxx
>         flex --header-file = dmllex.h -o $@ $<
>
Note that this has a couple of problems:

 1. Use of `$<' is not portable to non-GNU make implementation.  This
    would be more portable:

      dmllex.cxx: dmllex.lxx
          flex --header-file=dmllex.h -o $@ dmllex.lxx

  2. The above does not express the dependency of dmllex.h from dmllex.lxx
     correctly.  You might want to take a look at this for more information
     about how to handle source files with multiple output file (this can
     be quite tricky!):
     
<http://www.gnu.org/software/automake/manual/html_node/Multiple-Outputs.html>

> These lines work in my system since I have flex in there.  But how about the
> systems that do not have flex?  I want to make it portable.
>
Then you should distribute the generated dmllex.cxx and dmllex.h files:

  EXTRA_DIST = dmllex.cxx dmllex.h 

This way, your users won't need to have lex installed to build from your
distribution tarball (unless they modify dmllex.lxx, of course, but in
this case you can assume that they know what they're doing, and that they
will install flex).

> Please help :working:
> 
> I am presently packaging the sources dmllex.cxx and dmllex.h files
> in the package.
> 
That's the best thing to do IMO (and that's what automake-generated rules
handling Yacc files do automatically).

HTH,
  Stefano



reply via email to

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