2005-05-08 04:38:47 +04:00
|
|
|
/* $NetBSd: make.h,v 1.53 2005/05/01 01:25:36 christos Exp $ */
|
1995-06-14 19:18:37 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1995-06-14 19:18:37 +04:00
|
|
|
* Copyright (c) 1988, 1989, 1990, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
2003-08-07 15:13:06 +04:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Adam de Boor.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* from: @(#)make.h 8.3 (Berkeley) 6/13/95
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Copyright (c) 1989 by Berkeley Softworks
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Adam de Boor.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1996-11-06 20:58:58 +03:00
|
|
|
* from: @(#)make.h 8.3 (Berkeley) 6/13/95
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*-
|
|
|
|
* make.h --
|
|
|
|
* The global definitions for pmake
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MAKE_H_
|
|
|
|
#define _MAKE_H_
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
1996-12-31 21:02:22 +03:00
|
|
|
#include <sys/param.h>
|
2002-06-15 22:24:55 +04:00
|
|
|
|
|
|
|
#include <ctype.h>
|
1994-03-05 03:34:29 +03:00
|
|
|
#include <stdio.h>
|
2002-06-15 22:24:55 +04:00
|
|
|
#include <stdlib.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
#include <string.h>
|
2002-06-15 22:24:55 +04:00
|
|
|
#include <unistd.h>
|
1996-12-31 20:55:02 +03:00
|
|
|
|
1998-05-21 21:19:46 +04:00
|
|
|
#ifdef BSD4_4
|
1996-12-31 20:55:02 +03:00
|
|
|
# include <sys/cdefs.h>
|
1996-08-13 20:39:30 +04:00
|
|
|
#endif
|
1996-12-31 20:55:02 +03:00
|
|
|
|
2004-07-15 13:01:29 +04:00
|
|
|
#if !defined(__GNUC_PREREQ__)
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define __GNUC_PREREQ__(x, y) \
|
|
|
|
((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \
|
|
|
|
(__GNUC__ > (x)))
|
|
|
|
#else /* defined(__GNUC__) */
|
|
|
|
#define __GNUC_PREREQ__(x, y) 0
|
|
|
|
#endif /* defined(__GNUC__) */
|
|
|
|
#endif /* !defined(__GNUC_PREREQ__) */
|
|
|
|
|
2004-07-02 00:38:09 +04:00
|
|
|
#if !defined(__unused)
|
|
|
|
#if __GNUC_PREREQ__(2, 7)
|
|
|
|
#define __unused __attribute__((__unused__))
|
|
|
|
#else
|
|
|
|
#define __unused /* delete */
|
|
|
|
#endif
|
|
|
|
#endif
|
2002-06-15 22:24:55 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
#include "sprite.h"
|
|
|
|
#include "lst.h"
|
1999-09-15 06:56:34 +04:00
|
|
|
#include "hash.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
#include "config.h"
|
1994-03-05 03:34:29 +03:00
|
|
|
#include "buf.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* The structure for an individual graph node. Each node has several
|
|
|
|
* pieces of data associated with it.
|
|
|
|
* 1) the name of the target it describes
|
|
|
|
* 2) the location of the target file in the file system.
|
|
|
|
* 3) the type of operator used to define its sources (qv. parse.c)
|
|
|
|
* 4) whether it is involved in this invocation of make
|
|
|
|
* 5) whether the target has been remade
|
|
|
|
* 6) whether any of its children has been remade
|
|
|
|
* 7) the number of its children that are, as yet, unmade
|
|
|
|
* 8) its modification time
|
|
|
|
* 9) the modification time of its youngest child (qv. make.c)
|
|
|
|
* 10) a list of nodes for which this is a source
|
|
|
|
* 11) a list of nodes on which this depends
|
|
|
|
* 12) a list of nodes that depend on this, as gleaned from the
|
|
|
|
* transformation rules.
|
|
|
|
* 13) a list of nodes of the same name created by the :: operator
|
|
|
|
* 14) a list of nodes that must be made (if they're made) before
|
|
|
|
* this node can be, but that do no enter into the datedness of
|
|
|
|
* this node.
|
|
|
|
* 15) a list of nodes that must be made (if they're made) after
|
|
|
|
* this node is, but that do not depend on this node, in the
|
|
|
|
* normal sense.
|
|
|
|
* 16) a Lst of ``local'' variables that are specific to this target
|
|
|
|
* and this target only (qv. var.c [$@ $< $?, etc.])
|
|
|
|
* 17) a Lst of strings that are commands to be given to a shell
|
1996-11-06 20:58:58 +03:00
|
|
|
* to create this target.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
typedef struct GNode {
|
|
|
|
char *name; /* The target's name */
|
1997-02-20 19:51:47 +03:00
|
|
|
char *uname; /* The unexpanded name of a .USE node */
|
1993-03-21 12:45:37 +03:00
|
|
|
char *path; /* The full pathname of the file */
|
|
|
|
int type; /* Its type (see the OP flags, below) */
|
1995-12-16 08:03:09 +03:00
|
|
|
int order; /* Its wait weight */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1998-11-11 22:37:06 +03:00
|
|
|
int flags;
|
|
|
|
#define REMAKE 0x1 /* this target needs to be remade */
|
|
|
|
#define CHILDMADE 0x2 /* children of this target were made */
|
|
|
|
#define FORCE 0x4 /* children don't exist, and we pretend made */
|
1993-03-21 12:45:37 +03:00
|
|
|
enum {
|
|
|
|
UNMADE, BEINGMADE, MADE, UPTODATE, ERROR, ABORTED,
|
2000-05-04 22:27:53 +04:00
|
|
|
CYCLE, ENDCYCLE
|
1993-03-21 12:45:37 +03:00
|
|
|
} made; /* Set to reflect the state of processing
|
|
|
|
* on this node:
|
|
|
|
* UNMADE - Not examined yet
|
|
|
|
* BEINGMADE - Target is already being made.
|
|
|
|
* Indicates a cycle in the graph. (compat
|
|
|
|
* mode only)
|
|
|
|
* MADE - Was out-of-date and has been made
|
|
|
|
* UPTODATE - Was already up-to-date
|
2001-09-16 20:34:23 +04:00
|
|
|
* ERROR - An error occurred while it was being
|
1993-03-21 12:45:37 +03:00
|
|
|
* made (used only in compat mode)
|
|
|
|
* ABORTED - The target was aborted due to
|
|
|
|
* an error making an inferior (compat).
|
|
|
|
* CYCLE - Marked as potentially being part of
|
|
|
|
* a graph cycle. If we come back to a
|
|
|
|
* node marked this way, it is printed
|
|
|
|
* and 'made' is changed to ENDCYCLE.
|
|
|
|
* ENDCYCLE - the cycle has been completely
|
|
|
|
* printed. Go back and unmark all its
|
|
|
|
* members.
|
|
|
|
*/
|
|
|
|
int unmade; /* The number of unmade children */
|
|
|
|
|
1997-09-24 01:15:07 +04:00
|
|
|
time_t mtime; /* Its modification time */
|
|
|
|
time_t cmtime; /* The modification time of its youngest
|
1993-03-21 12:45:37 +03:00
|
|
|
* child */
|
|
|
|
|
|
|
|
Lst iParents; /* Links to parents for which this is an
|
|
|
|
* implied source, if any */
|
|
|
|
Lst cohorts; /* Other nodes for the :: operator */
|
|
|
|
Lst parents; /* Nodes that depend on this one */
|
|
|
|
Lst children; /* Nodes on which this one depends */
|
|
|
|
Lst successors; /* Nodes that must be made after this one */
|
|
|
|
Lst preds; /* Nodes that must be made before this one */
|
2002-03-20 21:10:30 +03:00
|
|
|
int unmade_cohorts;/* # of unmade instances on the
|
|
|
|
cohorts list */
|
|
|
|
struct GNode *centurion; /* Pointer to the first instance of a ::
|
|
|
|
node; only set when on a cohorts list */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1999-09-15 06:56:34 +04:00
|
|
|
Hash_Table context; /* The local variables */
|
1993-03-21 12:45:37 +03:00
|
|
|
Lst commands; /* Creation commands */
|
|
|
|
|
|
|
|
struct _Suff *suffix; /* Suffix for the node (determined by
|
|
|
|
* Suff_FindDeps and opaque to everyone
|
|
|
|
* but the Suff module) */
|
2001-01-14 08:34:06 +03:00
|
|
|
char *fname; /* filename where the GNode got defined */
|
|
|
|
int lineno; /* line number where the GNode got defined */
|
1993-03-21 12:45:37 +03:00
|
|
|
} GNode;
|
|
|
|
|
|
|
|
/*
|
1996-11-06 20:58:58 +03:00
|
|
|
* Manifest constants
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
#define NILGNODE ((GNode *) NIL)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
* should be made. These constants are bitwise-OR'ed together and
|
|
|
|
* placed in the 'type' field of each node. Any node that has
|
|
|
|
* a 'type' field which satisfies the OP_NOP function was never never on
|
|
|
|
* the lefthand side of an operator, though it may have been on the
|
1996-11-06 20:58:58 +03:00
|
|
|
* righthand side...
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
#define OP_DEPENDS 0x00000001 /* Execution of commands depends on
|
|
|
|
* kids (:) */
|
|
|
|
#define OP_FORCE 0x00000002 /* Always execute commands (!) */
|
|
|
|
#define OP_DOUBLEDEP 0x00000004 /* Execution of commands depends on kids
|
|
|
|
* per line (::) */
|
|
|
|
#define OP_OPMASK (OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP)
|
|
|
|
|
|
|
|
#define OP_OPTIONAL 0x00000008 /* Don't care if the target doesn't
|
|
|
|
* exist and can't be created */
|
|
|
|
#define OP_USE 0x00000010 /* Use associated commands for parents */
|
|
|
|
#define OP_EXEC 0x00000020 /* Target is never out of date, but always
|
|
|
|
* execute commands anyway. Its time
|
|
|
|
* doesn't matter, so it has none...sort
|
|
|
|
* of */
|
|
|
|
#define OP_IGNORE 0x00000040 /* Ignore errors when creating the node */
|
|
|
|
#define OP_PRECIOUS 0x00000080 /* Don't remove the target when
|
|
|
|
* interrupted */
|
|
|
|
#define OP_SILENT 0x00000100 /* Don't echo commands when executed */
|
2002-02-04 00:41:44 +03:00
|
|
|
#define OP_MAKE 0x00000200 /* Target is a recursive make so its
|
1993-03-21 12:45:37 +03:00
|
|
|
* commands should always be executed when
|
|
|
|
* it is out of date, regardless of the
|
|
|
|
* state of the -n or -t flags */
|
|
|
|
#define OP_JOIN 0x00000400 /* Target is out-of-date only if any of its
|
|
|
|
* children was out-of-date */
|
2002-02-04 20:24:56 +03:00
|
|
|
#define OP_MADE 0x00000800 /* Assume the children of the node have
|
|
|
|
* been already made */
|
2005-05-08 04:38:47 +04:00
|
|
|
#define OP_SPECIAL 0x00001000 /* Special .BEGIN, .END, .INTERRUPT */
|
2001-07-03 22:08:50 +04:00
|
|
|
#define OP_USEBEFORE 0x00002000 /* Like .USE, only prepend commands */
|
1993-03-21 12:45:37 +03:00
|
|
|
#define OP_INVISIBLE 0x00004000 /* The node is invisible to its parents.
|
|
|
|
* I.e. it doesn't show up in the parents's
|
|
|
|
* local variables. */
|
|
|
|
#define OP_NOTMAIN 0x00008000 /* The node is exempt from normal 'main
|
|
|
|
* target' processing in parse.c */
|
1995-06-14 19:18:37 +04:00
|
|
|
#define OP_PHONY 0x00010000 /* Not a file target; run always */
|
1997-05-09 01:24:41 +04:00
|
|
|
#define OP_NOPATH 0x00020000 /* Don't search for file in the path */
|
1993-03-21 12:45:37 +03:00
|
|
|
/* Attributes applied by PMake */
|
|
|
|
#define OP_TRANSFORM 0x80000000 /* The node is a transformation rule */
|
|
|
|
#define OP_MEMBER 0x40000000 /* Target is a member of an archive */
|
|
|
|
#define OP_LIB 0x20000000 /* Target is a library */
|
|
|
|
#define OP_ARCHV 0x10000000 /* Target is an archive construct */
|
|
|
|
#define OP_HAS_COMMANDS 0x08000000 /* Target has all the commands it should.
|
|
|
|
* Used when parsing to catch multiple
|
|
|
|
* commands for a target */
|
|
|
|
#define OP_SAVE_CMDS 0x04000000 /* Saving commands on .END (Compat) */
|
|
|
|
#define OP_DEPS_FOUND 0x02000000 /* Already processed by Suff_FindDeps */
|
2000-06-11 11:39:52 +04:00
|
|
|
#define OP_MARK 0x01000000 /* Node found while expanding .ALLSRC */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2001-01-01 18:50:23 +03:00
|
|
|
#define NoExecute(gn) ((gn->type & OP_MAKE) ? noRecursiveExecute : noExecute)
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* OP_NOP will return TRUE if the node with the given type was not the
|
|
|
|
* object of a dependency operator
|
|
|
|
*/
|
|
|
|
#define OP_NOP(t) (((t) & OP_OPMASK) == 0x00000000)
|
|
|
|
|
1997-05-02 18:24:27 +04:00
|
|
|
#define OP_NOTARGET (OP_NOTMAIN|OP_USE|OP_EXEC|OP_TRANSFORM)
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* The TARG_ constants are used when calling the Targ_FindNode and
|
|
|
|
* Targ_FindList functions in targ.c. They simply tell the functions what to
|
|
|
|
* do if the desired node(s) is (are) not found. 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. If TARG_NOCREATE is given,
|
1996-11-06 20:58:58 +03:00
|
|
|
* a NIL pointer will be returned.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
#define TARG_CREATE 0x01 /* create node if not found */
|
|
|
|
#define TARG_NOCREATE 0x00 /* don't create it */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* There are several places where expandable buffers are used (parse.c and
|
|
|
|
* var.c). This constant is merely the starting point for those buffers. If
|
|
|
|
* lines tend to be much shorter than this, it would be best to reduce BSIZE.
|
|
|
|
* If longer, it should be increased. Reducing it will cause more copying to
|
|
|
|
* be done for longer lines, but will save space for shorter ones. In any
|
|
|
|
* case, it ought to be a power of two simply because most storage allocation
|
1996-11-06 20:58:58 +03:00
|
|
|
* schemes allocate in powers of two.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
1994-03-05 03:34:29 +03:00
|
|
|
#define MAKE_BSIZE 256 /* starting size for expandable buffers */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
1996-11-06 20:58:58 +03:00
|
|
|
* Str_Concat returns.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
#define STR_ADDSPACE 0x01 /* add a space when Str_Concat'ing */
|
2003-07-14 22:19:11 +04:00
|
|
|
#define STR_ADDSLASH 0x02 /* add a slash when Str_Concat'ing */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Error levels for parsing. PARSE_FATAL means the process cannot continue
|
|
|
|
* once the makefile has been parsed. PARSE_WARNING means it can. Passed
|
|
|
|
* as the first argument to Parse_Error.
|
|
|
|
*/
|
|
|
|
#define PARSE_WARNING 2
|
|
|
|
#define PARSE_FATAL 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Values returned by Cond_Eval.
|
|
|
|
*/
|
|
|
|
#define COND_PARSE 0 /* Parse the next lines */
|
|
|
|
#define COND_SKIP 1 /* Skip the next lines */
|
|
|
|
#define COND_INVALID 2 /* Not a conditional statement */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Definitions for the "local" variables. Used only for clarity.
|
|
|
|
*/
|
|
|
|
#define TARGET "@" /* Target of dependency */
|
|
|
|
#define OODATE "?" /* All out-of-date sources */
|
|
|
|
#define ALLSRC ">" /* All sources */
|
|
|
|
#define IMPSRC "<" /* Source implied by transformation */
|
|
|
|
#define PREFIX "*" /* Common prefix */
|
|
|
|
#define ARCHIVE "!" /* Archive in "archive(member)" syntax */
|
|
|
|
#define MEMBER "%" /* Member in "archive(member)" syntax */
|
|
|
|
|
|
|
|
#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 */
|
|
|
|
|
|
|
|
/*
|
1996-11-06 20:58:58 +03:00
|
|
|
* Global Variables
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
extern Lst create; /* The list of target names specified on the
|
|
|
|
* command line. used to resolve #if
|
|
|
|
* make(...) statements */
|
|
|
|
extern Lst dirSearchPath; /* The list of directories to search when
|
|
|
|
* looking for targets */
|
|
|
|
|
1994-03-05 03:34:29 +03:00
|
|
|
extern Boolean compatMake; /* True if we are make compatible */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern Boolean ignoreErrors; /* True if should ignore all errors */
|
|
|
|
extern Boolean beSilent; /* True if should print no commands */
|
|
|
|
extern Boolean noExecute; /* True if should execute nothing */
|
2001-01-01 18:50:23 +03:00
|
|
|
extern Boolean noRecursiveExecute; /* True if should execute nothing */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern Boolean allPrecious; /* True if every target is precious */
|
|
|
|
extern Boolean keepgoing; /* True if should continue on unaffected
|
|
|
|
* portions of the graph when have an error
|
|
|
|
* in one portion */
|
|
|
|
extern Boolean touchFlag; /* TRUE if targets should just be 'touched'
|
|
|
|
* if out of date. Set by the -t flag */
|
|
|
|
extern Boolean usePipes; /* TRUE if should capture the output of
|
|
|
|
* subshells by means of pipes. Otherwise it
|
|
|
|
* is routed to temporary files from which it
|
|
|
|
* is retrieved when the shell exits */
|
|
|
|
extern Boolean queryFlag; /* TRUE if we aren't supposed to really make
|
|
|
|
* anything, just see if the targets are out-
|
|
|
|
* of-date */
|
|
|
|
|
|
|
|
extern Boolean checkEnvFirst; /* TRUE if environment should be searched for
|
|
|
|
* variables before the global context */
|
2000-12-30 05:05:20 +03:00
|
|
|
extern Boolean jobServer; /* a jobServer already exists */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2001-01-10 18:54:00 +03:00
|
|
|
extern Boolean parseWarnFatal; /* TRUE if makefile parsing warnings are
|
|
|
|
* treated as errors */
|
|
|
|
|
2003-03-14 08:19:43 +03:00
|
|
|
extern Boolean varNoExportEnv; /* TRUE if we should not export variables
|
|
|
|
* set on the command line to the env. */
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
extern GNode *DEFAULT; /* .DEFAULT rule */
|
|
|
|
|
|
|
|
extern GNode *VAR_GLOBAL; /* Variables defined in a global context, e.g
|
|
|
|
* in the Makefile itself */
|
|
|
|
extern GNode *VAR_CMD; /* Variables defined on the command line */
|
2000-06-01 08:16:39 +04:00
|
|
|
extern GNode *VAR_FOR; /* Iteration variables */
|
1993-03-21 12:45:37 +03:00
|
|
|
extern char var_Error[]; /* Value returned by Var_Parse when an error
|
|
|
|
* is encountered. It actually points to
|
|
|
|
* an empty string, so naive callers needn't
|
|
|
|
* worry about it. */
|
|
|
|
|
|
|
|
extern time_t now; /* The time at the start of this whole
|
|
|
|
* process */
|
|
|
|
|
|
|
|
extern Boolean oldVars; /* Do old-style variable substitution */
|
1996-03-06 03:15:17 +03:00
|
|
|
|
|
|
|
extern Lst sysIncPath; /* The system include path. */
|
2001-10-31 04:15:57 +03:00
|
|
|
extern Lst defIncPath; /* The default include path. */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2001-01-10 18:54:00 +03:00
|
|
|
extern char *progname; /* The program name */
|
|
|
|
|
2000-12-30 05:05:20 +03:00
|
|
|
#define MAKEFLAGS ".MAKEFLAGS"
|
2001-06-09 09:22:47 +04:00
|
|
|
#define MAKEOVERRIDES ".MAKEOVERRIDES"
|
2000-12-30 05:05:20 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* debug control:
|
|
|
|
* There is one bit per module. It is up to the module what debug
|
|
|
|
* information to print.
|
|
|
|
*/
|
|
|
|
extern int debug;
|
|
|
|
#define DEBUG_ARCH 0x0001
|
|
|
|
#define DEBUG_COND 0x0002
|
|
|
|
#define DEBUG_DIR 0x0004
|
|
|
|
#define DEBUG_GRAPH1 0x0008
|
|
|
|
#define DEBUG_GRAPH2 0x0010
|
|
|
|
#define DEBUG_JOB 0x0020
|
|
|
|
#define DEBUG_MAKE 0x0040
|
|
|
|
#define DEBUG_SUFF 0x0080
|
|
|
|
#define DEBUG_TARG 0x0100
|
|
|
|
#define DEBUG_VAR 0x0200
|
1994-03-05 03:34:29 +03:00
|
|
|
#define DEBUG_FOR 0x0400
|
2001-06-02 00:33:37 +04:00
|
|
|
#define DEBUG_SHELL 0x0800
|
2003-09-10 22:04:22 +04:00
|
|
|
#define DEBUG_ERROR 0x1000
|
2003-12-07 23:30:28 +03:00
|
|
|
#define DEBUG_GRAPH3 0x10000
|
2005-06-17 23:25:20 +04:00
|
|
|
#define DEBUG_SCRIPT 0x20000
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
#define CONCAT(a,b) a##b
|
|
|
|
|
|
|
|
#define DEBUG(module) (debug & CONCAT(DEBUG_,module))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since there are so many, all functions that return non-integer values are
|
|
|
|
* extracted by means of a sed script or two and stuck in the file "nonints.h"
|
|
|
|
*/
|
|
|
|
#include "nonints.h"
|
|
|
|
|
2002-06-15 22:24:55 +04:00
|
|
|
int Make_TimeStamp(GNode *, GNode *);
|
|
|
|
Boolean Make_OODate(GNode *);
|
|
|
|
Lst Make_ExpandUse(Lst);
|
|
|
|
time_t Make_Recheck(GNode *);
|
|
|
|
void Make_HandleUse(GNode *, GNode *);
|
|
|
|
void Make_Update(GNode *);
|
|
|
|
void Make_DoAllVar(GNode *);
|
|
|
|
Boolean Make_Run(Lst);
|
2003-07-14 22:19:11 +04:00
|
|
|
char * Check_Cwd_Cmd(const char *);
|
|
|
|
void Check_Cwd(const char **);
|
|
|
|
void PrintOnError(const char *);
|
2002-06-15 22:24:55 +04:00
|
|
|
void Main_ExportMAKEFLAGS(Boolean);
|
|
|
|
Boolean Main_SetObjdir(const char *);
|
1994-03-05 03:34:29 +03:00
|
|
|
|
2003-07-14 22:19:11 +04:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define UNCONST(ptr) ({ \
|
|
|
|
union __unconst { \
|
|
|
|
const void *__cp; \
|
|
|
|
void *__p; \
|
|
|
|
} __d; \
|
|
|
|
__d.__cp = ptr, __d.__p; })
|
|
|
|
#else
|
|
|
|
#define UNCONST(ptr) (void *)(ptr)
|
|
|
|
#endif
|
|
|
|
|
2003-09-28 01:29:37 +04:00
|
|
|
#ifndef MIN
|
|
|
|
#define MIN(a, b) ((a < b) ? a : b)
|
|
|
|
#endif
|
|
|
|
#ifndef MAX
|
|
|
|
#define MAX(a, b) ((a > b) ? a : b)
|
|
|
|
#endif
|
|
|
|
|
1994-03-05 03:34:29 +03:00
|
|
|
#endif /* _MAKE_H_ */
|