If you wish to use cflow to analyze your project sources, Makefile or Makefile.am is the right place to do so. In this chapter we will describe a generic rule for Makefile.am. If you do not use automake, you can deduce the rule for plain Makefile from this one.
Here is a check list of steps to do to set up a Makefile.am framework:
CFLOW_FLAGSwith any special cflow options you wish to use. The variable can be empty, its main purpose is making it possible to override cflow options by running make CFLOW_FLAGS=... chart.
_PROGRAMSlist, for which you want to generate a flow chart, add the following statements:
program_CFLOW_INPUT=$(program_OBJECTS:.$(OBJEXT)=.c) program.cflow: program_CFLOW_INPUT cflow.rc Makefile CFLOWRC=path-to-your-cflow.rc \ cflow -o$@ $(CFLOW_FLAGS) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) \ $(program_CFLOW_INPUT)
Replace program with program name and
path-to-your-cflow.rc with the full file name of your
cflow.rc file (if any). If you do not wish to use
preprocessing, remove from the cflow command line all
flowcharts: prog1.cflow prog2.cflow ...
As an example, here are the relevant statements which we use in cflow src/Makefile.am:
EXTRA_DIST=cflow.rc CFLOW_FLAGS=-i^s cflow_CFLOW_INPUT=$(cflow_OBJECTS:.$(OBJEXT)=.c) cflow.cflow: $(cflow_CFLOW_INPUT) cflow.rc Makefile CFLOWRC=$(top_srcdir)/src/cflow.rc \ cflow -o$@ $(CFLOW_FLAGS) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) \ $(cflow_CFLOW_INPUT)