make(1): normalize whitespace in source code
There is no more space tab. Either only tabs or only spaces or tabs followed by spaces, but not spaces followed by tabs.
This commit is contained in:
parent
63c24fdcdf
commit
c4def5ee7a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: arch.c,v 1.123 2020/09/26 16:00:12 rillig Exp $ */
|
||||
/* $NetBSD: arch.c,v 1.124 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -79,41 +79,42 @@
|
|||
* is referenced.
|
||||
*
|
||||
* The interface to this module is:
|
||||
* Arch_ParseArchive Given an archive specification, return a list
|
||||
* of GNode's, one for each member in the spec.
|
||||
* FALSE is returned if the specification is
|
||||
* invalid for some reason.
|
||||
* Arch_ParseArchive
|
||||
* Given an archive specification, return a list
|
||||
* of GNode's, one for each member in the spec.
|
||||
* FALSE is returned if the specification is
|
||||
* invalid for some reason.
|
||||
*
|
||||
* Arch_Touch Alter the modification time of the archive
|
||||
* member described by the given node to be
|
||||
* the current time.
|
||||
* Arch_Touch Alter the modification time of the archive
|
||||
* member described by the given node to be
|
||||
* the current time.
|
||||
*
|
||||
* Arch_TouchLib Update the modification time of the library
|
||||
* described by the given node. This is special
|
||||
* because it also updates the modification time
|
||||
* of the library's table of contents.
|
||||
* Arch_TouchLib Update the modification time of the library
|
||||
* described by the given node. This is special
|
||||
* because it also updates the modification time
|
||||
* of the library's table of contents.
|
||||
*
|
||||
* Arch_MTime Find the modification time of a member of
|
||||
* an archive *in the archive*. The time is also
|
||||
* placed in the member's GNode. Returns the
|
||||
* modification time.
|
||||
* Arch_MTime Find the modification time of a member of
|
||||
* an archive *in the archive*. The time is also
|
||||
* placed in the member's GNode. Returns the
|
||||
* modification time.
|
||||
*
|
||||
* Arch_MemTime Find the modification time of a member of
|
||||
* an archive. Called when the member doesn't
|
||||
* already exist. Looks in the archive for the
|
||||
* modification time. Returns the modification
|
||||
* time.
|
||||
* Arch_MemTime Find the modification time of a member of
|
||||
* an archive. Called when the member doesn't
|
||||
* already exist. Looks in the archive for the
|
||||
* modification time. Returns the modification
|
||||
* time.
|
||||
*
|
||||
* Arch_FindLib Search for a library along a path. The
|
||||
* library name in the GNode should be in
|
||||
* -l<name> format.
|
||||
* Arch_FindLib Search for a library along a path. The
|
||||
* library name in the GNode should be in
|
||||
* -l<name> format.
|
||||
*
|
||||
* Arch_LibOODate Special function to decide if a library node
|
||||
* is out-of-date.
|
||||
* Arch_LibOODate Special function to decide if a library node
|
||||
* is out-of-date.
|
||||
*
|
||||
* Arch_Init Initialize this module.
|
||||
* Arch_Init Initialize this module.
|
||||
*
|
||||
* Arch_End Cleanup this module.
|
||||
* Arch_End Cleanup this module.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -133,7 +134,7 @@
|
|||
#include "config.h"
|
||||
|
||||
/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: arch.c,v 1.123 2020/09/26 16:00:12 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: arch.c,v 1.124 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
#ifdef TARGET_MACHINE
|
||||
#undef MAKE_MACHINE
|
||||
|
@ -208,13 +209,13 @@ ArchFree(void *ap)
|
|||
Boolean
|
||||
Arch_ParseArchive(char **linePtr, GNodeList *nodeLst, GNode *ctxt)
|
||||
{
|
||||
char *cp; /* Pointer into line */
|
||||
GNode *gn; /* New node */
|
||||
char *libName; /* Library-part of specification */
|
||||
char *memName; /* Member-part of specification */
|
||||
char saveChar; /* Ending delimiter of member-name */
|
||||
Boolean subLibName; /* TRUE if libName should have/had
|
||||
* variable substitution performed on it */
|
||||
char *cp; /* Pointer into line */
|
||||
GNode *gn; /* New node */
|
||||
char *libName; /* Library-part of specification */
|
||||
char *memName; /* Member-part of specification */
|
||||
char saveChar; /* Ending delimiter of member-name */
|
||||
Boolean subLibName; /* TRUE if libName should have/had
|
||||
* variable substitution performed on it */
|
||||
|
||||
libName = *linePtr;
|
||||
|
||||
|
@ -946,7 +947,7 @@ Arch_TouchLib(GNode *gn)
|
|||
{
|
||||
#ifdef RANLIBMAG
|
||||
FILE * arch; /* Stream open to archive */
|
||||
struct ar_hdr arh; /* Header describing table of contents */
|
||||
struct ar_hdr arh; /* Header describing table of contents */
|
||||
struct utimbuf times; /* Times for utime() call */
|
||||
|
||||
arch = ArchFindMember(gn->path, RANLIBMAG, &arh, "r+");
|
||||
|
@ -1104,7 +1105,7 @@ Arch_FindLib(GNode *gn, SearchPath *path)
|
|||
Boolean
|
||||
Arch_LibOODate(GNode *gn)
|
||||
{
|
||||
Boolean oodate;
|
||||
Boolean oodate;
|
||||
|
||||
if (gn->type & OP_PHONY) {
|
||||
oodate = TRUE;
|
||||
|
@ -1116,8 +1117,8 @@ Arch_LibOODate(GNode *gn)
|
|||
oodate = TRUE;
|
||||
} else {
|
||||
#ifdef RANLIBMAG
|
||||
struct ar_hdr *arhPtr; /* Header for __.SYMDEF */
|
||||
int modTimeTOC; /* The table-of-contents's mod time */
|
||||
struct ar_hdr *arhPtr; /* Header for __.SYMDEF */
|
||||
int modTimeTOC; /* The table-of-contents's mod time */
|
||||
|
||||
arhPtr = ArchStatMember(gn->path, RANLIBMAG, FALSE);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: compat.c,v 1.155 2020/09/27 11:43:46 rillig Exp $ */
|
||||
/* $NetBSD: compat.c,v 1.156 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -78,8 +78,8 @@
|
|||
* - friendly variable substitution.
|
||||
*
|
||||
* Interface:
|
||||
* Compat_Run Initialize things for this module and recreate
|
||||
* thems as need creatin'
|
||||
* Compat_Run Initialize things for this module and recreate
|
||||
* thems as need creatin'
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -99,7 +99,7 @@
|
|||
#include "pathnames.h"
|
||||
|
||||
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.155 2020/09/27 11:43:46 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.156 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
static GNode *curTarg = NULL;
|
||||
static void CompatInterrupt(int);
|
||||
|
@ -187,21 +187,21 @@ CompatInterrupt(int signo)
|
|||
int
|
||||
Compat_RunCommand(const char *cmdp, struct GNode *gn)
|
||||
{
|
||||
char *cmdStart; /* Start of expanded command */
|
||||
char *bp;
|
||||
Boolean silent, /* Don't print command */
|
||||
doIt; /* Execute even if -n */
|
||||
volatile Boolean errCheck; /* Check errors */
|
||||
int reason; /* Reason for child's death */
|
||||
int status; /* Description of child's death */
|
||||
pid_t cpid; /* Child actually found */
|
||||
pid_t retstat; /* Result of wait */
|
||||
StringListNode *cmdNode; /* Node where current command is located */
|
||||
const char ** volatile av; /* Argument vector for thing to exec */
|
||||
char ** volatile mav;/* Copy of the argument vector for freeing */
|
||||
Boolean useShell; /* TRUE if command should be executed
|
||||
char *cmdStart; /* Start of expanded command */
|
||||
char *bp;
|
||||
Boolean silent; /* Don't print command */
|
||||
Boolean doIt; /* Execute even if -n */
|
||||
volatile Boolean errCheck; /* Check errors */
|
||||
int reason; /* Reason for child's death */
|
||||
int status; /* Description of child's death */
|
||||
pid_t cpid; /* Child actually found */
|
||||
pid_t retstat; /* Result of wait */
|
||||
StringListNode *cmdNode; /* Node where current command is located */
|
||||
const char **volatile av; /* Argument vector for thing to exec */
|
||||
char **volatile mav; /* Copy of the argument vector for freeing */
|
||||
Boolean useShell; /* TRUE if command should be executed
|
||||
* using a shell */
|
||||
const char * volatile cmd = cmdp;
|
||||
const char *volatile cmd = cmdp;
|
||||
|
||||
silent = (gn->type & OP_SILENT) != 0;
|
||||
errCheck = !(gn->type & OP_IGNORE);
|
||||
|
@ -664,8 +664,8 @@ cohorts:
|
|||
void
|
||||
Compat_Run(GNodeList *targs)
|
||||
{
|
||||
GNode *gn = NULL;/* Current root target */
|
||||
int errors; /* Number of targets not remade due to errors */
|
||||
GNode *gn = NULL; /* Current root target */
|
||||
int errors; /* Number of targets not remade due to errors */
|
||||
|
||||
if (!shellName)
|
||||
Shell_Init();
|
||||
|
@ -712,11 +712,11 @@ Compat_Run(GNodeList *targs)
|
|||
* For each entry in the list of targets to create, call Compat_Make on
|
||||
* it to create the thing. Compat_Make will leave the 'made' field of gn
|
||||
* in one of several states:
|
||||
* UPTODATE gn was already up-to-date
|
||||
* MADE gn was recreated successfully
|
||||
* ERROR An error occurred while gn was being created
|
||||
* ABORTED gn was not remade because one of its inferiors
|
||||
* could not be made due to errors.
|
||||
* UPTODATE gn was already up-to-date
|
||||
* MADE gn was recreated successfully
|
||||
* ERROR An error occurred while gn was being created
|
||||
* ABORTED gn was not remade because one of its inferiors
|
||||
* could not be made due to errors.
|
||||
*/
|
||||
errors = 0;
|
||||
while (!Lst_IsEmpty(targs)) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cond.c,v 1.152 2020/09/26 16:00:12 rillig Exp $ */
|
||||
/* $NetBSD: cond.c,v 1.153 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -72,7 +72,7 @@
|
|||
/* Handling of conditionals in a makefile.
|
||||
*
|
||||
* Interface:
|
||||
* Cond_EvalLine Evaluate the conditional in the passed line.
|
||||
* Cond_EvalLine Evaluate the conditional in the passed line.
|
||||
*
|
||||
* Cond_EvalCondition
|
||||
* Evaluate the conditional in the passed line, which
|
||||
|
@ -93,7 +93,7 @@
|
|||
#include "dir.h"
|
||||
|
||||
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: cond.c,v 1.152 2020/09/26 16:00:12 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: cond.c,v 1.153 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
/*
|
||||
* The parsing of conditional expressions is based on this grammar:
|
||||
|
@ -1007,7 +1007,7 @@ CondParser_Eval(CondParser *par, Boolean *value)
|
|||
*
|
||||
* Results:
|
||||
* COND_PARSE if the condition was valid grammatically
|
||||
* COND_INVALID if not a valid conditional.
|
||||
* COND_INVALID if not a valid conditional.
|
||||
*
|
||||
* (*value) is set to the boolean value of the condition
|
||||
*/
|
||||
|
@ -1069,7 +1069,7 @@ Cond_EvalCondition(const char *cond, Boolean *out_value)
|
|||
* COND_SKIP to skip the lines after the conditional
|
||||
* (when .if or .elif returns FALSE, or when a previous
|
||||
* branch has already been taken)
|
||||
* COND_INVALID if the conditional was not valid, either because of
|
||||
* COND_INVALID if the conditional was not valid, either because of
|
||||
* a syntax error or because some variable was undefined
|
||||
* or because the condition could not be evaluated
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.c,v 1.148 2020/09/26 17:15:20 rillig Exp $ */
|
||||
/* $NetBSD: dir.c,v 1.149 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -76,47 +76,49 @@
|
|||
* implicit sources.
|
||||
*
|
||||
* The interface for this module is:
|
||||
* Dir_Init Initialize the module.
|
||||
* Dir_Init Initialize the module.
|
||||
*
|
||||
* Dir_InitCur Set the cur CachedDir.
|
||||
* Dir_InitCur Set the cur CachedDir.
|
||||
*
|
||||
* Dir_InitDot Set the dot CachedDir.
|
||||
* Dir_InitDot Set the dot CachedDir.
|
||||
*
|
||||
* Dir_End Cleanup the module.
|
||||
* Dir_End Cleanup the module.
|
||||
*
|
||||
* Dir_SetPATH Set ${.PATH} to reflect state of dirSearchPath.
|
||||
* Dir_SetPATH Set ${.PATH} to reflect state of dirSearchPath.
|
||||
*
|
||||
* Dir_HasWildcards Returns TRUE if the name given it needs to
|
||||
* be wildcard-expanded.
|
||||
* Dir_HasWildcards
|
||||
* Returns TRUE if the name given it needs to
|
||||
* be wildcard-expanded.
|
||||
*
|
||||
* Dir_Expand Given a pattern and a path, return a Lst of names
|
||||
* which match the pattern on the search path.
|
||||
* Dir_Expand Given a pattern and a path, return a Lst of names
|
||||
* which match the pattern on the search path.
|
||||
*
|
||||
* Dir_FindFile Searches for a file on a given search path.
|
||||
* If it exists, the entire path is returned.
|
||||
* Otherwise NULL is returned.
|
||||
* Dir_FindFile Searches for a file on a given search path.
|
||||
* If it exists, the entire path is returned.
|
||||
* Otherwise NULL is returned.
|
||||
*
|
||||
* Dir_FindHereOrAbove Search for a path in the current directory and
|
||||
* then all the directories above it in turn until
|
||||
* the path is found or we reach the root ("/").
|
||||
* Dir_FindHereOrAbove
|
||||
* Search for a path in the current directory and
|
||||
* then all the directories above it in turn until
|
||||
* the path is found or we reach the root ("/").
|
||||
*
|
||||
* Dir_MTime Return the modification time of a node. The file
|
||||
* is searched for along the default search path.
|
||||
* The path and mtime fields of the node are filled
|
||||
* in.
|
||||
* Dir_MTime Return the modification time of a node. The file
|
||||
* is searched for along the default search path.
|
||||
* The path and mtime fields of the node are filled in.
|
||||
*
|
||||
* Dir_AddDir Add a directory to a search path.
|
||||
* Dir_AddDir Add a directory to a search path.
|
||||
*
|
||||
* Dir_MakeFlags Given a search path and a command flag, create
|
||||
* a string with each of the directories in the path
|
||||
* preceded by the command flag and all of them
|
||||
* separated by a space.
|
||||
* Dir_MakeFlags Given a search path and a command flag, create
|
||||
* a string with each of the directories in the path
|
||||
* preceded by the command flag and all of them
|
||||
* separated by a space.
|
||||
*
|
||||
* Dir_Destroy Destroy an element of a search path. Frees up all
|
||||
* things that can be freed for the element as long
|
||||
* as the element is no longer referenced by any other
|
||||
* search path.
|
||||
* Dir_ClearPath Resets a search path to the empty list.
|
||||
* Dir_Destroy Destroy an element of a search path. Frees up all
|
||||
* things that can be freed for the element as long
|
||||
* as the element is no longer referenced by any other
|
||||
* search path.
|
||||
*
|
||||
* Dir_ClearPath Resets a search path to the empty list.
|
||||
*
|
||||
* For debugging:
|
||||
* Dir_PrintDirectories Print stats about the directory cache.
|
||||
|
@ -134,7 +136,7 @@
|
|||
#include "job.h"
|
||||
|
||||
/* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */
|
||||
MAKE_RCSID("$NetBSD: dir.c,v 1.148 2020/09/26 17:15:20 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: dir.c,v 1.149 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
#define DIR_DEBUG0(fmt) \
|
||||
if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt)
|
||||
|
@ -548,7 +550,7 @@ Dir_HasWildcards(const char *name)
|
|||
/*-
|
||||
*-----------------------------------------------------------------------
|
||||
* DirMatchFiles --
|
||||
* Given a pattern and a CachedDir structure, see if any files
|
||||
* Given a pattern and a CachedDir structure, see if any files
|
||||
* match the pattern and add their names to the 'expansions' list if
|
||||
* any do. This is incomplete -- it doesn't take care of patterns like
|
||||
* src / *src / *.c properly (just *.c on any of the directories), but it
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dir.h,v 1.25 2020/09/22 04:05:41 rillig Exp $ */
|
||||
/* $NetBSD: dir.h,v 1.26 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -78,11 +78,11 @@
|
|||
/* A cache of a directory, remembering all the files that exist in that
|
||||
* directory. */
|
||||
typedef struct CachedDir {
|
||||
char *name; /* Name of directory */
|
||||
int refCount; /* Number of paths with this directory */
|
||||
int hits; /* the number of times a file in this
|
||||
char *name; /* Name of directory */
|
||||
int refCount; /* Number of paths with this directory */
|
||||
int hits; /* the number of times a file in this
|
||||
* directory has been found */
|
||||
Hash_Table files; /* Hash set of files in directory */
|
||||
Hash_Table files; /* Hash set of files in directory */
|
||||
} CachedDir;
|
||||
|
||||
struct make_stat {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: for.c,v 1.87 2020/09/27 16:52:22 rillig Exp $ */
|
||||
/* $NetBSD: for.c,v 1.88 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, The Regents of the University of California.
|
||||
|
@ -52,7 +52,8 @@
|
|||
* ${:Uvalue}, and then this modified body is "included" as a special file.
|
||||
*
|
||||
* Interface:
|
||||
* For_Eval Evaluate the loop in the passed line.
|
||||
* For_Eval Evaluate the loop in the passed line.
|
||||
*
|
||||
* For_Run Run accumulated loop
|
||||
*/
|
||||
|
||||
|
@ -60,7 +61,7 @@
|
|||
#include "strlist.h"
|
||||
|
||||
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
|
||||
MAKE_RCSID("$NetBSD: for.c,v 1.87 2020/09/27 16:52:22 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: for.c,v 1.88 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
typedef enum {
|
||||
FOR_SUB_ESCAPE_CHAR = 0x0001,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hash.c,v 1.33 2020/09/26 14:48:31 rillig Exp $ */
|
||||
/* $NetBSD: hash.c,v 1.34 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -69,17 +69,17 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* hash.c --
|
||||
*
|
||||
* This module contains routines to manipulate a hash table.
|
||||
* See hash.h for a definition of the structure of the hash
|
||||
* table. Hash tables grow automatically as the amount of
|
||||
* information increases.
|
||||
/*
|
||||
* This module contains routines to manipulate a hash table.
|
||||
* See hash.h for a definition of the structure of the hash
|
||||
* table. Hash tables grow automatically as the amount of
|
||||
* information increases.
|
||||
*/
|
||||
|
||||
#include "make.h"
|
||||
|
||||
/* "@(#)hash.c 8.1 (Berkeley) 6/6/93" */
|
||||
MAKE_RCSID("$NetBSD: hash.c,v 1.33 2020/09/26 14:48:31 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: hash.c,v 1.34 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
/*
|
||||
* Forward references to local procedures that are used before they're
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hash.h,v 1.24 2020/09/26 14:48:31 rillig Exp $ */
|
||||
/* $NetBSD: hash.h,v 1.25 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -90,10 +90,10 @@ typedef struct Hash_Entry {
|
|||
typedef struct Hash_Table {
|
||||
Hash_Entry **buckets; /* Pointers to Hash_Entry, one
|
||||
* for each bucket in the table. */
|
||||
int bucketsSize;
|
||||
int numEntries; /* Number of entries in the table. */
|
||||
int bucketsMask; /* Used to select the bucket for a hash. */
|
||||
int maxchain; /* max length of chain detected */
|
||||
int bucketsSize;
|
||||
int numEntries; /* Number of entries in the table. */
|
||||
int bucketsMask; /* Used to select the bucket for a hash. */
|
||||
int maxchain; /* max length of chain detected */
|
||||
} Hash_Table;
|
||||
|
||||
/*
|
||||
|
@ -101,9 +101,9 @@ typedef struct Hash_Table {
|
|||
* to record where we are in the search.
|
||||
*/
|
||||
typedef struct Hash_Search {
|
||||
Hash_Table *table; /* Table being searched. */
|
||||
int nextBucket; /* Next bucket to check (after current). */
|
||||
Hash_Entry *entry; /* Next entry to check in current bucket. */
|
||||
Hash_Table *table; /* Table being searched. */
|
||||
int nextBucket; /* Next bucket to check (after current). */
|
||||
Hash_Entry *entry; /* Next entry to check in current bucket. */
|
||||
} Hash_Search;
|
||||
|
||||
static inline MAKE_ATTR_UNUSED void *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: job.c,v 1.245 2020/09/27 19:13:46 rillig Exp $ */
|
||||
/* $NetBSD: job.c,v 1.246 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -74,50 +74,53 @@
|
|||
* handle the creation etc. of our child processes.
|
||||
*
|
||||
* Interface:
|
||||
* Job_Make Start the creation of the given target.
|
||||
* Job_Make Start the creation of the given target.
|
||||
*
|
||||
* Job_CatchChildren Check for and handle the termination of any
|
||||
* children. This must be called reasonably
|
||||
* frequently to keep the whole make going at
|
||||
* a decent clip, since job table entries aren't
|
||||
* removed until their process is caught this way.
|
||||
* Job_CatchChildren
|
||||
* Check for and handle the termination of any
|
||||
* children. This must be called reasonably
|
||||
* frequently to keep the whole make going at
|
||||
* a decent clip, since job table entries aren't
|
||||
* removed until their process is caught this way.
|
||||
*
|
||||
* Job_CatchOutput Print any output our children have produced.
|
||||
* Should also be called fairly frequently to
|
||||
* keep the user informed of what's going on.
|
||||
* If no output is waiting, it will block for
|
||||
* a time given by the SEL_* constants, below,
|
||||
* or until output is ready.
|
||||
* Job_CatchOutput
|
||||
* Print any output our children have produced.
|
||||
* Should also be called fairly frequently to
|
||||
* keep the user informed of what's going on.
|
||||
* If no output is waiting, it will block for
|
||||
* a time given by the SEL_* constants, below,
|
||||
* or until output is ready.
|
||||
*
|
||||
* Job_Init Called to initialize this module. in addition,
|
||||
* any commands attached to the .BEGIN target
|
||||
* are executed before this function returns.
|
||||
* Hence, the makefile must have been parsed
|
||||
* before this function is called.
|
||||
* Job_Init Called to initialize this module. in addition,
|
||||
* any commands attached to the .BEGIN target
|
||||
* are executed before this function returns.
|
||||
* Hence, the makefile must have been parsed
|
||||
* before this function is called.
|
||||
*
|
||||
* Job_End Cleanup any memory used.
|
||||
* Job_End Cleanup any memory used.
|
||||
*
|
||||
* Job_ParseShell Given the line following a .SHELL target, parse
|
||||
* the line as a shell specification. Returns
|
||||
* FALSE if the spec was incorrect.
|
||||
* Job_ParseShell Given the line following a .SHELL target, parse
|
||||
* the line as a shell specification. Returns
|
||||
* FALSE if the spec was incorrect.
|
||||
*
|
||||
* Job_Finish Perform any final processing which needs doing.
|
||||
* This includes the execution of any commands
|
||||
* which have been/were attached to the .END
|
||||
* target. It should only be called when the
|
||||
* job table is empty.
|
||||
* Job_Finish Perform any final processing which needs doing.
|
||||
* This includes the execution of any commands
|
||||
* which have been/were attached to the .END
|
||||
* target. It should only be called when the
|
||||
* job table is empty.
|
||||
*
|
||||
* Job_AbortAll Abort all currently running jobs. It doesn't
|
||||
* handle output or do anything for the jobs,
|
||||
* just kills them. It should only be called in
|
||||
* an emergency, as it were.
|
||||
* Job_AbortAll Abort all currently running jobs. It doesn't
|
||||
* handle output or do anything for the jobs,
|
||||
* just kills them. It should only be called in
|
||||
* an emergency, as it were.
|
||||
*
|
||||
* Job_CheckCommands Verify that the commands for a target are
|
||||
* ok. Provide them if necessary and possible.
|
||||
* Job_CheckCommands
|
||||
* Verify that the commands for a target are
|
||||
* ok. Provide them if necessary and possible.
|
||||
*
|
||||
* Job_Touch Update a target without really updating it.
|
||||
* Job_Touch Update a target without really updating it.
|
||||
*
|
||||
* Job_Wait Wait for all currently-running jobs to finish.
|
||||
* Job_Wait Wait for all currently-running jobs to finish.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -140,19 +143,19 @@
|
|||
#include "trace.h"
|
||||
|
||||
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: job.c,v 1.245 2020/09/27 19:13:46 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: job.c,v 1.246 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
# define STATIC static
|
||||
|
||||
/*
|
||||
* error handling variables
|
||||
*/
|
||||
static int errors = 0; /* number of errors reported */
|
||||
static int aborting = 0; /* why is the make aborting? */
|
||||
#define ABORT_ERROR 1 /* Because of an error */
|
||||
#define ABORT_INTERRUPT 2 /* Because it was interrupted */
|
||||
#define ABORT_WAIT 3 /* Waiting for jobs to finish */
|
||||
#define JOB_TOKENS "+EI+" /* Token to requeue for each abort state */
|
||||
static int errors = 0; /* number of errors reported */
|
||||
static int aborting = 0; /* why is the make aborting? */
|
||||
#define ABORT_ERROR 1 /* Because of an error */
|
||||
#define ABORT_INTERRUPT 2 /* Because it was interrupted */
|
||||
#define ABORT_WAIT 3 /* Waiting for jobs to finish */
|
||||
#define JOB_TOKENS "+EI+" /* Token to requeue for each abort state */
|
||||
|
||||
/*
|
||||
* this tracks the number of tokens currently "out" to build jobs.
|
||||
|
@ -173,14 +176,14 @@ int jobTokensRunning = 0;
|
|||
* XXX: Why printed? Shouldn't that be run/printed instead, depending on the
|
||||
* command line options?
|
||||
* Should this number be 0, no shell will be executed. */
|
||||
static int numCommands;
|
||||
static int numCommands;
|
||||
|
||||
/*
|
||||
* Return values from JobStart.
|
||||
*/
|
||||
#define JOB_RUNNING 0 /* Job is running */
|
||||
#define JOB_ERROR 1 /* Error in starting the job */
|
||||
#define JOB_FINISHED 2 /* The job is already finished */
|
||||
#define JOB_RUNNING 0 /* Job is running */
|
||||
#define JOB_ERROR 1 /* Error in starting the job */
|
||||
#define JOB_FINISHED 2 /* The job is already finished */
|
||||
|
||||
/*
|
||||
* Descriptions for various shells.
|
||||
|
@ -302,7 +305,7 @@ static void watchfd(Job *);
|
|||
static void clearfd(Job *);
|
||||
static int readyfd(Job *);
|
||||
|
||||
STATIC GNode *lastNode; /* The node for which output was most recently
|
||||
STATIC GNode *lastNode; /* The node for which output was most recently
|
||||
* produced. */
|
||||
static char *targPrefix = NULL; /* What we print at the start of TARG_FMT */
|
||||
static Job tokenWaitJob; /* token wait pseudo-job */
|
||||
|
@ -601,20 +604,20 @@ JobFindPid(int pid, int status, Boolean isJobs)
|
|||
static int
|
||||
JobPrintCommand(void *cmdp, void *jobp)
|
||||
{
|
||||
Boolean noSpecials; /* true if we shouldn't worry about
|
||||
* inserting special commands into
|
||||
* the input stream. */
|
||||
Boolean shutUp = FALSE; /* true if we put a no echo command
|
||||
* into the command file */
|
||||
Boolean errOff = FALSE; /* true if we turned error checking
|
||||
* off before printing the command
|
||||
* and need to turn it back on */
|
||||
const char *cmdTemplate; /* Template to use when printing the
|
||||
* command */
|
||||
char *cmdStart; /* Start of expanded command */
|
||||
char *escCmd = NULL; /* Command with quotes/backticks escaped */
|
||||
char *cmd = (char *)cmdp;
|
||||
Job *job = (Job *)jobp;
|
||||
Boolean noSpecials; /* true if we shouldn't worry about
|
||||
* inserting special commands into
|
||||
* the input stream. */
|
||||
Boolean shutUp = FALSE; /* true if we put a no echo command
|
||||
* into the command file */
|
||||
Boolean errOff = FALSE; /* true if we turned error checking
|
||||
* off before printing the command
|
||||
* and need to turn it back on */
|
||||
const char *cmdTemplate; /* Template to use when printing the
|
||||
* command */
|
||||
char *cmdStart; /* Start of expanded command */
|
||||
char *escCmd = NULL; /* Command with quotes/backticks escaped */
|
||||
char *cmd = (char *)cmdp;
|
||||
Job *job = (Job *)jobp;
|
||||
|
||||
noSpecials = NoExecute(job->node);
|
||||
|
||||
|
@ -629,7 +632,7 @@ JobPrintCommand(void *cmdp, void *jobp)
|
|||
}
|
||||
|
||||
#define DBPRINTF(fmt, arg) if (DEBUG(JOB)) { \
|
||||
(void)fprintf(debug_file, fmt, arg); \
|
||||
(void)fprintf(debug_file, fmt, arg); \
|
||||
} \
|
||||
(void)fprintf(job->cmdFILE, fmt, arg); \
|
||||
(void)fflush(job->cmdFILE);
|
||||
|
@ -869,7 +872,7 @@ JobClose(Job *job)
|
|||
static void
|
||||
JobFinish(Job *job, int status)
|
||||
{
|
||||
Boolean done, return_job_token;
|
||||
Boolean done, return_job_token;
|
||||
|
||||
if (DEBUG(JOB)) {
|
||||
fprintf(debug_file, "Jobfinish: %d [%s], status %d\n",
|
||||
|
@ -1035,7 +1038,7 @@ JobFinish(Job *job, int status)
|
|||
void
|
||||
Job_Touch(GNode *gn, Boolean silent)
|
||||
{
|
||||
int streamID; /* ID of stream opened to do the touch */
|
||||
int streamID; /* ID of stream opened to do the touch */
|
||||
struct utimbuf times; /* Times for utime() call */
|
||||
|
||||
if (gn->type & (OP_JOIN|OP_USE|OP_USEBEFORE|OP_EXEC|OP_OPTIONAL|
|
||||
|
@ -1170,13 +1173,13 @@ Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
|
|||
static void
|
||||
JobExec(Job *job, char **argv)
|
||||
{
|
||||
int cpid; /* ID of new child */
|
||||
int cpid; /* ID of new child */
|
||||
sigset_t mask;
|
||||
|
||||
job->flags &= ~JOB_TRACED;
|
||||
|
||||
if (DEBUG(JOB)) {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
(void)fprintf(debug_file, "Running %s %sly\n", job->node->name, "local");
|
||||
(void)fprintf(debug_file, "\tCommand: ");
|
||||
|
@ -1341,8 +1344,8 @@ JobExec(Job *job, char **argv)
|
|||
static void
|
||||
JobMakeArgv(Job *job, char **argv)
|
||||
{
|
||||
int argc;
|
||||
static char args[10]; /* For merged arguments */
|
||||
int argc;
|
||||
static char args[10]; /* For merged arguments */
|
||||
|
||||
argv[0] = UNCONST(shellName);
|
||||
argc = 1;
|
||||
|
@ -1408,11 +1411,11 @@ JobMakeArgv(Job *job, char **argv)
|
|||
static int
|
||||
JobStart(GNode *gn, int flags)
|
||||
{
|
||||
Job *job; /* new job descriptor */
|
||||
char *argv[10]; /* Argument vector to shell */
|
||||
Boolean cmdsOK; /* true if the nodes commands were all right */
|
||||
Boolean noExec; /* Set true if we decide not to run the job */
|
||||
int tfd; /* File descriptor to the temp file */
|
||||
Job *job; /* new job descriptor */
|
||||
char *argv[10]; /* Argument vector to shell */
|
||||
Boolean cmdsOK; /* true if the nodes commands were all right */
|
||||
Boolean noExec; /* Set true if we decide not to run the job */
|
||||
int tfd; /* File descriptor to the temp file */
|
||||
|
||||
for (job = job_table; job < job_table_end; job++) {
|
||||
if (job->job_state == JOB_ST_FREE)
|
||||
|
@ -1670,12 +1673,12 @@ JobOutput(Job *job, char *cp, char *endp, int msg)
|
|||
STATIC void
|
||||
JobDoOutput(Job *job, Boolean finish)
|
||||
{
|
||||
Boolean gotNL = FALSE; /* true if got a newline */
|
||||
Boolean fbuf; /* true if our buffer filled up */
|
||||
int nr; /* number of bytes read */
|
||||
int i; /* auxiliary index into outBuf */
|
||||
int max; /* limit for i (end of current data) */
|
||||
int nRead; /* (Temporary) number of bytes read */
|
||||
Boolean gotNL = FALSE; /* true if got a newline */
|
||||
Boolean fbuf; /* true if our buffer filled up */
|
||||
int nr; /* number of bytes read */
|
||||
int i; /* auxiliary index into outBuf */
|
||||
int max; /* limit for i (end of current data) */
|
||||
int nRead; /* (Temporary) number of bytes read */
|
||||
|
||||
/*
|
||||
* Read as many bytes as will fit in the buffer.
|
||||
|
@ -1843,8 +1846,8 @@ JobRun(GNode *targ)
|
|||
void
|
||||
Job_CatchChildren(void)
|
||||
{
|
||||
int pid; /* pid of dead child */
|
||||
int status; /* Exit/termination status */
|
||||
int pid; /* pid of dead child */
|
||||
int status; /* Exit/termination status */
|
||||
|
||||
/*
|
||||
* Don't even bother if we know there's no one around.
|
||||
|
@ -1868,7 +1871,7 @@ Job_CatchChildren(void)
|
|||
void
|
||||
JobReapChild(pid_t pid, int status, Boolean isJobs)
|
||||
{
|
||||
Job *job; /* job descriptor for dead child */
|
||||
Job *job; /* job descriptor for dead child */
|
||||
|
||||
/*
|
||||
* Don't even bother if we know there's no one around.
|
||||
|
@ -2067,10 +2070,10 @@ Job_Init(void)
|
|||
job_table_end = job_table + maxJobs;
|
||||
wantToken = 0;
|
||||
|
||||
aborting = 0;
|
||||
errors = 0;
|
||||
aborting = 0;
|
||||
errors = 0;
|
||||
|
||||
lastNode = NULL;
|
||||
lastNode = NULL;
|
||||
|
||||
/*
|
||||
* There is a non-zero chance that we already have children.
|
||||
|
@ -2203,24 +2206,24 @@ JobMatchShell(const char *name)
|
|||
* provides the functionality it does in C. Each word consists of
|
||||
* keyword and value separated by an equal sign. There should be no
|
||||
* unnecessary spaces in the word. The keywords are as follows:
|
||||
* name Name of shell.
|
||||
* path Location of shell.
|
||||
* quiet Command to turn off echoing.
|
||||
* echo Command to turn echoing on
|
||||
* filter Result of turning off echoing that shouldn't be
|
||||
* printed.
|
||||
* echoFlag Flag to turn echoing on at the start
|
||||
* errFlag Flag to turn error checking on at the start
|
||||
* hasErrCtl True if shell has error checking control
|
||||
* newline String literal to represent a newline char
|
||||
* check Command to turn on error checking if hasErrCtl
|
||||
* is TRUE or template of command to echo a command
|
||||
* for which error checking is off if hasErrCtl is
|
||||
* FALSE.
|
||||
* ignore Command to turn off error checking if hasErrCtl
|
||||
* is TRUE or template of command to execute a
|
||||
* command so as to ignore any errors it returns if
|
||||
* hasErrCtl is FALSE.
|
||||
* name Name of shell.
|
||||
* path Location of shell.
|
||||
* quiet Command to turn off echoing.
|
||||
* echo Command to turn echoing on
|
||||
* filter Result of turning off echoing that shouldn't be
|
||||
* printed.
|
||||
* echoFlag Flag to turn echoing on at the start
|
||||
* errFlag Flag to turn error checking on at the start
|
||||
* hasErrCtl True if shell has error checking control
|
||||
* newline String literal to represent a newline char
|
||||
* check Command to turn on error checking if hasErrCtl
|
||||
* is TRUE or template of command to echo a command
|
||||
* for which error checking is off if hasErrCtl is
|
||||
* FALSE.
|
||||
* ignore Command to turn off error checking if hasErrCtl
|
||||
* is TRUE or template of command to execute a
|
||||
* command so as to ignore any errors it returns if
|
||||
* hasErrCtl is FALSE.
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: job.h,v 1.50 2020/09/27 19:17:03 rillig Exp $ */
|
||||
/* $NetBSD: job.h,v 1.51 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -141,34 +141,34 @@ struct pollfd;
|
|||
|
||||
#define JOB_BUFSIZE 1024
|
||||
typedef struct Job {
|
||||
int pid; /* The child's process ID */
|
||||
GNode *node; /* The target the child is making */
|
||||
StringListNode *tailCmds; /* The node of the first command to be
|
||||
* saved when the job has been run */
|
||||
FILE *cmdFILE; /* When creating the shell script, this is
|
||||
* where the commands go */
|
||||
int exit_status; /* from wait4() in signal handler */
|
||||
char job_state; /* status of the job entry */
|
||||
int pid; /* The child's process ID */
|
||||
GNode *node; /* The target the child is making */
|
||||
StringListNode *tailCmds; /* The node of the first command to be
|
||||
* saved when the job has been run */
|
||||
FILE *cmdFILE; /* When creating the shell script, this is
|
||||
* where the commands go */
|
||||
int exit_status; /* from wait4() in signal handler */
|
||||
char job_state; /* status of the job entry */
|
||||
#define JOB_ST_FREE 0 /* Job is available */
|
||||
#define JOB_ST_SETUP 1 /* Job is allocated but otherwise invalid */
|
||||
#define JOB_ST_RUNNING 3 /* Job is running, pid valid */
|
||||
#define JOB_ST_FINISHED 4 /* Job is done (ie after SIGCHILD) */
|
||||
char job_suspended;
|
||||
short flags; /* Flags to control treatment of job */
|
||||
char job_suspended;
|
||||
short flags; /* Flags to control treatment of job */
|
||||
#define JOB_IGNERR 0x001 /* Ignore non-zero exits */
|
||||
#define JOB_SILENT 0x002 /* no output */
|
||||
#define JOB_SPECIAL 0x004 /* Target is a special one. i.e. run it locally
|
||||
* if we can't export it and maxLocal is 0 */
|
||||
#define JOB_IGNDOTS 0x008 /* Ignore "..." lines when processing
|
||||
#define JOB_IGNDOTS 0x008 /* Ignore "..." lines when processing
|
||||
* commands */
|
||||
#define JOB_TRACED 0x400 /* we've sent 'set -x' */
|
||||
|
||||
int jobPipe[2]; /* Pipe for reading output from job */
|
||||
int jobPipe[2]; /* Pipe for reading output from job */
|
||||
struct pollfd *inPollfd; /* pollfd associated with inPipe */
|
||||
char outBuf[JOB_BUFSIZE + 1];
|
||||
char outBuf[JOB_BUFSIZE + 1];
|
||||
/* Buffer for storing the output of the
|
||||
* job, line by line */
|
||||
int curPos; /* Current position in op_outBuf */
|
||||
int curPos; /* Current position in op_outBuf */
|
||||
|
||||
#ifdef USE_META
|
||||
struct BuildMon bm;
|
||||
|
@ -209,28 +209,28 @@ typedef struct Job {
|
|||
* echo "%s\n" as a template.
|
||||
*/
|
||||
typedef struct Shell {
|
||||
const char *name; /* the name of the shell. For Bourne and C
|
||||
const char *name; /* the name of the shell. For Bourne and C
|
||||
* shells, this is used only to find the
|
||||
* shell description when used as the single
|
||||
* source of a .SHELL target. For user-defined
|
||||
* shells, this is the full path of the shell.
|
||||
*/
|
||||
Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */
|
||||
const char *echoOff; /* command to turn off echo */
|
||||
const char *echoOn; /* command to turn it back on again */
|
||||
const char *noPrint; /* command to skip when printing output from
|
||||
Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */
|
||||
const char *echoOff; /* command to turn off echo */
|
||||
const char *echoOn; /* command to turn it back on again */
|
||||
const char *noPrint; /* command to skip when printing output from
|
||||
* shell. This is usually the command which
|
||||
* was executed to turn off echoing */
|
||||
size_t noPLen; /* length of noPrint command */
|
||||
Boolean hasErrCtl; /* set if can control error checking for
|
||||
size_t noPLen; /* length of noPrint command */
|
||||
Boolean hasErrCtl; /* set if can control error checking for
|
||||
* individual commands */
|
||||
const char *errCheck; /* string to turn error checking on */
|
||||
const char *ignErr; /* string to turn off error checking */
|
||||
const char *errOut; /* string to use for testing exit code */
|
||||
const char *newline; /* string literal that results in a newline
|
||||
const char *errCheck; /* string to turn error checking on */
|
||||
const char *ignErr; /* string to turn off error checking */
|
||||
const char *errOut; /* string to use for testing exit code */
|
||||
const char *newline; /* string literal that results in a newline
|
||||
* character when it appears outside of any
|
||||
* 'quote' or "quote" characters */
|
||||
char commentChar; /* character used by shell for comment lines */
|
||||
char commentChar; /* character used by shell for comment lines */
|
||||
|
||||
/*
|
||||
* command-line flags
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lst.c,v 1.72 2020/09/26 17:15:20 rillig Exp $ */
|
||||
/* $NetBSD: lst.c,v 1.73 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include "make.h"
|
||||
|
||||
MAKE_RCSID("$NetBSD: lst.c,v 1.72 2020/09/26 17:15:20 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: lst.c,v 1.73 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
/* Allocate and initialize a list node.
|
||||
*
|
||||
|
@ -347,7 +347,7 @@ Lst_ForEachUntil(List *list, LstActionUntilProc proc, void *procData)
|
|||
* Take care of having the current element deleted out from under
|
||||
* us.
|
||||
*/
|
||||
ListNode *next = tln->next;
|
||||
ListNode *next = tln->next;
|
||||
|
||||
/*
|
||||
* We're done with the traversal if
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.350 2020/09/27 16:52:22 rillig Exp $ */
|
||||
/* $NetBSD: main.c,v 1.351 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -126,7 +126,7 @@
|
|||
#endif
|
||||
|
||||
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.350 2020/09/27 16:52:22 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: main.c,v 1.351 2020/09/27 21:35:16 rillig Exp $");
|
||||
#if defined(MAKE_NATIVE) && !defined(lint)
|
||||
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
|
||||
The Regents of the University of California. All rights reserved.");
|
||||
|
@ -665,10 +665,10 @@ noarg:
|
|||
|
||||
/*-
|
||||
* Main_ParseArgLine --
|
||||
* Used by the parse module when a .MFLAGS or .MAKEFLAGS target
|
||||
* Used by the parse module when a .MFLAGS or .MAKEFLAGS target
|
||||
* is encountered and by main() when reading the .MAKEFLAGS envariable.
|
||||
* Takes a line of arguments and breaks it into its
|
||||
* component words and passes those words and the number of them to the
|
||||
* component words and passes those words and the number of them to the
|
||||
* MainParseArgs function.
|
||||
* The line should have all its leading whitespace removed.
|
||||
*
|
||||
|
@ -896,7 +896,7 @@ static Boolean
|
|||
runTargets(void)
|
||||
{
|
||||
GNodeList *targs; /* target nodes to create -- passed to Make_Init */
|
||||
Boolean outOfDate; /* FALSE if all targets up to date */
|
||||
Boolean outOfDate; /* FALSE if all targets up to date */
|
||||
|
||||
/*
|
||||
* Have now read the entire graph and need to make a list of
|
||||
|
@ -977,7 +977,7 @@ InitVarTargets(void)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Boolean outOfDate; /* FALSE if all targets up to date */
|
||||
Boolean outOfDate; /* FALSE if all targets up to date */
|
||||
struct stat sb, sa;
|
||||
char *p1, *path;
|
||||
char mdpath[MAXPATHLEN];
|
||||
|
@ -1588,10 +1588,10 @@ found:
|
|||
char *
|
||||
Cmd_Exec(const char *cmd, const char **errfmt)
|
||||
{
|
||||
const char *args[4]; /* Args for invoking the shell */
|
||||
int fds[2]; /* Pipe streams */
|
||||
int cpid; /* Child PID */
|
||||
int pid; /* PID from wait() */
|
||||
const char *args[4]; /* Args for invoking the shell */
|
||||
int fds[2]; /* Pipe streams */
|
||||
int cpid; /* Child PID */
|
||||
int pid; /* PID from wait() */
|
||||
int status; /* command exit status */
|
||||
Buffer buf; /* buffer to store the result */
|
||||
ssize_t bytes_read;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: make.c,v 1.150 2020/09/27 13:27:50 rillig Exp $ */
|
||||
/* $NetBSD: make.c,v 1.151 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -74,32 +74,32 @@
|
|||
* their suitability for creation
|
||||
*
|
||||
* Interface:
|
||||
* Make_Run Initialize things for the module and recreate
|
||||
* whatever needs recreating. Returns TRUE if
|
||||
* work was (or would have been) done and FALSE
|
||||
* otherwise.
|
||||
* Make_Run Initialize things for the module and recreate
|
||||
* whatever needs recreating. Returns TRUE if
|
||||
* work was (or would have been) done and FALSE
|
||||
* otherwise.
|
||||
*
|
||||
* Make_Update Update all parents of a given child. Performs
|
||||
* various bookkeeping chores like the updating
|
||||
* of the cmgn field of the parent, filling
|
||||
* of the IMPSRC context variable, etc. It will
|
||||
* place the parent on the toBeMade queue if it
|
||||
* should be.
|
||||
* Make_Update Update all parents of a given child. Performs
|
||||
* various bookkeeping chores like the updating
|
||||
* of the cmgn field of the parent, filling
|
||||
* of the IMPSRC context variable, etc. It will
|
||||
* place the parent on the toBeMade queue if it
|
||||
* should be.
|
||||
*
|
||||
* Make_TimeStamp Function to set the parent's cmgn field
|
||||
* based on a child's modification time.
|
||||
* Make_TimeStamp Function to set the parent's cmgn field
|
||||
* based on a child's modification time.
|
||||
*
|
||||
* Make_DoAllVar Set up the various local variables for a
|
||||
* target, including the .ALLSRC variable, making
|
||||
* sure that any variable that needs to exist
|
||||
* at the very least has the empty value.
|
||||
* Make_DoAllVar Set up the various local variables for a
|
||||
* target, including the .ALLSRC variable, making
|
||||
* sure that any variable that needs to exist
|
||||
* at the very least has the empty value.
|
||||
*
|
||||
* Make_OODate Determine if a target is out-of-date.
|
||||
* Make_OODate Determine if a target is out-of-date.
|
||||
*
|
||||
* Make_HandleUse See if a child is a .USE node for a parent
|
||||
* and perform the .USE actions if so.
|
||||
* Make_HandleUse See if a child is a .USE node for a parent
|
||||
* and perform the .USE actions if so.
|
||||
*
|
||||
* Make_ExpandUse Expand .USE nodes
|
||||
* Make_ExpandUse Expand .USE nodes
|
||||
*/
|
||||
|
||||
#include "make.h"
|
||||
|
@ -107,7 +107,7 @@
|
|||
#include "job.h"
|
||||
|
||||
/* "@(#)make.c 8.1 (Berkeley) 6/6/93" */
|
||||
MAKE_RCSID("$NetBSD: make.c,v 1.150 2020/09/27 13:27:50 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: make.c,v 1.151 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
/* Sequence # to detect recursion. */
|
||||
static unsigned int checked = 1;
|
||||
|
@ -390,7 +390,7 @@ MakeFindChild(void *gnp, void *pgnp)
|
|||
void
|
||||
Make_HandleUse(GNode *cgn, GNode *pgn)
|
||||
{
|
||||
GNodeListNode *ln; /* An element in the children list */
|
||||
GNodeListNode *ln; /* An element in the children list */
|
||||
|
||||
#ifdef DEBUG_SRC
|
||||
if ((cgn->type & (OP_USE|OP_USEBEFORE|OP_TRANSFORM)) == 0) {
|
||||
|
@ -505,10 +505,10 @@ Make_Recheck(GNode *gn)
|
|||
* parse.h : parse.o
|
||||
*
|
||||
* parse.o : parse.y
|
||||
* yacc -d parse.y
|
||||
* cc -c y.tab.c
|
||||
* mv y.tab.o parse.o
|
||||
* cmp -s y.tab.h parse.h || mv y.tab.h parse.h
|
||||
* yacc -d parse.y
|
||||
* cc -c y.tab.c
|
||||
* mv y.tab.o parse.o
|
||||
* cmp -s y.tab.h parse.h || mv y.tab.h parse.h
|
||||
*
|
||||
* In this case, if the definitions produced by yacc haven't changed
|
||||
* from before, parse.h won't have been updated and gn->mtime will
|
||||
|
@ -588,8 +588,8 @@ Make_Recheck(GNode *gn)
|
|||
void
|
||||
Make_Update(GNode *cgn)
|
||||
{
|
||||
GNode *pgn; /* the parent node */
|
||||
const char *cname; /* the child's name */
|
||||
GNode *pgn; /* the parent node */
|
||||
const char *cname; /* the child's name */
|
||||
GNodeListNode *ln;
|
||||
time_t mtime = -1;
|
||||
char *p1;
|
||||
|
@ -1055,8 +1055,8 @@ MakePrintStatusOrder(void *ognp, void *gnp)
|
|||
static int
|
||||
MakePrintStatus(void *gnp, void *v_errors)
|
||||
{
|
||||
GNode *gn = (GNode *)gnp;
|
||||
int *errors = v_errors;
|
||||
GNode *gn = (GNode *)gnp;
|
||||
int *errors = v_errors;
|
||||
|
||||
if (gn->flags & DONECYCLE)
|
||||
/* We've completely processed this node before, don't do it again. */
|
||||
|
@ -1240,7 +1240,7 @@ Make_ProcessWait(GNodeList *targs)
|
|||
GNode *pgn; /* 'parent' node we are examining */
|
||||
GNode *cgn; /* Each child in turn */
|
||||
GNodeListNode *owln; /* Previous .WAIT node */
|
||||
GNodeList *examine; /* List of targets to examine */
|
||||
GNodeList *examine; /* List of targets to examine */
|
||||
GNodeListNode *ln;
|
||||
|
||||
/*
|
||||
|
@ -1320,7 +1320,7 @@ Make_ProcessWait(GNodeList *targs)
|
|||
Boolean
|
||||
Make_Run(GNodeList *targs)
|
||||
{
|
||||
int errors; /* Number of errors the Job module reports */
|
||||
int errors; /* Number of errors the Job module reports */
|
||||
|
||||
/* Start trying to make the current targets... */
|
||||
toBeMade = Lst_Init();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: make.h,v 1.147 2020/09/26 16:00:12 rillig Exp $ */
|
||||
/* $NetBSD: make.h,v 1.148 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -200,7 +200,7 @@ typedef enum {
|
|||
OP_USE = 1 << 4,
|
||||
/* Target is never out of date, but always execute commands anyway.
|
||||
* Its time doesn't matter, so it has none...sort of */
|
||||
OP_EXEC = 1 << 5,
|
||||
OP_EXEC = 1 << 5,
|
||||
/* Ignore errors when creating the node */
|
||||
OP_IGNORE = 1 << 6,
|
||||
/* Don't remove the target when interrupted */
|
||||
|
@ -387,43 +387,45 @@ typedef enum {
|
|||
/*
|
||||
* 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 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 */
|
||||
#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
|
||||
*/
|
||||
extern StringList *create; /* The list of target names specified on the
|
||||
extern StringList *create; /* The list of target names specified on the
|
||||
* command line. used to resolve #if
|
||||
* make(...) statements */
|
||||
extern SearchPath *dirSearchPath; /* The list of directories to search when
|
||||
extern SearchPath *dirSearchPath;
|
||||
/* The list of directories to search when
|
||||
* looking for targets */
|
||||
|
||||
extern Boolean compatMake; /* True if we are make compatible */
|
||||
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 */
|
||||
extern Boolean noRecursiveExecute; /* True if should execute nothing */
|
||||
extern Boolean allPrecious; /* True if every target is precious */
|
||||
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 */
|
||||
extern Boolean noRecursiveExecute;
|
||||
/* True if should execute nothing */
|
||||
extern Boolean allPrecious; /* True if every target is precious */
|
||||
extern Boolean deleteOnError; /* True if failed targets should be deleted */
|
||||
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
|
||||
* 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 */
|
||||
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-
|
||||
* of-date */
|
||||
extern Boolean doing_depend; /* TRUE if processing .depend */
|
||||
|
@ -437,24 +439,24 @@ extern Boolean parseWarnFatal; /* TRUE if makefile parsing warnings are
|
|||
extern Boolean varNoExportEnv; /* TRUE if we should not export variables
|
||||
* set on the command line to the env. */
|
||||
|
||||
extern GNode *DEFAULT; /* .DEFAULT rule */
|
||||
extern GNode *DEFAULT; /* .DEFAULT rule */
|
||||
|
||||
extern GNode *VAR_INTERNAL; /* Variables defined internally by make
|
||||
* which should not override those set by
|
||||
* makefiles.
|
||||
*/
|
||||
extern GNode *VAR_GLOBAL; /* Variables defined in a global context, e.g
|
||||
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 */
|
||||
extern char var_Error[]; /* Value returned by Var_Parse when an error
|
||||
extern GNode *VAR_CMD; /* Variables defined on the command line */
|
||||
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
|
||||
extern time_t now; /* The time at the start of this whole
|
||||
* process */
|
||||
|
||||
extern Boolean oldVars; /* Do old-style variable substitution */
|
||||
extern Boolean oldVars; /* Do old-style variable substitution */
|
||||
|
||||
extern SearchPath *sysIncPath; /* The system include path. */
|
||||
extern SearchPath *defIncPath; /* The default include path. */
|
||||
|
@ -540,7 +542,7 @@ int str2Lst_Append(StringList *, char *, const char *);
|
|||
void GNode_FprintDetails(FILE *, const char *, const GNode *, const char *);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNCONST(ptr) ({ \
|
||||
#define UNCONST(ptr) ({ \
|
||||
union __unconst { \
|
||||
const void *__cp; \
|
||||
void *__p; \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parse.c,v 1.337 2020/09/27 12:42:09 rillig Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.338 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -87,27 +87,28 @@
|
|||
* messages can be more meaningful.
|
||||
*
|
||||
* Interface:
|
||||
* Parse_Init Initialization function which must be
|
||||
* called before anything else in this module
|
||||
* is used.
|
||||
* Parse_Init Initialization function which must be
|
||||
* called before anything else in this module
|
||||
* is used.
|
||||
*
|
||||
* Parse_End Cleanup the module
|
||||
* Parse_End Cleanup the module
|
||||
*
|
||||
* Parse_File Function used to parse a makefile. It must
|
||||
* be given the name of the file, which should
|
||||
* already have been opened, and a function
|
||||
* to call to read a character from the file.
|
||||
* Parse_File Function used to parse a makefile. It must
|
||||
* be given the name of the file, which should
|
||||
* already have been opened, and a function
|
||||
* to call to read a character from the file.
|
||||
*
|
||||
* Parse_IsVar Returns TRUE if the given line is a
|
||||
* variable assignment. Used by MainParseArgs
|
||||
* to determine if an argument is a target
|
||||
* or a variable assignment. Used internally
|
||||
* for pretty much the same thing...
|
||||
* Parse_IsVar Returns TRUE if the given line is a
|
||||
* variable assignment. Used by MainParseArgs
|
||||
* to determine if an argument is a target
|
||||
* or a variable assignment. Used internally
|
||||
* for pretty much the same thing...
|
||||
*
|
||||
* Parse_Error Function called when an error occurs in
|
||||
* parsing. Used by the variable and
|
||||
* conditional modules.
|
||||
* Parse_MainName Returns a Lst of the main target to create.
|
||||
* Parse_Error Function called when an error occurs in
|
||||
* parsing. Used by the variable and
|
||||
* conditional modules.
|
||||
*
|
||||
* Parse_MainName Returns a Lst of the main target to create.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -131,7 +132,7 @@
|
|||
#include "pathnames.h"
|
||||
|
||||
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: parse.c,v 1.337 2020/09/27 12:42:09 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: parse.c,v 1.338 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
/* types and constants */
|
||||
|
||||
|
@ -139,18 +140,18 @@ MAKE_RCSID("$NetBSD: parse.c,v 1.337 2020/09/27 12:42:09 rillig Exp $");
|
|||
* Structure for a file being read ("included file")
|
||||
*/
|
||||
typedef struct IFile {
|
||||
char *fname; /* name of file */
|
||||
Boolean fromForLoop; /* simulated .include by the .for loop */
|
||||
int lineno; /* current line number in file */
|
||||
int first_lineno; /* line number of start of text */
|
||||
int cond_depth; /* 'if' nesting when file opened */
|
||||
Boolean depending; /* state of doing_depend on EOF */
|
||||
char *P_str; /* point to base of string buffer */
|
||||
char *P_ptr; /* point to next char of string buffer */
|
||||
char *P_end; /* point to the end of string buffer */
|
||||
char *(*nextbuf)(void *, size_t *); /* Function to get more data */
|
||||
void *nextbuf_arg; /* Opaque arg for nextbuf() */
|
||||
struct loadedfile *lf; /* loadedfile object, if any */
|
||||
char *fname; /* name of file */
|
||||
Boolean fromForLoop; /* simulated .include by the .for loop */
|
||||
int lineno; /* current line number in file */
|
||||
int first_lineno; /* line number of start of text */
|
||||
int cond_depth; /* 'if' nesting when file opened */
|
||||
Boolean depending; /* state of doing_depend on EOF */
|
||||
char *P_str; /* point to base of string buffer */
|
||||
char *P_ptr; /* point to next char of string buffer */
|
||||
char *P_end; /* point to the end of string buffer */
|
||||
char *(*nextbuf)(void *, size_t *); /* Function to get more data */
|
||||
void *nextbuf_arg; /* Opaque arg for nextbuf() */
|
||||
struct loadedfile *lf; /* loadedfile object, if any */
|
||||
} IFile;
|
||||
|
||||
|
||||
|
@ -166,42 +167,42 @@ typedef struct IFile {
|
|||
* Tokens for target attributes
|
||||
*/
|
||||
typedef enum {
|
||||
Begin, /* .BEGIN */
|
||||
Default, /* .DEFAULT */
|
||||
DeleteOnError, /* .DELETE_ON_ERROR */
|
||||
End, /* .END */
|
||||
dotError, /* .ERROR */
|
||||
Ignore, /* .IGNORE */
|
||||
Includes, /* .INCLUDES */
|
||||
Interrupt, /* .INTERRUPT */
|
||||
Libs, /* .LIBS */
|
||||
Meta, /* .META */
|
||||
MFlags, /* .MFLAGS or .MAKEFLAGS */
|
||||
Main, /* .MAIN and we don't have anything user-specified to
|
||||
* make */
|
||||
NoExport, /* .NOEXPORT */
|
||||
NoMeta, /* .NOMETA */
|
||||
NoMetaCmp, /* .NOMETA_CMP */
|
||||
NoPath, /* .NOPATH */
|
||||
Not, /* Not special */
|
||||
NotParallel, /* .NOTPARALLEL */
|
||||
Null, /* .NULL */
|
||||
ExObjdir, /* .OBJDIR */
|
||||
Order, /* .ORDER */
|
||||
Parallel, /* .PARALLEL */
|
||||
ExPath, /* .PATH */
|
||||
Phony, /* .PHONY */
|
||||
Begin, /* .BEGIN */
|
||||
Default, /* .DEFAULT */
|
||||
DeleteOnError, /* .DELETE_ON_ERROR */
|
||||
End, /* .END */
|
||||
dotError, /* .ERROR */
|
||||
Ignore, /* .IGNORE */
|
||||
Includes, /* .INCLUDES */
|
||||
Interrupt, /* .INTERRUPT */
|
||||
Libs, /* .LIBS */
|
||||
Meta, /* .META */
|
||||
MFlags, /* .MFLAGS or .MAKEFLAGS */
|
||||
Main, /* .MAIN and we don't have anything user-specified to
|
||||
* make */
|
||||
NoExport, /* .NOEXPORT */
|
||||
NoMeta, /* .NOMETA */
|
||||
NoMetaCmp, /* .NOMETA_CMP */
|
||||
NoPath, /* .NOPATH */
|
||||
Not, /* Not special */
|
||||
NotParallel, /* .NOTPARALLEL */
|
||||
Null, /* .NULL */
|
||||
ExObjdir, /* .OBJDIR */
|
||||
Order, /* .ORDER */
|
||||
Parallel, /* .PARALLEL */
|
||||
ExPath, /* .PATH */
|
||||
Phony, /* .PHONY */
|
||||
#ifdef POSIX
|
||||
Posix, /* .POSIX */
|
||||
Posix, /* .POSIX */
|
||||
#endif
|
||||
Precious, /* .PRECIOUS */
|
||||
ExShell, /* .SHELL */
|
||||
Silent, /* .SILENT */
|
||||
SingleShell, /* .SINGLESHELL */
|
||||
Stale, /* .STALE */
|
||||
Suffixes, /* .SUFFIXES */
|
||||
Wait, /* .WAIT */
|
||||
Attribute /* Generic attribute */
|
||||
Precious, /* .PRECIOUS */
|
||||
ExShell, /* .SHELL */
|
||||
Silent, /* .SILENT */
|
||||
SingleShell, /* .SINGLESHELL */
|
||||
Stale, /* .STALE */
|
||||
Suffixes, /* .SUFFIXES */
|
||||
Wait, /* .WAIT */
|
||||
Attribute /* Generic attribute */
|
||||
} ParseSpecial;
|
||||
|
||||
/* result data */
|
||||
|
@ -301,54 +302,54 @@ SearchPath *defIncPath; /* default for sysIncPath */
|
|||
* keyword is used as a source ("0" if the keyword isn't special as a source)
|
||||
*/
|
||||
static const struct {
|
||||
const char *name; /* Name of keyword */
|
||||
ParseSpecial spec; /* Type when used as a target */
|
||||
GNodeType op; /* Operator when used as a source */
|
||||
const char *name; /* Name of keyword */
|
||||
ParseSpecial spec; /* Type when used as a target */
|
||||
GNodeType op; /* Operator when used as a source */
|
||||
} parseKeywords[] = {
|
||||
{ ".BEGIN", Begin, 0 },
|
||||
{ ".DEFAULT", Default, 0 },
|
||||
{ ".DELETE_ON_ERROR", DeleteOnError, 0 },
|
||||
{ ".END", End, 0 },
|
||||
{ ".ERROR", dotError, 0 },
|
||||
{ ".EXEC", Attribute, OP_EXEC },
|
||||
{ ".IGNORE", Ignore, OP_IGNORE },
|
||||
{ ".INCLUDES", Includes, 0 },
|
||||
{ ".INTERRUPT", Interrupt, 0 },
|
||||
{ ".INVISIBLE", Attribute, OP_INVISIBLE },
|
||||
{ ".JOIN", Attribute, OP_JOIN },
|
||||
{ ".LIBS", Libs, 0 },
|
||||
{ ".MADE", Attribute, OP_MADE },
|
||||
{ ".MAIN", Main, 0 },
|
||||
{ ".MAKE", Attribute, OP_MAKE },
|
||||
{ ".MAKEFLAGS", MFlags, 0 },
|
||||
{ ".META", Meta, OP_META },
|
||||
{ ".MFLAGS", MFlags, 0 },
|
||||
{ ".NOMETA", NoMeta, OP_NOMETA },
|
||||
{ ".NOMETA_CMP", NoMetaCmp, OP_NOMETA_CMP },
|
||||
{ ".NOPATH", NoPath, OP_NOPATH },
|
||||
{ ".NOTMAIN", Attribute, OP_NOTMAIN },
|
||||
{ ".NOTPARALLEL", NotParallel, 0 },
|
||||
{ ".NO_PARALLEL", NotParallel, 0 },
|
||||
{ ".NULL", Null, 0 },
|
||||
{ ".OBJDIR", ExObjdir, 0 },
|
||||
{ ".OPTIONAL", Attribute, OP_OPTIONAL },
|
||||
{ ".ORDER", Order, 0 },
|
||||
{ ".PARALLEL", Parallel, 0 },
|
||||
{ ".PATH", ExPath, 0 },
|
||||
{ ".PHONY", Phony, OP_PHONY },
|
||||
{ ".BEGIN", Begin, 0 },
|
||||
{ ".DEFAULT", Default, 0 },
|
||||
{ ".DELETE_ON_ERROR", DeleteOnError, 0 },
|
||||
{ ".END", End, 0 },
|
||||
{ ".ERROR", dotError, 0 },
|
||||
{ ".EXEC", Attribute, OP_EXEC },
|
||||
{ ".IGNORE", Ignore, OP_IGNORE },
|
||||
{ ".INCLUDES", Includes, 0 },
|
||||
{ ".INTERRUPT", Interrupt, 0 },
|
||||
{ ".INVISIBLE", Attribute, OP_INVISIBLE },
|
||||
{ ".JOIN", Attribute, OP_JOIN },
|
||||
{ ".LIBS", Libs, 0 },
|
||||
{ ".MADE", Attribute, OP_MADE },
|
||||
{ ".MAIN", Main, 0 },
|
||||
{ ".MAKE", Attribute, OP_MAKE },
|
||||
{ ".MAKEFLAGS", MFlags, 0 },
|
||||
{ ".META", Meta, OP_META },
|
||||
{ ".MFLAGS", MFlags, 0 },
|
||||
{ ".NOMETA", NoMeta, OP_NOMETA },
|
||||
{ ".NOMETA_CMP", NoMetaCmp, OP_NOMETA_CMP },
|
||||
{ ".NOPATH", NoPath, OP_NOPATH },
|
||||
{ ".NOTMAIN", Attribute, OP_NOTMAIN },
|
||||
{ ".NOTPARALLEL", NotParallel, 0 },
|
||||
{ ".NO_PARALLEL", NotParallel, 0 },
|
||||
{ ".NULL", Null, 0 },
|
||||
{ ".OBJDIR", ExObjdir, 0 },
|
||||
{ ".OPTIONAL", Attribute, OP_OPTIONAL },
|
||||
{ ".ORDER", Order, 0 },
|
||||
{ ".PARALLEL", Parallel, 0 },
|
||||
{ ".PATH", ExPath, 0 },
|
||||
{ ".PHONY", Phony, OP_PHONY },
|
||||
#ifdef POSIX
|
||||
{ ".POSIX", Posix, 0 },
|
||||
{ ".POSIX", Posix, 0 },
|
||||
#endif
|
||||
{ ".PRECIOUS", Precious, OP_PRECIOUS },
|
||||
{ ".RECURSIVE", Attribute, OP_MAKE },
|
||||
{ ".SHELL", ExShell, 0 },
|
||||
{ ".SILENT", Silent, OP_SILENT },
|
||||
{ ".SINGLESHELL", SingleShell, 0 },
|
||||
{ ".STALE", Stale, 0 },
|
||||
{ ".SUFFIXES", Suffixes, 0 },
|
||||
{ ".USE", Attribute, OP_USE },
|
||||
{ ".USEBEFORE", Attribute, OP_USEBEFORE },
|
||||
{ ".WAIT", Wait, 0 },
|
||||
{ ".PRECIOUS", Precious, OP_PRECIOUS },
|
||||
{ ".RECURSIVE", Attribute, OP_MAKE },
|
||||
{ ".SHELL", ExShell, 0 },
|
||||
{ ".SILENT", Silent, OP_SILENT },
|
||||
{ ".SINGLESHELL", SingleShell, 0 },
|
||||
{ ".STALE", Stale, 0 },
|
||||
{ ".SUFFIXES", Suffixes, 0 },
|
||||
{ ".USE", Attribute, OP_USE },
|
||||
{ ".USEBEFORE", Attribute, OP_USEBEFORE },
|
||||
{ ".WAIT", Wait, 0 },
|
||||
};
|
||||
|
||||
/* file loader */
|
||||
|
@ -1144,12 +1145,12 @@ ParseDoDependency(char *line)
|
|||
{
|
||||
typedef List SearchPathList;
|
||||
|
||||
char *cp; /* our current position */
|
||||
char *cp; /* our current position */
|
||||
GNodeType op; /* the operator on the line */
|
||||
char savec; /* a place to save a character */
|
||||
SearchPathList *paths; /* search paths to alter when parsing
|
||||
* a list of .PATH targets */
|
||||
int tOp; /* operator from special target */
|
||||
int tOp; /* operator from special target */
|
||||
GNodeList *sources; /* archive sources after expansion */
|
||||
StringList *curTargs; /* target names to be found and added
|
||||
* to the targets list */
|
||||
|
@ -1245,7 +1246,7 @@ ParseDoDependency(char *line)
|
|||
* .MAIN Its sources are only used if
|
||||
* nothing has been specified to
|
||||
* create.
|
||||
* .DEFAULT Need to create a node to hang
|
||||
* .DEFAULT Need to create a node to hang
|
||||
* commands on, but we don't want
|
||||
* it in the graph, nor do we want
|
||||
* it to be the Main Target, so we
|
||||
|
@ -1253,10 +1254,10 @@ ParseDoDependency(char *line)
|
|||
* add it to the list, setting
|
||||
* DEFAULT to the new node for
|
||||
* later use. We claim the node is
|
||||
* A transformation rule to make
|
||||
* life easier later, when we'll
|
||||
* use Make_HandleUse to actually
|
||||
* apply the .DEFAULT commands.
|
||||
* A transformation rule to make
|
||||
* life easier later, when we'll
|
||||
* use Make_HandleUse to actually
|
||||
* apply the .DEFAULT commands.
|
||||
* .PHONY The list of targets
|
||||
* .NOPATH Don't search for file in the path
|
||||
* .STALE
|
||||
|
@ -1264,11 +1265,11 @@ ParseDoDependency(char *line)
|
|||
* .END
|
||||
* .ERROR
|
||||
* .DELETE_ON_ERROR
|
||||
* .INTERRUPT Are not to be considered the
|
||||
* .INTERRUPT Are not to be considered the
|
||||
* main target.
|
||||
* .NOTPARALLEL Make only one target at a time.
|
||||
* .SINGLESHELL Create a shell for each command.
|
||||
* .ORDER Must set initial predecessor to NULL
|
||||
* .NOTPARALLEL Make only one target at a time.
|
||||
* .SINGLESHELL Create a shell for each command.
|
||||
* .ORDER Must set initial predecessor to NULL
|
||||
*/
|
||||
switch (specType) {
|
||||
case ExPath:
|
||||
|
@ -1769,11 +1770,11 @@ Parse_IsVar(const char *line)
|
|||
void
|
||||
Parse_DoVar(char *line, GNode *ctxt)
|
||||
{
|
||||
char *cp; /* pointer into line */
|
||||
char *cp; /* pointer into line */
|
||||
enum {
|
||||
VAR_SUBST, VAR_APPEND, VAR_SHELL, VAR_NORMAL
|
||||
} type; /* Type of assignment */
|
||||
char *opc; /* ptr to operator character to
|
||||
} type; /* Type of assignment */
|
||||
char *opc; /* ptr to operator character to
|
||||
* null-terminate the variable name */
|
||||
Boolean freeCp = FALSE; /* TRUE if cp needs to be freed,
|
||||
* i.e. if any variable expansion was
|
||||
|
@ -1947,7 +1948,7 @@ Parse_DoVar(char *line, GNode *ctxt)
|
|||
|
||||
/*
|
||||
* ParseMaybeSubMake --
|
||||
* Scan the command string to see if it a possible submake node
|
||||
* Scan the command string to see if it a possible submake node
|
||||
* Input:
|
||||
* cmd the command to scan
|
||||
* Results:
|
||||
|
@ -2149,7 +2150,7 @@ Parse_include_file(char *file, Boolean isSystem, Boolean depinc, int silent)
|
|||
static void
|
||||
ParseDoInclude(char *line)
|
||||
{
|
||||
char endc; /* the character which ends the file spec */
|
||||
char endc; /* the character which ends the file spec */
|
||||
char *cp; /* current position in file spec */
|
||||
int silent = *line != 'i';
|
||||
char *file = &line[7 + silent];
|
||||
|
@ -2718,10 +2719,10 @@ ParseGetLine(int flags, int *length)
|
|||
static char *
|
||||
ParseReadLine(void)
|
||||
{
|
||||
char *line; /* Result */
|
||||
int lineLength; /* Length of result */
|
||||
int lineno; /* Saved line # */
|
||||
int rval;
|
||||
char *line; /* Result */
|
||||
int lineLength; /* Length of result */
|
||||
int lineno; /* Saved line # */
|
||||
int rval;
|
||||
|
||||
for (;;) {
|
||||
line = ParseGetLine(0, &lineLength);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: suff.c,v 1.169 2020/09/26 17:15:20 rillig Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.170 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -74,59 +74,62 @@
|
|||
* using suffix transformation rules
|
||||
*
|
||||
* Interface:
|
||||
* Suff_Init Initialize all things to do with suffixes.
|
||||
* Suff_Init Initialize all things to do with suffixes.
|
||||
*
|
||||
* Suff_End Cleanup the module
|
||||
* Suff_End Cleanup the module
|
||||
*
|
||||
* Suff_DoPaths This function is used to make life easier
|
||||
* when searching for a file according to its
|
||||
* suffix. It takes the global search path,
|
||||
* as defined using the .PATH: target, and appends
|
||||
* its directories to the path of each of the
|
||||
* defined suffixes, as specified using
|
||||
* .PATH<suffix>: targets. In addition, all
|
||||
* directories given for suffixes labeled as
|
||||
* include files or libraries, using the .INCLUDES
|
||||
* or .LIBS targets, are played with using
|
||||
* Dir_MakeFlags to create the .INCLUDES and
|
||||
* .LIBS global variables.
|
||||
* Suff_DoPaths This function is used to make life easier
|
||||
* when searching for a file according to its
|
||||
* suffix. It takes the global search path,
|
||||
* as defined using the .PATH: target, and appends
|
||||
* its directories to the path of each of the
|
||||
* defined suffixes, as specified using
|
||||
* .PATH<suffix>: targets. In addition, all
|
||||
* directories given for suffixes labeled as
|
||||
* include files or libraries, using the .INCLUDES
|
||||
* or .LIBS targets, are played with using
|
||||
* Dir_MakeFlags to create the .INCLUDES and
|
||||
* .LIBS global variables.
|
||||
*
|
||||
* Suff_ClearSuffixes Clear out all the suffixes and defined
|
||||
* transformations.
|
||||
* Suff_ClearSuffixes
|
||||
* Clear out all the suffixes and defined
|
||||
* transformations.
|
||||
*
|
||||
* Suff_IsTransform Return TRUE if the passed string is the lhs
|
||||
* of a transformation rule.
|
||||
* Suff_IsTransform
|
||||
* Return TRUE if the passed string is the lhs
|
||||
* of a transformation rule.
|
||||
*
|
||||
* Suff_AddSuffix Add the passed string as another known suffix.
|
||||
* Suff_AddSuffix Add the passed string as another known suffix.
|
||||
*
|
||||
* Suff_GetPath Return the search path for the given suffix.
|
||||
* Suff_GetPath Return the search path for the given suffix.
|
||||
*
|
||||
* Suff_AddInclude Mark the given suffix as denoting an include
|
||||
* file.
|
||||
* Suff_AddInclude
|
||||
* Mark the given suffix as denoting an include file.
|
||||
*
|
||||
* Suff_AddLib Mark the given suffix as denoting a library.
|
||||
* Suff_AddLib Mark the given suffix as denoting a library.
|
||||
*
|
||||
* Suff_AddTransform Add another transformation to the suffix
|
||||
* graph. Returns GNode suitable for framing, I
|
||||
* mean, tacking commands, attributes, etc. on.
|
||||
* Suff_AddTransform
|
||||
* Add another transformation to the suffix
|
||||
* graph. Returns GNode suitable for framing, I
|
||||
* mean, tacking commands, attributes, etc. on.
|
||||
*
|
||||
* Suff_SetNull Define the suffix to consider the suffix of
|
||||
* any file that doesn't have a known one.
|
||||
* Suff_SetNull Define the suffix to consider the suffix of
|
||||
* any file that doesn't have a known one.
|
||||
*
|
||||
* Suff_FindDeps Find implicit sources for and the location of
|
||||
* a target based on its suffix. Returns the
|
||||
* bottom-most node added to the graph or NULL
|
||||
* if the target had no implicit sources.
|
||||
* Suff_FindDeps Find implicit sources for and the location of
|
||||
* a target based on its suffix. Returns the
|
||||
* bottom-most node added to the graph or NULL
|
||||
* if the target had no implicit sources.
|
||||
*
|
||||
* Suff_FindPath Return the appropriate path to search in
|
||||
* order to find the node.
|
||||
* Suff_FindPath Return the appropriate path to search in order to
|
||||
* find the node.
|
||||
*/
|
||||
|
||||
#include "make.h"
|
||||
#include "dir.h"
|
||||
|
||||
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
|
||||
MAKE_RCSID("$NetBSD: suff.c,v 1.169 2020/09/26 17:15:20 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: suff.c,v 1.170 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
#define SUFF_DEBUG0(fmt) \
|
||||
if (!DEBUG(SUFF)) (void) 0; else fprintf(debug_file, fmt)
|
||||
|
@ -171,12 +174,12 @@ typedef List SuffListList;
|
|||
* Structure describing an individual suffix.
|
||||
*/
|
||||
typedef struct Suff {
|
||||
char *name; /* The suffix itself, such as ".c" */
|
||||
char *name; /* The suffix itself, such as ".c" */
|
||||
size_t nameLen; /* Length of the name, to avoid strlen calls */
|
||||
SuffFlags flags; /* Type of suffix */
|
||||
SuffFlags flags; /* Type of suffix */
|
||||
SearchPath *searchPath; /* The path along which files of this suffix
|
||||
* may be found */
|
||||
int sNum; /* The suffix number */
|
||||
int sNum; /* The suffix number */
|
||||
int refCount; /* Reference count of list membership */
|
||||
SuffList *parents; /* Suffixes we have a transformation to */
|
||||
SuffList *children; /* Suffixes we have a transformation from */
|
||||
|
@ -187,12 +190,12 @@ typedef struct Suff {
|
|||
* Structure used in the search for implied sources.
|
||||
*/
|
||||
typedef struct Src {
|
||||
char *file; /* The file to look for */
|
||||
char *pref; /* Prefix from which file was formed */
|
||||
Suff *suff; /* The suffix on the file */
|
||||
struct Src *parent; /* The Src for which this is a source */
|
||||
GNode *node; /* The node describing the file */
|
||||
int children; /* Count of existing children (so we don't free
|
||||
char *file; /* The file to look for */
|
||||
char *pref; /* Prefix from which file was formed */
|
||||
Suff *suff; /* The suffix on the file */
|
||||
struct Src *parent; /* The Src for which this is a source */
|
||||
GNode *node; /* The node describing the file */
|
||||
int children; /* Count of existing children (so we don't free
|
||||
* this thing too early or never nuke it) */
|
||||
#ifdef DEBUG_SRC
|
||||
SrcList *cp; /* Debug; children list */
|
||||
|
@ -215,8 +218,8 @@ typedef struct GNodeSuff {
|
|||
Boolean r;
|
||||
} GNodeSuff;
|
||||
|
||||
static Suff *suffNull; /* The NULL suffix for this run */
|
||||
static Suff *emptySuff; /* The empty suffix required for POSIX
|
||||
static Suff *suffNull; /* The NULL suffix for this run */
|
||||
static Suff *emptySuff; /* The empty suffix required for POSIX
|
||||
* single-suffix transformation rules */
|
||||
|
||||
|
||||
|
@ -270,8 +273,8 @@ struct SuffSuffGetSuffixArgs {
|
|||
static char *
|
||||
SuffSuffGetSuffix(const Suff *s, const struct SuffSuffGetSuffixArgs *str)
|
||||
{
|
||||
char *p1; /* Pointer into suffix name */
|
||||
char *p2; /* Pointer into string being examined */
|
||||
char *p1; /* Pointer into suffix name */
|
||||
char *p2; /* Pointer into string being examined */
|
||||
|
||||
if (str->name_len < s->nameLen)
|
||||
return NULL; /* this string is shorter than the suffix */
|
||||
|
@ -419,15 +422,15 @@ SuffNew(const char *name)
|
|||
{
|
||||
Suff *s = bmake_malloc(sizeof(Suff));
|
||||
|
||||
s->name = bmake_strdup(name);
|
||||
s->nameLen = strlen(s->name);
|
||||
s->name = bmake_strdup(name);
|
||||
s->nameLen = strlen(s->name);
|
||||
s->searchPath = Lst_Init();
|
||||
s->children = Lst_Init();
|
||||
s->parents = Lst_Init();
|
||||
s->ref = Lst_Init();
|
||||
s->sNum = sNum++;
|
||||
s->flags = 0;
|
||||
s->refCount = 1;
|
||||
s->children = Lst_Init();
|
||||
s->parents = Lst_Init();
|
||||
s->ref = Lst_Init();
|
||||
s->sNum = sNum++;
|
||||
s->flags = 0;
|
||||
s->refCount = 1;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -450,7 +453,7 @@ Suff_ClearSuffixes(void)
|
|||
emptySuff = suffNull = SuffNew("");
|
||||
|
||||
Dir_Concat(suffNull->searchPath, dirSearchPath);
|
||||
suffNull->flags = SUFF_NULL;
|
||||
suffNull->flags = SUFF_NULL;
|
||||
}
|
||||
|
||||
/* Parse a transformation string to find its two component suffixes.
|
||||
|
@ -530,7 +533,7 @@ SuffParseTransform(const char *str, Suff **out_src, Suff **out_targ)
|
|||
Boolean
|
||||
Suff_IsTransform(const char *str)
|
||||
{
|
||||
Suff *src, *targ;
|
||||
Suff *src, *targ;
|
||||
|
||||
return SuffParseTransform(str, &src, &targ);
|
||||
}
|
||||
|
@ -553,7 +556,7 @@ Suff_AddTransform(const char *line)
|
|||
GNode *gn; /* GNode of transformation rule */
|
||||
Suff *s, /* source suffix */
|
||||
*t; /* target suffix */
|
||||
GNodeListNode *ln; /* Node for existing transformation */
|
||||
GNodeListNode *ln; /* Node for existing transformation */
|
||||
Boolean ok;
|
||||
|
||||
ln = Lst_Find(transforms, SuffGNHasName, line);
|
||||
|
@ -665,9 +668,9 @@ Suff_EndTransform(GNode *gn)
|
|||
static void
|
||||
SuffRebuildGraph(void *transformp, void *sp)
|
||||
{
|
||||
GNode *transform = (GNode *)transformp;
|
||||
Suff *s = (Suff *)sp;
|
||||
char *cp;
|
||||
GNode *transform = (GNode *)transformp;
|
||||
Suff *s = (Suff *)sp;
|
||||
char *cp;
|
||||
struct SuffSuffGetSuffixArgs sd;
|
||||
|
||||
/*
|
||||
|
@ -721,10 +724,10 @@ SuffRebuildGraph(void *transformp, void *sp)
|
|||
static int
|
||||
SuffScanTargets(void *targetp, void *gsp)
|
||||
{
|
||||
GNode *target = (GNode *)targetp;
|
||||
GNodeSuff *gs = (GNodeSuff *)gsp;
|
||||
Suff *s, *t;
|
||||
char *ptr;
|
||||
GNode *target = (GNode *)targetp;
|
||||
GNodeSuff *gs = (GNodeSuff *)gsp;
|
||||
Suff *s, *t;
|
||||
char *ptr;
|
||||
|
||||
if (*gs->gnp == NULL && gs->r && (target->type & OP_NOTARGET) == 0) {
|
||||
*gs->gnp = target;
|
||||
|
@ -914,10 +917,10 @@ PrintAddr(void *a, void *b MAKE_ATTR_UNUSED)
|
|||
static void
|
||||
SuffAddSrc(void *sp, void *lsp)
|
||||
{
|
||||
Suff *s = (Suff *)sp;
|
||||
LstSrc *ls = (LstSrc *)lsp;
|
||||
Src *s2; /* new Src structure */
|
||||
Src *targ; /* Target structure */
|
||||
Suff *s = (Suff *)sp;
|
||||
LstSrc *ls = (LstSrc *)lsp;
|
||||
Src *s2; /* new Src structure */
|
||||
Src *targ; /* Target structure */
|
||||
|
||||
targ = ls->s;
|
||||
|
||||
|
@ -928,11 +931,11 @@ SuffAddSrc(void *sp, void *lsp)
|
|||
* that...
|
||||
*/
|
||||
s2 = bmake_malloc(sizeof(Src));
|
||||
s2->file = bmake_strdup(targ->pref);
|
||||
s2->pref = targ->pref;
|
||||
s2->parent = targ;
|
||||
s2->node = NULL;
|
||||
s2->suff = s;
|
||||
s2->file = bmake_strdup(targ->pref);
|
||||
s2->pref = targ->pref;
|
||||
s2->parent = targ;
|
||||
s2->node = NULL;
|
||||
s2->suff = s;
|
||||
s->refCount++;
|
||||
s2->children = 0;
|
||||
targ->children += 1;
|
||||
|
@ -946,11 +949,11 @@ SuffAddSrc(void *sp, void *lsp)
|
|||
#endif
|
||||
}
|
||||
s2 = bmake_malloc(sizeof(Src));
|
||||
s2->file = str_concat2(targ->pref, s->name);
|
||||
s2->pref = targ->pref;
|
||||
s2->parent = targ;
|
||||
s2->node = NULL;
|
||||
s2->suff = s;
|
||||
s2->file = str_concat2(targ->pref, s->name);
|
||||
s2->pref = targ->pref;
|
||||
s2->parent = targ;
|
||||
s2->node = NULL;
|
||||
s2->suff = s;
|
||||
s->refCount++;
|
||||
s2->children = 0;
|
||||
targ->children += 1;
|
||||
|
@ -1103,13 +1106,12 @@ static Src *
|
|||
SuffFindCmds(Src *targ, SrcList *slst)
|
||||
{
|
||||
GNodeListNode *gln;
|
||||
|
||||
GNode *t, /* Target GNode */
|
||||
*s; /* Source GNode */
|
||||
size_t prefLen;/* The length of the defined prefix */
|
||||
Suff *suff; /* Suffix on matching beastie */
|
||||
Src *ret; /* Return value */
|
||||
char *cp;
|
||||
GNode *t; /* Target GNode */
|
||||
GNode *s; /* Source GNode */
|
||||
size_t prefLen; /* The length of the defined prefix */
|
||||
Suff *suff; /* Suffix on matching beastie */
|
||||
Src *ret; /* Return value */
|
||||
char *cp;
|
||||
|
||||
t = targ->node;
|
||||
Lst_Open(t->children);
|
||||
|
@ -1202,9 +1204,9 @@ SuffFindCmds(Src *targ, SrcList *slst)
|
|||
static void
|
||||
SuffExpandChildren(GNodeListNode *cln, GNode *pgn)
|
||||
{
|
||||
GNode *cgn = LstNode_Datum(cln);
|
||||
GNode *gn; /* New source 8) */
|
||||
char *cp; /* Expanded value */
|
||||
GNode *cgn = LstNode_Datum(cln);
|
||||
GNode *gn; /* New source 8) */
|
||||
char *cp; /* Expanded value */
|
||||
|
||||
if (!Lst_IsEmpty(cgn->order_pred) || !Lst_IsEmpty(cgn->order_succ))
|
||||
/* It is all too hard to process the result of .ORDER */
|
||||
|
@ -1355,7 +1357,7 @@ SuffExpandChildren(GNodeListNode *cln, GNode *pgn)
|
|||
static void
|
||||
SuffExpandWildcards(GNodeListNode *cln, GNode *pgn)
|
||||
{
|
||||
GNode *cgn = LstNode_Datum(cln);
|
||||
GNode *cgn = LstNode_Datum(cln);
|
||||
StringList *explist;
|
||||
|
||||
if (!Dir_HasWildcards(cgn->name))
|
||||
|
@ -1459,8 +1461,8 @@ static Boolean
|
|||
SuffApplyTransform(GNode *tGn, GNode *sGn, Suff *t, Suff *s)
|
||||
{
|
||||
GNodeListNode *ln, *nln; /* General node */
|
||||
char *tname; /* Name of transformation rule */
|
||||
GNode *gn; /* Node for same */
|
||||
char *tname; /* Name of transformation rule */
|
||||
GNode *gn; /* Node for same */
|
||||
|
||||
/*
|
||||
* Form the proper links between the target and source.
|
||||
|
@ -1674,17 +1676,17 @@ SuffFindArchiveDeps(GNode *gn, SrcList *slst)
|
|||
static void
|
||||
SuffFindNormalDeps(GNode *gn, SrcList *slst)
|
||||
{
|
||||
char *eoname; /* End of name */
|
||||
char *sopref; /* Start of prefix */
|
||||
char *eoname; /* End of name */
|
||||
char *sopref; /* Start of prefix */
|
||||
SuffListNode *ln, *nln;
|
||||
SrcList *srcs; /* List of sources at which to look */
|
||||
SrcList *targs; /* List of targets to which things can be
|
||||
* transformed. They all have the same file,
|
||||
* but different suff and pref fields */
|
||||
Src *bottom; /* Start of found transformation path */
|
||||
Src *src; /* General Src pointer */
|
||||
char *pref; /* Prefix to use */
|
||||
Src *targ; /* General Src target pointer */
|
||||
SrcList *srcs; /* List of sources at which to look */
|
||||
SrcList *targs; /* List of targets to which things can be
|
||||
* transformed. They all have the same file,
|
||||
* but different suff and pref fields */
|
||||
Src *bottom; /* Start of found transformation path */
|
||||
Src *src; /* General Src pointer */
|
||||
char *pref; /* Prefix to use */
|
||||
Src *targ; /* General Src target pointer */
|
||||
struct SuffSuffGetSuffixArgs sd; /* Search string data */
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: targ.c,v 1.105 2020/09/27 12:10:51 rillig Exp $ */
|
||||
/* $NetBSD: targ.c,v 1.106 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -74,44 +74,45 @@
|
|||
* kept in two structures: a Lst and a hash table.
|
||||
*
|
||||
* Interface:
|
||||
* Targ_Init Initialization procedure.
|
||||
* Targ_Init Initialization procedure.
|
||||
*
|
||||
* Targ_End Cleanup the module
|
||||
* Targ_End Cleanup the module
|
||||
*
|
||||
* Targ_List Return the list of all targets so far.
|
||||
* Targ_List Return the list of all targets so far.
|
||||
*
|
||||
* Targ_NewGN Create a new GNode for the passed target
|
||||
* (string). The node is *not* placed in the
|
||||
* hash table, though all its fields are
|
||||
* initialized.
|
||||
* Targ_NewGN Create a new GNode for the passed target
|
||||
* (string). The node is *not* placed in the
|
||||
* hash table, though all its fields are
|
||||
* initialized.
|
||||
*
|
||||
* Targ_FindNode Find the node, or return NULL.
|
||||
* Targ_FindNode Find the node, or return NULL.
|
||||
*
|
||||
* Targ_GetNode Find the node, or create it.
|
||||
* Targ_GetNode Find the node, or create it.
|
||||
*
|
||||
* Targ_NewInternalNode Create an internal node.
|
||||
* Targ_NewInternalNode
|
||||
* Create an internal node.
|
||||
*
|
||||
* Targ_FindList Given a list of names, find nodes for all
|
||||
* of them, creating them as necessary.
|
||||
* Targ_FindList Given a list of names, find nodes for all
|
||||
* of them, creating them as necessary.
|
||||
*
|
||||
* Targ_Ignore Return TRUE if errors should be ignored when
|
||||
* creating the given target.
|
||||
* Targ_Ignore Return TRUE if errors should be ignored when
|
||||
* creating the given target.
|
||||
*
|
||||
* Targ_Silent Return TRUE if we should be silent when
|
||||
* creating the given target.
|
||||
* Targ_Silent Return TRUE if we should be silent when
|
||||
* creating the given target.
|
||||
*
|
||||
* Targ_Precious Return TRUE if the target is precious and
|
||||
* should not be removed if we are interrupted.
|
||||
* Targ_Precious Return TRUE if the target is precious and
|
||||
* should not be removed if we are interrupted.
|
||||
*
|
||||
* Targ_Propagate Propagate information between related
|
||||
* nodes. Should be called after the
|
||||
* makefiles are parsed but before any
|
||||
* action is taken.
|
||||
* Targ_Propagate Propagate information between related nodes.
|
||||
* Should be called after the makefiles are parsed
|
||||
* but before any action is taken.
|
||||
*
|
||||
* Debugging:
|
||||
* Targ_PrintGraph Print out the entire graphm all variables
|
||||
* and statistics for the directory cache. Should
|
||||
* print something for suffixes, too, but...
|
||||
* Targ_PrintGraph
|
||||
* Print out the entire graphm all variables and
|
||||
* statistics for the directory cache. Should print
|
||||
* something for suffixes, too, but...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -121,7 +122,7 @@
|
|||
#include "dir.h"
|
||||
|
||||
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: targ.c,v 1.105 2020/09/27 12:10:51 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: targ.c,v 1.106 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
static GNodeList *allTargets; /* the list of all targets found so far */
|
||||
#ifdef CLEANUP
|
||||
|
@ -181,26 +182,26 @@ Targ_NewGN(const char *name)
|
|||
gn->uname = NULL;
|
||||
gn->path = NULL;
|
||||
gn->type = name[0] == '-' && name[1] == 'l' ? OP_LIB : 0;
|
||||
gn->unmade = 0;
|
||||
gn->unmade = 0;
|
||||
gn->unmade_cohorts = 0;
|
||||
gn->cohort_num[0] = 0;
|
||||
gn->centurion = NULL;
|
||||
gn->made = UNMADE;
|
||||
gn->flags = 0;
|
||||
gn->checked = 0;
|
||||
gn->mtime = 0;
|
||||
gn->cmgn = NULL;
|
||||
gn->centurion = NULL;
|
||||
gn->made = UNMADE;
|
||||
gn->flags = 0;
|
||||
gn->checked = 0;
|
||||
gn->mtime = 0;
|
||||
gn->cmgn = NULL;
|
||||
gn->implicitParents = Lst_Init();
|
||||
gn->cohorts = Lst_Init();
|
||||
gn->parents = Lst_Init();
|
||||
gn->children = Lst_Init();
|
||||
gn->order_pred = Lst_Init();
|
||||
gn->order_succ = Lst_Init();
|
||||
gn->cohorts = Lst_Init();
|
||||
gn->parents = Lst_Init();
|
||||
gn->children = Lst_Init();
|
||||
gn->order_pred = Lst_Init();
|
||||
gn->order_succ = Lst_Init();
|
||||
Hash_InitTable(&gn->context);
|
||||
gn->commands = Lst_Init();
|
||||
gn->suffix = NULL;
|
||||
gn->fname = NULL;
|
||||
gn->lineno = 0;
|
||||
gn->commands = Lst_Init();
|
||||
gn->suffix = NULL;
|
||||
gn->fname = NULL;
|
||||
gn->lineno = 0;
|
||||
|
||||
#ifdef CLEANUP
|
||||
if (allGNs == NULL)
|
||||
|
@ -375,8 +376,8 @@ Targ_PrintCmds(GNode *gn)
|
|||
char *
|
||||
Targ_FmtTime(time_t tm)
|
||||
{
|
||||
struct tm *parts;
|
||||
static char buf[128];
|
||||
struct tm *parts;
|
||||
static char buf[128];
|
||||
|
||||
parts = localtime(&tm);
|
||||
(void)strftime(buf, sizeof buf, "%k:%M:%S %b %d, %Y", parts);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: cond-func-defined.mk,v 1.3 2020/08/20 17:23:43 rillig Exp $
|
||||
# $NetBSD: cond-func-defined.mk,v 1.4 2020/09/27 21:35:16 rillig Exp $
|
||||
#
|
||||
# Tests for the defined() function in .if conditions.
|
||||
|
||||
|
@ -9,12 +9,12 @@ ${:UA B}= variable name with spaces
|
|||
.error
|
||||
.endif
|
||||
|
||||
# Horizontal whitespace after the opening parenthesis is ignored.
|
||||
# Horizontal whitespace (space tab) after the opening parenthesis is ignored.
|
||||
.if !defined( DEF)
|
||||
.error
|
||||
.endif
|
||||
|
||||
# Horizontal whitespace before the closing parenthesis is ignored.
|
||||
# Horizontal whitespace (space tab) before the closing parenthesis is ignored.
|
||||
.if !defined(DEF )
|
||||
.error
|
||||
.endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: cond-func.mk,v 1.2 2020/09/23 08:11:28 rillig Exp $
|
||||
# $NetBSD: cond-func.mk,v 1.3 2020/09/27 21:35:16 rillig Exp $
|
||||
#
|
||||
# Tests for those parts of the functions in .if conditions that are common
|
||||
# among several functions.
|
||||
|
@ -15,12 +15,12 @@ ${:UVAR{value}}= variable name with braces
|
|||
.error
|
||||
.endif
|
||||
|
||||
# Horizontal whitespace after the opening parenthesis is ignored.
|
||||
# Horizontal whitespace (space tab) after the opening parenthesis is ignored.
|
||||
.if !defined( DEF)
|
||||
.error
|
||||
.endif
|
||||
|
||||
# Horizontal whitespace before the closing parenthesis is ignored.
|
||||
# Horizontal whitespace (space tab) before the closing parenthesis is ignored.
|
||||
.if !defined(DEF )
|
||||
.error
|
||||
.endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: posix1.mk,v 1.4 2020/08/10 18:19:58 rillig Exp $
|
||||
# $NetBSD: posix1.mk,v 1.5 2020/09/27 21:35:16 rillig Exp $
|
||||
|
||||
# Keep the default suffixes from interfering, just in case.
|
||||
.SUFFIXES:
|
||||
|
@ -60,7 +60,7 @@ ARFLAGS = -rcv
|
|||
localvars: lib.a
|
||||
|
||||
# $@ = target or archive name $< = implied source
|
||||
# $* = target without suffix $? = sources newer than target
|
||||
# $* = target without suffix $? = sources newer than target
|
||||
# $% = archive member name
|
||||
LOCALS = \
|
||||
"Local variables\n\
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: var.c,v 1.545 2020/09/27 16:52:22 rillig Exp $ */
|
||||
/* $NetBSD: var.c,v 1.546 2020/09/27 21:35:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -73,35 +73,35 @@
|
|||
* Variable-handling functions
|
||||
*
|
||||
* Interface:
|
||||
* Var_Set Set the value of a variable in the given
|
||||
* context. The variable is created if it doesn't
|
||||
* yet exist.
|
||||
* Var_Set Set the value of a variable in the given
|
||||
* context. The variable is created if it doesn't
|
||||
* yet exist.
|
||||
*
|
||||
* Var_Append Append more characters to an existing variable
|
||||
* in the given context. The variable needn't
|
||||
* exist already -- it will be created if it doesn't.
|
||||
* A space is placed between the old value and the
|
||||
* new one.
|
||||
* Var_Append Append more characters to an existing variable
|
||||
* in the given context. The variable needn't
|
||||
* exist already -- it will be created if it doesn't.
|
||||
* A space is placed between the old value and the
|
||||
* new one.
|
||||
*
|
||||
* Var_Exists See if a variable exists.
|
||||
* Var_Exists See if a variable exists.
|
||||
*
|
||||
* Var_Value Return the unexpanded value of a variable in a
|
||||
* context or NULL if the variable is undefined.
|
||||
* Var_Value Return the unexpanded value of a variable in a
|
||||
* context or NULL if the variable is undefined.
|
||||
*
|
||||
* Var_Subst Substitute either a single variable or all
|
||||
* variables in a string, using the given context.
|
||||
* Var_Subst Substitute either a single variable or all
|
||||
* variables in a string, using the given context.
|
||||
*
|
||||
* Var_Parse Parse a variable expansion from a string and
|
||||
* return the result and the number of characters
|
||||
* consumed.
|
||||
* Var_Parse Parse a variable expansion from a string and
|
||||
* return the result and the number of characters
|
||||
* consumed.
|
||||
*
|
||||
* Var_Delete Delete a variable in a context.
|
||||
* Var_Delete Delete a variable in a context.
|
||||
*
|
||||
* Var_Init Initialize this module.
|
||||
* Var_Init Initialize this module.
|
||||
*
|
||||
* Debugging:
|
||||
* Var_Dump Print out all variables defined in the given
|
||||
* context.
|
||||
* Var_Dump Print out all variables defined in the given
|
||||
* context.
|
||||
*
|
||||
* XXX: There's a lot of duplication in these functions.
|
||||
*/
|
||||
|
@ -121,7 +121,7 @@
|
|||
#include "metachar.h"
|
||||
|
||||
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.545 2020/09/27 16:52:22 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: var.c,v 1.546 2020/09/27 21:35:16 rillig Exp $");
|
||||
|
||||
#define VAR_DEBUG_IF(cond, fmt, ...) \
|
||||
if (!(DEBUG(VAR) && (cond))) \
|
||||
|
@ -222,7 +222,7 @@ typedef struct Var {
|
|||
* Hash_Entry name for all other variables,
|
||||
* and thus must not be modified */
|
||||
Buffer val; /* its value */
|
||||
VarFlags flags; /* miscellaneous status flags */
|
||||
VarFlags flags; /* miscellaneous status flags */
|
||||
} Var;
|
||||
|
||||
/*
|
||||
|
@ -1319,11 +1319,11 @@ VarREError(int reerr, regex_t *pat, const char *str)
|
|||
}
|
||||
|
||||
struct ModifyWord_SubstRegexArgs {
|
||||
regex_t re;
|
||||
size_t nsub;
|
||||
char *replace;
|
||||
regex_t re;
|
||||
size_t nsub;
|
||||
char *replace;
|
||||
VarPatternFlags pflags;
|
||||
Boolean matched;
|
||||
Boolean matched;
|
||||
};
|
||||
|
||||
/* Callback for ModifyWords to implement the :C/from/to/ modifier.
|
||||
|
@ -2769,7 +2769,7 @@ ApplyModifier_IfElse(const char **pp, ApplyModifiersState *st)
|
|||
*
|
||||
* foo: .USE
|
||||
* .for i in ${.TARGET} ${.TARGET:R}.gz
|
||||
* @: ${t::=$i}
|
||||
* @: ${t::=$i}
|
||||
* @echo blah ${t:T}
|
||||
* .endfor
|
||||
*
|
||||
|
@ -3443,12 +3443,12 @@ Var_Parse(const char **pp, GNode *ctxt, VarEvalFlags eflags,
|
|||
{
|
||||
const char *const start = *pp;
|
||||
const char *p;
|
||||
Boolean haveModifier; /* TRUE if have modifiers for the variable */
|
||||
char startc; /* Starting character if variable in parens
|
||||
Boolean haveModifier; /* TRUE if have modifiers for the variable */
|
||||
char startc; /* Starting character if variable in parens
|
||||
* or braces */
|
||||
char endc; /* Ending character if variable in parens
|
||||
char endc; /* Ending character if variable in parens
|
||||
* or braces */
|
||||
Boolean dynamic; /* TRUE if the variable is local and we're
|
||||
Boolean dynamic; /* TRUE if the variable is local and we're
|
||||
* expanding it in a non-local context. This
|
||||
* is done to support dynamic sources. The
|
||||
* result is just the expression, unaltered */
|
||||
|
|
Loading…
Reference in New Issue