[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.6 dep-track options

This option is used to automate dependency tracking.

make-dep option (-M).

This is the “emit make dependency file” option. This option takes an optional string argument ‘type’.

This option has some usage constraints. It:

This option behaves fairly closely to the way the -M series of options work with the gcc compiler, except that instead of just emitting the predecessor dependencies, this also emits the successor dependencies (output target files). By default, the output dependency information will be placed in <base-name>.d, but may also be specified with -MF<file>. The time stamp on this file will be manipulated so that it will be one second older than the oldest primary output file.

The target in this dependency file will normally be the dependency file name, but may also be overridden with -MT<targ-name>. AutoGen will not alter the contents of that file, but it may create it and it will adjust the modification time to match the start time.

NB: these second letters are part of the option argument, so -MF <file> must have the space character quoted or omitted, and -M "F <file>" is acceptable because the F is part of the option argument.

-M may be followed by any of the letters M, F, P, T, Q, D, or G. However, only F, Q, T and P are meaningful. All but F have somewhat different meanings. -MT<name> is interpreted as meaning <name> is a sentinel file that will depend on all inputs (templates and definition files) and all the output files will depend on this sentinel file. It is suitable for use as a real make target. Q is treated identically to T, except dollar characters (’$’) are doubled. P causes a special clean (clobber) phoney rule to be inserted into the make file fragment. An empty rule is always created for building the list of targets.

This is the recommended usage:

 
  -MFwhatever-you-like.dep -MTyour-sentinel-file -MP

and then in your Makefile, make the ‘autogen’ rule:

 
  -include whatever-you-like.dep
  clean_targets += clean-your-sentinel-file

  your-sentinel-file:
      autogen -MT$@ -MF$*.d .....

  local-clean :
      rm -f $(clean_targets)

The modification time on the dependency file is adjusted to be one second before the earliest time stamp of any other output file. Consequently, it is suitable for use as the sentinel file testifying to the fact the program was successfully run. (-include is the GNU make way of specifying "include it if it exists". Your make must support that feature or your bootstrap process must create the file.)

All of this may also be specified using the DEPENDENCIES_OUTPUT or AUTOGEN_MAKE_DEP environment variables. If defined, dependency information will be output. If defined with white space free text that is something other than true, false, yes, no, 0 or 1, then the string is taken to be an output file name. If it contains a string of white space characters, the first token is as above and the second token is taken to be the target (sentinel) file as -MT in the paragraphs above. DEPENDENCIES_OUTPUT will be ignored if there are multiple sequences of white space characters or if its contents are, specifically, false, no or 0.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Bruce Korb on August 21, 2015 using texi2html 1.82.