[Top][All Lists]

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

Re: GNU make source code

From: Paul D. Smith
Subject: Re: GNU make source code
Date: Thu, 11 May 2006 08:54:59 -0400

%% "Leeuwesteijn,Joost" <address@hidden> writes:

  l> Is there some document/txt-file that explains the inner workings of
  l> GNU make and its source code? Or source code == documentation?
  l> Things I'd like to know for example: does GNU make read makefiles
  l> line by line, or does it use some kind of lexer/parser mechanism?
  l> I'd like to know more about the make internals, and what you'd have
  l> to do if you want to make changes, but I don't really know where to
  l> start. Any...pointers?

Not really.  The best thing to do is use a debugger and step through it.

As to your questions: GNU make uses a line-by-line handcrafted parser,
not a LALR or whatever parser.  A formal parser is a bit hard to manage
for makefiles, because they have completely different syntax and
semantics rules for different parts of the makefile.

You can look at the read.c file in the GNU make sources; all parsing of
makefiles is done there.

Also be aware that, as a GNU program copyright by the FSF, if you want
to submit any significant amount of code to the project you'll need to
file legal papers with the FSF assigning your copyright on that code to
them.  Contact me if you'd like more information about this.

  l> Not that I want to submit patches or anything yet, I just want to
  l> know more about the source code. I think it's a shame that there
  l> are multiple make variants (which is also a good thing I guess)
  l> which have a lot more functionality but have other
  l> disadvantages... (for example: OpenOffice dmake (excellent but
  l> unsupported?), ClearCase omake (impressive, non-free), mcrsft nmake
  l> (one or two useful features)). Why not submit patches into one
  l> let's-have-it-all make? :-)

ClearCase's clearmake is actually not that great.  The big thing it has
is its integration with the ClearCase MVFS filesystem, which gives a
bunch of advantages that the other make's can't meet.  But, that only
works in ClearCase; outside of ClearCase the only thing it has is some
cross-platform portability in that it can emulate (some features of)
other versions of make.

I'm not familiar with ClearCase "omake", although there is another
"omake" I think; maybe it's an emulation?

Anyway, a critical feature of GNU make is that it's conformant to the
POSIX standard for make.  Any new feature which broke that compatibility
would need to be considered very critically before being accepted.

But, if there are features you care about please propose them or code

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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