[BACK]Return to make.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/make.h between version 1.30 and 1.31

version 1.30, 2001/03/02 16:57:26 version 1.31, 2001/05/03 13:41:08
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenPackages$ */
   /*      $OpenBSD$ */
 /*      $NetBSD: make.h,v 1.15 1997/03/10 21:20:00 christos Exp $       */  /*      $NetBSD: make.h,v 1.15 1997/03/10 21:20:00 christos Exp $       */
   
 /*  /*
Line 56 
Line 57 
 #include <ctype.h>  #include <ctype.h>
   
 #ifdef __GNUC__  #ifdef __GNUC__
 #define UNUSED  __attribute__((unused))  # define UNUSED __attribute__((__unused__))
   # define HAS_INLINES
   # define INLINE  __inline__
 #else  #else
 #define UNUSED  # define UNUSED
 #endif  #endif
   
   #ifdef HAS_INLINES
   # ifndef INLINE
   #  define INLINE        inline
   # endif
   #endif
   
 #if !defined(MAKE_BOOTSTRAP) && defined(BSD4_4)  #if !defined(MAKE_BOOTSTRAP) && defined(BSD4_4)
 # include <sys/cdefs.h>  # include <sys/cdefs.h>
 #else  
 # ifndef __P  
 #  if defined(__STDC__) || defined(__cplusplus)  
 #   define      __P(protos)     protos          /* full-blown ANSI C */  
 #  else  
 #   define      __P(protos)     ()              /* traditional C preprocessor */  
 #  endif  
 # endif  
 # ifndef __STDC__  
 #  ifndef const  
 #   define const  
 #  endif  
 #  ifndef volatile  
 #   define volatile  
 #  endif  
 # endif  
 #endif  #endif
   
 #ifdef __STDC__  #ifdef __STDC__
Line 121 
Line 114 
 typedef time_t TIMESTAMP;  typedef time_t TIMESTAMP;
 #define is_out_of_date(t)       ((t) == INT_MIN)  #define is_out_of_date(t)       ((t) == INT_MIN)
 #define set_out_of_date(t)      (t) = INT_MIN  #define set_out_of_date(t)      (t) = INT_MIN
 #define grab_stat(s, t) \  #define grab_stat(s, t) \
 do { \  do { \
         (t) = (s).st_mtime; \          (t) = (s).st_mtime; \
         if (is_out_of_date(t)) \          if (is_out_of_date(t)) \
Line 138 
Line 131 
 #define timestamp2time_t(t)     (t)  #define timestamp2time_t(t)     (t)
 #endif  #endif
   
 /* Variables that are kept in local GNodes.  */  /* local contexts are real small */
 #define TARGET_INDEX    0  #define TARGET_INDEX    0
 #define OODATE_INDEX    1  #define PREFIX_INDEX    1
 #define ALLSRC_INDEX    2  #define ARCHIVE_INDEX   2
 #define IMPSRC_INDEX    3  #define MEMBER_INDEX    3
 #define PREFIX_INDEX    4  #define OODATE_INDEX    4
 #define ARCHIVE_INDEX   5  #define ALLSRC_INDEX    5
 #define MEMBER_INDEX    6  #define IMPSRC_INDEX    6
   
 #define LOCAL_SIZE      7  #define LOCAL_SIZE      7
   
   /* extended indices for System V stuff */
   #define FTARGET_INDEX   7
   #define DTARGET_INDEX   8
   #define FPREFIX_INDEX   9
   #define DPREFIX_INDEX   10
   #define FARCHIVE_INDEX  11
   #define DARCHIVE_INDEX  12
   #define FMEMBER_INDEX   13
   #define DMEMBER_INDEX   14
   
   #define EXTENDED2SIMPLE(i)      (((i)-LOCAL_SIZE)/2)
   #define IS_EXTENDED_F(i)        ((i)%2 == 1)
   
   struct Var_;
   
 /* SymTable is private to var.c, but is declared here to allow for  /* SymTable is private to var.c, but is declared here to allow for
    local declaration of context tables     local declaration of context tables
  */   */
Line 157 
Line 165 
 } SymTable;  } SymTable;
   
 typedef struct ohash GSymT;  typedef struct ohash GSymT;
   
 /*-  /*-
  * The structure for an individual graph node. Each node has several   * The structure for an individual graph node. Each node has several
  * pieces of data associated with it.   * pieces of data associated with it.
Line 186 
Line 195 
  *         to create this target.   *         to create this target.
  */   */
 typedef struct GNode_ {  typedef struct GNode_ {
     char            *path;      /* The full pathname of the file */      char            *path;      /* The full pathname of the file */
     int             type;       /* Its type (see the OP flags, below) */      int             type;       /* Its type (see the OP flags, below) */
     int             order;      /* Its wait weight */      int             order;      /* Its wait weight */
   
     Boolean         make;       /* TRUE if this target needs to be remade */      Boolean         make;       /* TRUE if this target needs to be remade */
     enum {      enum {
         UNMADE, BEINGMADE, MADE, UPTODATE, ERROR, ABORTED,          UNMADE, BEINGMADE, MADE, UPTODATE, ERROR, ABORTED,
         CYCLE, ENDCYCLE          CYCLE, ENDCYCLE
     }               made;       /* Set to reflect the state of processing      }               made;       /* Set to reflect the state of processing
                                  * on this node:                                   * on this node:
                                  *  UNMADE - Not examined yet                                   *  UNMADE - Not examined yet
                                  *  BEINGMADE - Target is already being made.                                   *  BEINGMADE - Target is already being made.
                                  *      Indicates a cycle in the graph. (compat                                   *      Indicates a cycle in the graph. (compat
                                  *      mode only)                                   *      mode only)
                                  *  MADE - Was out-of-date and has been made                                   *  MADE - Was out-of-date and has been made
                                  *  UPTODATE - Was already up-to-date                                   *  UPTODATE - Was already up-to-date
                                  *  ERROR - An error occured while it was being                                   *  ERROR - An error occured while it was being
                                  *      made (used only in compat mode)                                   *      made (used only in compat mode)
                                  *  ABORTED - The target was aborted due to                                   *  ABORTED - The target was aborted due to
                                  *      an error making an inferior (compat).                                   *      an error making an inferior (compat).
                                  *  CYCLE - Marked as potentially being part of                                   *  CYCLE - Marked as potentially being part of
                                  *      a graph cycle. If we come back to a                                   *      a graph cycle. If we come back to a
                                  *      node marked this way, it is printed                                   *      node marked this way, it is printed
                                  *      and 'made' is changed to ENDCYCLE.                                   *      and 'made' is changed to ENDCYCLE.
                                  *  ENDCYCLE - the cycle has been completely                                   *  ENDCYCLE - the cycle has been completely
                                  *      printed. Go back and unmark all its                                   *      printed. Go back and unmark all its
                                  *      members.                                   *      members.
                                  */                                   */
     Boolean         childMade;  /* TRUE if one of this target's children was      Boolean         childMade;  /* TRUE if one of this target's children was
                                  * made */                                   * made */
     int             unmade;     /* The number of unmade children */      int             unmade;     /* The number of unmade children */
   
     TIMESTAMP       mtime;      /* Its modification time */      TIMESTAMP       mtime;      /* Its modification time */
     TIMESTAMP       cmtime;     /* The modification time of its youngest      TIMESTAMP       cmtime;     /* The modification time of its youngest
                                  * child */                                   * child */
   
     LIST            iParents;   /* Links to parents for which this is an      LIST            iParents;   /* Links to parents for which this is an
                                  * implied source, if any */                                   * implied source, if any */
     LIST            cohorts;    /* Other nodes for the :: operator */      LIST            cohorts;    /* Other nodes for the :: operator */
     LIST            parents;    /* Nodes that depend on this one */      LIST            parents;    /* Nodes that depend on this one */
     LIST            children;   /* Nodes on which this one depends */      LIST            children;   /* Nodes on which this one depends */
     LIST            successors; /* Nodes that must be made after this one */      LIST            successors; /* Nodes that must be made after this one */
     LIST            preds;      /* Nodes that must be made before this one */      LIST            preds;      /* Nodes that must be made before this one */
   
     SymTable        context;    /* The local variables */      SymTable        context;    /* The local variables */
     unsigned long   lineno;     /* First line number of commands.  */      unsigned long   lineno;     /* First line number of commands.  */
     const char *    fname;      /* File name of commands.  */      const char *    fname;      /* File name of commands.  */
     LIST            commands;   /* Creation commands */      LIST            commands;   /* Creation commands */
       LstNode         current;    /* Current command, for job */
   
     struct Suff_    *suffix;    /* Suffix for the node (determined by      struct Suff_    *suffix;    /* Suffix for the node (determined by
                                  * Suff_FindDeps and opaque to everyone                                   * Suff_FindDeps and opaque to everyone
                                  * but the Suff module) */                                   * but the Suff module) */
     char      name[1];          /* The target's name */      char      name[1];          /* The target's name */
 } GNode;  } GNode;
   
 /*  /*
  * Manifest constants  
  */  
   
 /*  
  * The OP_ constants are used when parsing a dependency line as a way of   * The OP_ constants are used when parsing a dependency line as a way of
  * communicating to other parts of the program the way in which a target   * communicating to other parts of the program the way in which a target
  * should be made. These constants are bitwise-OR'ed together and   * should be made. These constants are bitwise-OR'ed together and
Line 264 
Line 270 
 #define OP_OPTIONAL     0x00000008  /* Don't care if the target doesn't  #define OP_OPTIONAL     0x00000008  /* Don't care if the target doesn't
                                      * exist and can't be created */                                       * exist and can't be created */
 #define OP_USE          0x00000010  /* Use associated commands for parents */  #define OP_USE          0x00000010  /* Use associated commands for parents */
 #define OP_EXEC         0x00000020  /* Target is never out of date, but always  #define OP_EXEC         0x00000020  /* Target is never out of date, but always
                                      * execute commands anyway. Its time                                       * execute commands anyway. Its time
                                      * doesn't matter, so it has none...sort                                       * doesn't matter, so it has none...sort
                                      * of */                                       * of */
Line 272 
Line 278 
 #define OP_PRECIOUS     0x00000080  /* Don't remove the target when  #define OP_PRECIOUS     0x00000080  /* Don't remove the target when
                                      * interrupted */                                       * interrupted */
 #define OP_SILENT       0x00000100  /* Don't echo commands when executed */  #define OP_SILENT       0x00000100  /* Don't echo commands when executed */
 #define OP_MAKE         0x00000200  /* Target is a recurrsive make so its  #define OP_MAKE         0x00000200  /* Target is a recurrsive make so its
                                      * commands should always be executed when                                       * commands should always be executed when
                                      * it is out of date, regardless of the                                       * it is out of date, regardless of the
                                      * state of the -n or -t flags */                                       * state of the -n or -t flags */
 #define OP_JOIN         0x00000400  /* Target is out-of-date only if any of its  #define OP_JOIN         0x00000400  /* Target is out-of-date only if any of its
                                      * children was out-of-date */                                       * children was out-of-date */
 #define OP_MADE         0x00000800  /* Assume the node is already made; even if  #define OP_MADE         0x00000800  /* Assume the node is already made; even if
                                      * it really is out of date */                                       * it really is out of date */
 #define OP_INVISIBLE    0x00004000  /* The node is invisible to its parents.  #define OP_INVISIBLE    0x00004000  /* The node is invisible to its parents.
                                      * I.e. it doesn't show up in the parents's                                       * I.e. it doesn't show up in the parents's
Line 289 
Line 295 
 #define OP_NOPATH       0x00020000  /* Don't search for file in the path */  #define OP_NOPATH       0x00020000  /* Don't search for file in the path */
 /* Attributes applied by PMake */  /* Attributes applied by PMake */
 #define OP_TRANSFORM    0x80000000  /* The node is a transformation rule */  #define OP_TRANSFORM    0x80000000  /* The node is a transformation rule */
 #define OP_MEMBER       0x40000000  /* Target is a member of an archive */  #define OP_MEMBER       0x40000000  /* Target is a member of an archive */
 #define OP_LIB          0x20000000  /* Target is a library */  #define OP_LIB          0x20000000  /* Target is a library */
 #define OP_ARCHV        0x10000000  /* Target is an archive construct */  #define OP_ARCHV        0x10000000  /* Target is an archive construct */
 #define OP_HAS_COMMANDS 0x08000000  /* Target has all the commands it should.  #define OP_HAS_COMMANDS 0x08000000  /* Target has all the commands it should.
                                      * Used when parsing to catch multiple                                       * Used when parsing to catch multiple
                                      * commands for a target */                                       * commands for a target */
 #define OP_SAVE_CMDS    0x04000000  /* Saving commands on .END (Compat) */  #define OP_SAVE_CMDS    0x04000000  /* Saving commands on .END (Compat) */
Line 307 
Line 313 
 #define OP_NOTARGET (OP_NOTMAIN|OP_USE|OP_EXEC|OP_TRANSFORM)  #define OP_NOTARGET (OP_NOTMAIN|OP_USE|OP_EXEC|OP_TRANSFORM)
   
 /*  /*
  * The TARG_ constants are used when calling the Targ_FindNode function in   * The TARG_ constants are used when calling the Targ_FindNode functions targ.c.
  * targ.c. They simply tell the function what to do if the desired node(s)   * They simply tell the function what to do if the desired node is not found.
  * is (are) not found.   * If the TARG_CREATE constant is given, a new, empty node will be created
  * If the TARG_CREATE constant is given, a new, empty node will be created   * for the target, placed in the table of all targets and its address returned.
  * for the target, placed in the table of all targets and its address returned.  
  * If TARG_NOCREATE is given, a NULL pointer will be returned.   * If TARG_NOCREATE is given, a NULL pointer will be returned.
  */   */
 #define TARG_CREATE     0x01      /* create node if not found */  #define TARG_CREATE     0x01      /* create node if not found */
Line 329 
Line 334 
 #define MAKE_BSIZE              256     /* starting size for expandable buffers */  #define MAKE_BSIZE              256     /* starting size for expandable buffers */
   
 /*  /*
  * These constants are all used by the Str_Concat function to decide how the  
  * final string should look. If STR_ADDSPACE is given, a space will be  
  * placed between the two strings. If STR_ADDSLASH is given, a '/' will  
  * be used instead of a space. If neither is given, no intervening characters  
  * will be placed between the two strings in the final output. If the  
  * STR_DOFREE bit is set, the two input strings will be freed before  
  * Str_Concat returns.  
  */  
 #define STR_ADDSPACE    0x01    /* add a space when Str_Concat'ing */  
 #define STR_DOFREE      0x02    /* free source strings after concatenation */  
 #define STR_ADDSLASH    0x04    /* add a slash when Str_Concat'ing */  
   
 /*  
  * Error levels for parsing. PARSE_FATAL means the process cannot continue   * Error levels for parsing. PARSE_FATAL means the process cannot continue
  * once the makefile has been parsed. PARSE_WARNING means it can. Passed   * once the makefile has been parsed. PARSE_WARNING means it can. Passed
  * as the first argument to Parse_Error.   * as the first argument to Parse_Error.
Line 352 
Line 344 
 /*  /*
  * Values returned by Cond_Eval.   * Values returned by Cond_Eval.
  */   */
 #define COND_PARSE      0       /* Parse the next lines */  #define COND_PARSE      0       /* Parse the next lines */
 #define COND_SKIP       1       /* Skip the next lines */  #define COND_SKIP       1       /* Skip the next lines */
 #define COND_INVALID    2       /* Not a conditional statement */  #define COND_INVALID    2       /* Not a conditional statement */
   
 /*  /*
  * Definitions for the "local" variables. Used only for clarity.   * Definitions for the "local" variables. Used only for clarity.
  */   */
 #define TARGET            "@"   /* Target of dependency */  #define TARGET            "@"   /* Target of dependency */
 #define OODATE            "?"   /* All out-of-date sources */  #define OODATE            "?"   /* All out-of-date sources */
 #define ALLSRC            ">"   /* All sources */  #define ALLSRC            ">"   /* All sources */
 #define IMPSRC            "<"   /* Source implied by transformation */  #define IMPSRC            "<"   /* Source implied by transformation */
 #define PREFIX            "*"   /* Common prefix */  #define PREFIX            "*"   /* Common prefix */
 #define ARCHIVE           "!"   /* Archive in "archive(member)" syntax */  #define ARCHIVE           "!"   /* Archive in "archive(member)" syntax */
 #define MEMBER            "%"   /* Member in "archive(member)" syntax */  #define MEMBER            "%"   /* Member in "archive(member)" syntax */
 #define LONGTARGET      ".TARGET"  #define LONGTARGET      ".TARGET"
 #define LONGOODATE      ".OODATE"  #define LONGOODATE      ".OODATE"
 #define LONGALLSRC      ".ALLSRC"  #define LONGALLSRC      ".ALLSRC"
Line 374 
Line 366 
 #define LONGARCHIVE     ".ARCHIVE"  #define LONGARCHIVE     ".ARCHIVE"
 #define LONGMEMBER      ".MEMBER"  #define LONGMEMBER      ".MEMBER"
   
   /* System V   extended variables (get directory/file part) */
   #define FTARGET         "@F"
   #define DTARGET         "@D"
   #define FIMPSRC         "<F"
   #define DIMPSRC         "<D"
   #define FPREFIX         "*F"
   #define DPREFIX         "*D"
   #define FARCHIVE        "!F"
   #define DARCHIVE        "!D"
   #define FMEMBER         "%F"
   #define DMEMBER         "%D"
   
 #define FTARGET           "@F"  /* file part of TARGET */  
 #define DTARGET           "@D"  /* directory part of TARGET */  
 #define FIMPSRC           "<F"  /* file part of IMPSRC */  
 #define DIMPSRC           "<D"  /* directory part of IMPSRC */  
 #define FPREFIX           "*F"  /* file part of PREFIX */  
 #define DPREFIX           "*D"  /* directory part of PREFIX */  
   
 /*  /*
  * Global Variables   * Global Variables
  */   */
 extern LIST     create;         /* The list of target names specified on the  extern LIST     create;         /* The list of target names specified on the
                                  * command line. used to resolve #if                                   * command line. used to resolve #if
                                  * make(...) statements */                                   * make(...) statements */
 extern LIST     dirSearchPath;  /* The list of directories to search when  extern LIST     dirSearchPath;  /* The list of directories to search when
                                  * looking for targets */                                   * looking for targets */
   
 extern Boolean  compatMake;     /* True if we are make compatible */  extern Boolean  compatMake;     /* True if we are make compatible */
 extern Boolean  ignoreErrors;   /* True if should ignore all errors */  extern Boolean  ignoreErrors;   /* True if should ignore all errors */
 extern Boolean  beSilent;       /* True if should print no commands */  extern Boolean  beSilent;       /* True if should print no commands */
 extern Boolean  noExecute;      /* True if should execute nothing */  extern Boolean  noExecute;      /* True if should execute nothing */
 extern Boolean  allPrecious;    /* True if every target is precious */  extern Boolean  allPrecious;    /* True if every target is precious */
 extern Boolean  keepgoing;      /* True if should continue on unaffected  extern Boolean  keepgoing;      /* True if should continue on unaffected
                                  * portions of the graph when have an error                                   * portions of the graph when have an error
                                  * in one portion */                                   * in one portion */
 extern Boolean  touchFlag;      /* TRUE if targets should just be 'touched'  extern Boolean  touchFlag;      /* TRUE if targets should just be 'touched'
                                  * if out of date. Set by the -t flag */                                   * if out of date. Set by the -t flag */
 extern Boolean  usePipes;       /* TRUE if should capture the output of  extern Boolean  usePipes;       /* TRUE if should capture the output of
                                  * subshells by means of pipes. Otherwise it                                   * subshells by means of pipes. Otherwise it
                                  * is routed to temporary files from which it                                   * is routed to temporary files from which it
                                  * is retrieved when the shell exits */                                   * is retrieved when the shell exits */
 extern Boolean  queryFlag;      /* TRUE if we aren't supposed to really make  extern Boolean  queryFlag;      /* TRUE if we aren't supposed to really make
                                  * anything, just see if the targets are out-                                   * anything, just see if the targets are out-
                                  * of-date */                                   * of-date */
   
 extern Boolean  checkEnvFirst;  /* TRUE if environment should be searched for  extern Boolean  checkEnvFirst;  /* TRUE if environment should be searched for
                                  * variables before the global context */                                   * variables before the global context */
   
 extern GNode    *DEFAULT;       /* .DEFAULT rule */  extern GNode    *DEFAULT;       /* .DEFAULT rule */
   
 extern GSymT    *VAR_GLOBAL;    /* Variables defined in a global context, e.g  extern GSymT    *VAR_GLOBAL;    /* Variables defined in a global context, e.g
                                  * in the Makefile itself */                                   * in the Makefile itself */
 extern GSymT    *VAR_CMD;       /* Variables defined on the command line */  extern GSymT    *VAR_CMD;       /* Variables defined on the command line */
 extern char     var_Error[];    /* Value returned by Var_Parse when an error  
   extern char     var_Error[];    /* Value returned by Var_Parse when an error
                                  * is encountered. It actually points to                                   * is encountered. It actually points to
                                  * an empty string, so naive callers needn't                                   * an empty string, so naive callers needn't
                                  * worry about it. */                                   * worry about it. */
   
 extern TIMESTAMP now;           /* The time at the start of this whole  extern TIMESTAMP now;           /* The time at the start of this whole
                                  * process */                                   * process */
   
 extern Boolean  oldVars;        /* Do old-style variable substitution */  extern Boolean  oldVars;        /* Do old-style variable substitution */
   
 extern LIST     sysIncPath;     /* The system include path. */  extern LIST     sysIncPath;     /* The system include path. */
   
Line 435 
Line 432 
  *      information to print.   *      information to print.
  */   */
 extern int debug;  extern int debug;
 #define DEBUG_ARCH      0x0001  #define DEBUG_ARCH      0x0001
 #define DEBUG_COND      0x0002  #define DEBUG_COND      0x0002
 #define DEBUG_DIR       0x0004  #define DEBUG_DIR       0x0004
 #define DEBUG_GRAPH1    0x0008  #define DEBUG_GRAPH1    0x0008
 #define DEBUG_GRAPH2    0x0010  #define DEBUG_GRAPH2    0x0010
 #define DEBUG_JOB       0x0020  #define DEBUG_JOB       0x0020
 #define DEBUG_MAKE      0x0040  #define DEBUG_MAKE      0x0040
 #define DEBUG_SUFF      0x0080  #define DEBUG_SUFF      0x0080
 #define DEBUG_TARG      0x0100  #define DEBUG_TARG      0x0100
 #define DEBUG_VAR       0x0200  #define DEBUG_VAR       0x0200
 #define DEBUG_FOR       0x0400  #define DEBUG_FOR       0x0400
   #define DEBUG_LOUD      0x0800
   
 #ifdef __STDC__  #ifdef __STDC__
 #define CONCAT(a,b)     a##b  #define CONCAT(a,b)     a##b
 #else  #else
 #define I(a)            a  #define I(a)            a
 #define CONCAT(a,b)     I(a)b  #define CONCAT(a,b)     I(a)b
 #endif /* __STDC__ */  #endif /* __STDC__ */
   
 #define DEBUG(module)   (debug & CONCAT(DEBUG_,module))  #define DEBUG(module)   (debug & CONCAT(DEBUG_,module))
   
 #include "extern.h"  #include "extern.h"
   

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31