views:

118

answers:

2

Hello,

As an exercise and in an effort to (better understand|help other people better understand) the build process at my company, I am hoping to create a directed acyclic graph of the build process.

The current build process at my work is, as I understand, is essentially running nmake on a makefil at the root build directory. This makefile that specifies a list of components to build and for each component the build script recurses to build sub-components, sub-sub-components, etc. Certain components are built into DLL/Libs which can be used for linking against when building other components, this relationship would be a dependency. I.e. if component B links against the lib file of component A, component A is a dependency of component B.

What I'm looking for is example code of how this would be done as I'm still learning about programming. Any suggestion would be appreciated, thanks!

+1  A: 

The command NMAKE /N /P will dump out the dependency relationships for the makefile, but not build anything.

The output is like this


obj\statbar.obj:
        flags:  -s
        dependents:     statbar.cpp obj\precomp.obj res\resource.h sfapp.h
                        frame.h prefs.h appopen.h
        commands:

obj\appopen.obj:
        flags:  -s
        dependents:     appopen.cpp obj\precomp.obj res\resource.h sfapp.h
                        frame.h prefs.h appopen.h
        commands: 

The output is pretty regular, You could parse it and use it build your graph.

John Knoeller
+1  A: 

Makefile::Graphviz can probably help here http://search.cpan.org/~agent/Makefile-GraphViz-0.18/lib/Makefile/GraphViz.pm

dontcallmedom