Groups | Search | Server Info | Login | Register


Groups > comp.os.os2.programmer.tools > #6

Re: makefile help

From Dave Yeo <dave.r.yeo@gmail.com>
Newsgroups comp.os.os2.programmer.tools
Subject Re: makefile help
Date 2011-06-03 19:35 -0700
Organization Aioe.org NNTP Server
Message-ID <isc5kp$mr3$1@speranza.aioe.org> (permalink)
References <4rkzjBzzMnpe-pn2-u8c6O7dJXUj4@x.y.z>

Show all headers | View raw


John Small wrote:
> Are there any tools which will resursively build a list of "private"
> header files used by a source file?

There's makedepend.exe which came with XFree86 and probably other 
sources. From the man page,

The makedepend program reads each sourcefile  in  sequence
and  parses  it  like  a  C-preprocessor,  processing  all
#include, #define, #undef, #ifdef, #ifndef,  #endif,  #if,
#elif  and  #else directives so that it can correctly tell
which #include, directives would be used in a compilation.
Any  #include, directives can reference files having other
#include directives, and parsing will occur in these files
as well.
  Every  file  that a sourcefile includes, directly or indi-
  rectly, is what  makedepend  calls  a  dependency.   These
  dependencies  are then written to a makefile in such a way
  that make(1) will know which object files must  be  recom-
  piled when a dependency has changed.

  By default, makedepend places its output in the file named
  makefile if it exists, otherwise Makefile.   An  alternate
  makefile  may  be  specified with the -f option.  It first
  searches the makefile for the line

      # DO NOT DELETE THIS LINE -- make  depend  depends  on
  it.

  or one provided with the -s option, as a delimiter for the
  dependency output.  If it finds it, it will delete  every-
  thing  following  this  to the end of the makefile and put
  the output after this line.  If it doesn't  find  it,  the
  program  will append the string to the end of the makefile
  and place the output following that.  For each  sourcefile
  appearing  on  the  command line, makedepend puts lines in
  the makefile of the form
       sourcefile.o: dfile ...

  Where sourcefile.o is the name from the command line  with
  its suffix replaced with ``.o'', and dfile is a dependency
  discovered in a #include directive while  parsing  source-
  file or one of the files it included.
EXAMPLE
        Normally,  makedepend will be used in a makefile target so
        that typing ``make depend'' will bring the dependencies up
        to date for the makefile.  For example,
            SRCS = file1.c file2.c ...


This probably works best with Gnu make. The other stuff you mentioned 
might also be easier to implement with Gnu make as well.
Dave

Back to comp.os.os2.programmer.tools | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

makefile help "John Small" <zjsmallz@os2world.net> - 2011-06-03 07:29 -0500
  Re: makefile help Dave Yeo <dave.r.yeo@gmail.com> - 2011-06-03 19:35 -0700
  Re: makefile help Paul Ratcliffe <abuse@orac12.clara34.co56.uk78> - 2011-06-04 09:35 +0000

csiph-web