summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2005-02-01 10:50:37 +0000
committerharti <harti@FreeBSD.org>2005-02-01 10:50:37 +0000
commitb24cc988512ed34d0854c1b8adc8f42b8abecbd5 (patch)
treead58e65b384352ba6b76d8d9e9ad5ae790aaf99f /usr.bin
parentb0d098fb3c0b0335d47a860cc6fb174948400795 (diff)
downloadFreeBSD-src-b24cc988512ed34d0854c1b8adc8f42b8abecbd5.zip
FreeBSD-src-b24cc988512ed34d0854c1b8adc8f42b8abecbd5.tar.gz
Clean up include files and file including. Split nonints.h into pieces
that get included just where they are needed. All headers include the headers that they need to compile (just with an empty .c file). Sort includes alphabetically where apropriate and fix some duplicate commenting for struct Job, struct GNode and struct Shell by removing one version and inlining the comments into the structure declaration (the comments have been somewhat outdated). This patch does not contain functional changes (checked with md5). Submitted by: Max Okumoto <okumoto@ucsd.edu>
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/GNode.h162
-rw-r--r--usr.bin/make/arch.c39
-rw-r--r--usr.bin/make/arch.h58
-rw-r--r--usr.bin/make/buf.c9
-rw-r--r--usr.bin/make/buf.h25
-rw-r--r--usr.bin/make/compat.c37
-rw-r--r--usr.bin/make/compat.h49
-rw-r--r--usr.bin/make/cond.c23
-rw-r--r--usr.bin/make/cond.h54
-rw-r--r--usr.bin/make/config.h7
-rw-r--r--usr.bin/make/dir.c19
-rw-r--r--usr.bin/make/dir.h30
-rw-r--r--usr.bin/make/for.c26
-rw-r--r--usr.bin/make/for.h47
-rw-r--r--usr.bin/make/globals.h124
-rw-r--r--usr.bin/make/hash.c10
-rw-r--r--usr.bin/make/hash.h10
-rw-r--r--usr.bin/make/job.c22
-rw-r--r--usr.bin/make/job.h229
-rw-r--r--usr.bin/make/lst.h14
-rw-r--r--usr.bin/make/lst.lib/lstAppend.c5
-rw-r--r--usr.bin/make/lst.lib/lstConcat.c3
-rw-r--r--usr.bin/make/lst.lib/lstDeQueue.c3
-rw-r--r--usr.bin/make/lst.lib/lstDestroy.c3
-rw-r--r--usr.bin/make/lst.lib/lstDupl.c3
-rw-r--r--usr.bin/make/lst.lib/lstFindFrom.c3
-rw-r--r--usr.bin/make/lst.lib/lstForEachFrom.c4
-rw-r--r--usr.bin/make/lst.lib/lstInsert.c3
-rw-r--r--usr.bin/make/lst.lib/lstMember.c3
-rw-r--r--usr.bin/make/lst.lib/lstRemove.c4
-rw-r--r--usr.bin/make/main.c36
-rw-r--r--usr.bin/make/make.c19
-rw-r--r--usr.bin/make/make.h269
-rw-r--r--usr.bin/make/nonints.h99
-rw-r--r--usr.bin/make/parse.c26
-rw-r--r--usr.bin/make/parse.h75
-rw-r--r--usr.bin/make/pathnames.h13
-rw-r--r--usr.bin/make/sprite.h14
-rw-r--r--usr.bin/make/str.c9
-rw-r--r--usr.bin/make/str.h66
-rw-r--r--usr.bin/make/suff.c22
-rw-r--r--usr.bin/make/suff.h60
-rw-r--r--usr.bin/make/targ.c19
-rw-r--r--usr.bin/make/targ.h73
-rw-r--r--usr.bin/make/util.c15
-rw-r--r--usr.bin/make/util.h90
-rw-r--r--usr.bin/make/var.c24
-rw-r--r--usr.bin/make/var.h25
-rw-r--r--usr.bin/make/var_modify.c18
49 files changed, 1372 insertions, 628 deletions
diff --git a/usr.bin/make/GNode.h b/usr.bin/make/GNode.h
new file mode 100644
index 0000000..b41d1ea
--- /dev/null
+++ b/usr.bin/make/GNode.h
@@ -0,0 +1,162 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef GNode_h_39503bf2
+#define GNode_h_39503bf2
+
+#include "sprite.h"
+#include "lst.h"
+
+struct _Suff;
+
+/*
+ * The structure for an individual graph node. Each node has several
+ * pieces of data associated with it.
+ */
+typedef struct GNode {
+ char *name; /* The target's name */
+ char *path; /* The full pathname of the target file */
+
+ /*
+ * The type of operator used to define the sources (qv. parse.c)
+ * See OP_ flags in make.h
+ */
+ int type;
+
+ int order; /* Its wait weight */
+
+ Boolean make; /* TRUE if this target needs to be remade */
+
+ /* Set to reflect the state of processing on this node */
+ enum {
+ UNMADE, /* Not examined yet */
+
+ /*
+ * Target is already being made. Indicates a cycle in the graph.
+ * (compat mode only)
+ */
+ BEINGMADE,
+
+ MADE, /* Was out-of-date and has been made */
+ UPTODATE, /* Was already up-to-date */
+
+ /*
+ * An error occured while it was being
+ * made (used only in compat mode)
+ */
+ ERROR,
+
+ /*
+ * The target was aborted due to an
+ * error making an inferior (compat).
+ */
+ ABORTED,
+
+ /*
+ * Marked as potentially being part of a graph cycle. If we
+ * come back to a node marked this way, it is printed and
+ * 'made' is changed to ENDCYCLE.
+ */
+ CYCLE,
+
+ /*
+ * The cycle has been completely printed. Go back and
+ * unmark all its members.
+ */
+ ENDCYCLE
+ } made;
+
+ /* TRUE if one of this target's children was made */
+ Boolean childMade;
+
+ int unmade; /* The number of unmade children */
+ int mtime; /* Its modification time */
+ int cmtime; /* Modification time of its youngest child */
+
+ /*
+ * Links to parents for which this is an implied source, if any. (nodes
+ * that depend on this, as gleaned from the transformation rules.
+ */
+ Lst iParents;
+
+ /* List of nodes of the same name created by the :: operator */
+ Lst cohorts;
+
+ /* Lst of nodes for which this is a source (that depend on this one) */
+ Lst parents;
+
+ /* List of nodes on which this depends */
+ Lst children;
+
+ /*
+ * List of nodes that must be made (if they're made) after this node is,
+ * but that do not depend on this node, in the normal sense.
+ */
+ Lst successors;
+
+ /*
+ * List of nodes that must be made (if they're made) before this node
+ * can be, but that do no enter into the datedness of this node.
+ */
+ Lst preds;
+
+ /*
+ * List of ``local'' variables that are specific to this target
+ * and this target only (qv. var.c [$@ $< $?, etc.])
+ */
+ Lst context;
+
+ /*
+ * List of strings that are commands to be given to a shell
+ * to create this target.
+ */
+ Lst commands;
+
+ /* current command executing in compat mode */
+ LstNode *compat_command;
+
+ /*
+ * Suffix for the node (determined by Suff_FindDeps and opaque to
+ * everyone but the Suff module)
+ */
+ struct _Suff *suffix;
+} GNode;
+
+#endif /* GNode_h_39503bf2 */
diff --git a/usr.bin/make/arch.c b/usr.bin/make/arch.c
index 17def65..b88152d 100644
--- a/usr.bin/make/arch.c
+++ b/usr.bin/make/arch.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -87,19 +87,26 @@ __FBSDID("$FreeBSD$");
* Arch_Init Initialize this module.
*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/param.h>
-#include <ctype.h>
-#include <ar.h>
-#include <utime.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
-#include "config.h"
+#include <sys/param.h>
+#include <sys/types.h>
+#include <ar.h>
+#include <ctype.h>
+#include <regex.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <utime.h>
+
+#include "arch.h"
+#include "config.h"
+#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
+#include "hash.h"
+#include "make.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/* Lst of archives we've already examined */
static Lst archives = Lst_Initializer(archives);
@@ -142,7 +149,7 @@ ReturnStatus
Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
{
char *cp; /* Pointer into line */
- GNode *gn; /* New node */
+ GNode *gn; /* New node */
char *libName; /* Library-part of specification */
char *memName; /* Member-part of specification */
char *nameBuf; /* temporary place for node name */
@@ -983,7 +990,7 @@ int
Arch_MemMTime(GNode *gn)
{
LstNode *ln;
- GNode *pgn;
+ GNode *pgn;
char *nameStart,
*nameEnd;
diff --git a/usr.bin/make/arch.h b/usr.bin/make/arch.h
new file mode 100644
index 0000000..3b95563
--- /dev/null
+++ b/usr.bin/make/arch.h
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef arch_h_488adf7a
+#define arch_h_488adf7a
+
+#include "sprite.h"
+
+struct GNode;
+struct Lst;
+
+ReturnStatus Arch_ParseArchive(char **, struct Lst *, struct GNode *);
+void Arch_Touch(struct GNode *);
+void Arch_TouchLib(struct GNode *);
+int Arch_MTime(struct GNode *);
+int Arch_MemMTime(struct GNode *);
+void Arch_FindLib(struct GNode *, struct Lst *);
+Boolean Arch_LibOODate(struct GNode *);
+void Arch_Init(void);
+
+#endif /* arch_h_488adf7a */
diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c
index 81e774a..29ae06b 100644
--- a/usr.bin/make/buf.c
+++ b/usr.bin/make/buf.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -47,9 +47,12 @@ __FBSDID("$FreeBSD$");
* Functions for automatically-expanded buffers.
*/
-#include "sprite.h"
-#include "make.h"
+#include <string.h>
+#include <stdlib.h>
+
#include "buf.h"
+#include "sprite.h"
+#include "util.h"
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
diff --git a/usr.bin/make/buf.h b/usr.bin/make/buf.h
index 3b7e1c3..b35e9b9 100644
--- a/usr.bin/make/buf.h
+++ b/usr.bin/make/buf.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -40,16 +40,31 @@
* $FreeBSD$
*/
+#ifndef buf_h_a61a6812
+#define buf_h_a61a6812
+
/*-
* buf.h --
* Header for users of the buf library.
*/
-#ifndef _BUF_H
-#define _BUF_H
+#include <sys/types.h>
#include "sprite.h"
+/*
+ * There are several places where expandable buffers are used (parse.c and
+ * var.c). This constant is merely the starting point for those buffers. If
+ * lines tend to be much shorter than this, it would be best to reduce BSIZE.
+ * If longer, it should be increased. Reducing it will cause more copying to
+ * be done for longer lines, but will save space for shorter ones. In any
+ * case, it ought to be a power of two simply because most storage allocation
+ * schemes allocate in powers of two.
+ */
+#define MAKE_BSIZE 256 /* starting size for expandable buffers */
+
+#define BUF_ERROR 256
+
typedef char Byte;
typedef struct Buffer {
@@ -65,8 +80,6 @@ typedef struct Buffer {
(void)(--(bp)->left <= 0 ? Buf_OvAddByte((bp), (byte)), 1 : \
(*(bp)->inPtr++ = (byte), *(bp)->inPtr = 0), 1)
-#define BUF_ERROR 256
-
void Buf_OvAddByte(Buffer, Byte);
void Buf_AddBytes(Buffer, size_t, const Byte *);
void Buf_UngetByte(Buffer, Byte);
@@ -80,4 +93,4 @@ Buffer Buf_Init(size_t);
void Buf_Destroy(Buffer, Boolean);
void Buf_ReplaceLastByte(Buffer, Byte);
-#endif /* _BUF_H */
+#endif /* buf_h_a61a6812 */
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index 646a2b0..d045da8 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -55,18 +55,27 @@ __FBSDID("$FreeBSD$");
* thems as need creatin'
*/
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <ctype.h>
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
-#include "job.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <ctype.h>
+#include <errno.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "compat.h"
+#include "config.h"
+#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
+#include "job.h"
+#include "make.h"
+#include "str.h"
+#include "suff.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/*
* The following array is used to make a fast determination of which
@@ -586,7 +595,7 @@ CompatMake(void *gnp, void *pgnp)
* To force things that depend on FRC to be made, so we have to
* check for gn->children being empty as well...
*/
- if (!Lst_IsEmpty(&gn->commands) || Lst_IsEmpty(gn->children)) {
+ if (!Lst_IsEmpty(&gn->commands) || Lst_IsEmpty(&gn->children)) {
gn->mtime = now;
}
#else
diff --git a/usr.bin/make/compat.h b/usr.bin/make/compat.h
new file mode 100644
index 0000000..0c91789
--- /dev/null
+++ b/usr.bin/make/compat.h
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef compat_h_29e49e8c
+#define compat_h_29e49e8c
+
+struct Lst;
+
+void Compat_Run(struct Lst *);
+int Compat_RunCommand(void *, void *);
+
+#endif /* compat_h_29e49e8c */
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index ad70a3e..a0f3dc1 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -51,12 +51,21 @@ __FBSDID("$FreeBSD$");
*
*/
-#include <ctype.h>
-#include <math.h>
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
-#include "buf.h"
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "cond.h"
+#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
+#include "make.h"
+#include "parse.h"
+#include "sprite.h"
+#include "str.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/*
* The parsing of conditional expressions is based on this grammar:
diff --git a/usr.bin/make/cond.h b/usr.bin/make/cond.h
new file mode 100644
index 0000000..1bae63a
--- /dev/null
+++ b/usr.bin/make/cond.h
@@ -0,0 +1,54 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef cond_h_6e96ad7c
+#define cond_h_6e96ad7c
+
+/*
+ * Values returned by Cond_Eval.
+ */
+#define COND_PARSE 0 /* Parse the next lines */
+#define COND_SKIP 1 /* Skip the next lines */
+#define COND_INVALID 2 /* Not a conditional statement */
+
+int Cond_Eval(char *);
+void Cond_End(void);
+
+#endif /* cond_h_6e96ad7c */
diff --git a/usr.bin/make/config.h b/usr.bin/make/config.h
index a40e445..06b0f8e 100644
--- a/usr.bin/make/config.h
+++ b/usr.bin/make/config.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -40,6 +40,9 @@
* $FreeBSD$
*/
+#ifndef config_h_efe0765e
+#define config_h_efe0765e
+
/*
* DEFMAXJOBS
* This control the default concurrency. On no occasion will more
@@ -104,3 +107,5 @@
# define RANLIBMAG "/"
# endif
#endif
+
+#endif /* config_h_efe0765e */
diff --git a/usr.bin/make/dir.c b/usr.bin/make/dir.c
index 6734b67..f8c0a75 100644
--- a/usr.bin/make/dir.c
+++ b/usr.bin/make/dir.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -83,14 +83,25 @@ __FBSDID("$FreeBSD$");
* Dir_PrintDirectories Print stats about the directory cache.
*/
-#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <err.h>
-#include "make.h"
-#include "hash.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "arch.h"
#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
+#include "hash.h"
+#include "lst.h"
+#include "make.h"
+#include "str.h"
+#include "targ.h"
+#include "util.h"
/*
* A search path consists of a Lst of Path structures. A Path structure
diff --git a/usr.bin/make/dir.h b/usr.bin/make/dir.h
index 4287f21..6ee3f2d 100644
--- a/usr.bin/make/dir.h
+++ b/usr.bin/make/dir.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -40,11 +40,13 @@
* $FreeBSD$
*/
-/* dir.h --
- */
+#ifndef dir_h_6002e3b8
+#define dir_h_6002e3b8
+
+#include "hash.h"
-#ifndef _DIR
-#define _DIR
+struct GNode;
+struct Lst;
typedef struct Path {
char *name; /* Name of directory */
@@ -57,16 +59,16 @@ typedef struct Path {
void Dir_Init(void);
void Dir_InitDot(void);
Boolean Dir_HasWildcards(const char *);
-void Dir_Expand(char *, Lst *, Lst *);
-char *Dir_FindFile(char *, Lst *);
-int Dir_MTime(GNode *);
-void Dir_AddDir(Lst *, char *);
-char *Dir_MakeFlags(char *, Lst *);
-void Dir_ClearPath(Lst *);
-void Dir_Concat(Lst *, Lst *);
+void Dir_Expand(char *, struct Lst *, struct Lst *);
+char *Dir_FindFile(char *, struct Lst *);
+int Dir_MTime(struct GNode *);
+void Dir_AddDir(struct Lst *, char *);
+char *Dir_MakeFlags(char *, struct Lst *);
+void Dir_ClearPath(struct Lst *);
+void Dir_Concat(struct Lst *, struct Lst *);
void Dir_PrintDirectories(void);
-void Dir_PrintPath(Lst *);
+void Dir_PrintPath(struct Lst *);
void Dir_Destroy(void *);
void *Dir_CopyDir(void *);
-#endif /* _DIR */
+#endif /* dir_h_6002e3b8 */
diff --git a/usr.bin/make/for.c b/usr.bin/make/for.c
index a083630..43dca73 100644
--- a/usr.bin/make/for.c
+++ b/usr.bin/make/for.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -49,11 +45,19 @@ __FBSDID("$FreeBSD$");
*
*/
-#include <ctype.h>
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
-#include "buf.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "buf.h"
+#include "dir.h"
+#include "for.h"
+#include "globals.h"
+#include "lst.h"
+#include "make.h"
+#include "parse.h"
+#include "util.h"
+#include "var.h"
/*
* For statements are of the form:
diff --git a/usr.bin/make/for.h b/usr.bin/make/for.h
new file mode 100644
index 0000000..c6404b2
--- /dev/null
+++ b/usr.bin/make/for.h
@@ -0,0 +1,47 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef for_h_9d770f33
+#define for_h_9d770f33
+
+int For_Eval(char *);
+void For_Run(int);
+
+#endif /* for_h_9d770f33 */
diff --git a/usr.bin/make/globals.h b/usr.bin/make/globals.h
new file mode 100644
index 0000000..c9b3877
--- /dev/null
+++ b/usr.bin/make/globals.h
@@ -0,0 +1,124 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef globals_h_1c1edb96
+#define globals_h_1c1edb96
+
+/*
+ * Global Variables
+ */
+
+#include <time.h>
+
+#include "lst.h"
+#include "sprite.h"
+
+struct GNode;
+struct IFile;
+
+/*
+ * The list of target names specified on the command line.
+ * Used to resolve #if make(...) statements
+ */
+extern Lst create;
+
+/* The list of directories to search when looking for targets */
+extern Lst dirSearchPath;
+
+extern struct IFile curFile; /* current makefile */
+
+/* The list of directories to search when looking for includes */
+extern Lst parseIncPath;
+
+extern Boolean jobsRunning; /* True if jobs are running */
+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 beVerbose; /* True if should print extra cruft */
+extern Boolean noExecute; /* True if should execute nothing */
+extern Boolean allPrecious; /* True if every target is precious */
+
+/* True if should continue on unaffected portions of the graph
+ * when have an error in one portion */
+extern Boolean keepgoing;
+
+/* TRUE if targets should just be 'touched'if out of date. Set by the -t flag */
+extern Boolean touchFlag;
+
+/* TRUE if should capture the output of subshells by means of pipes.
+ * Otherwise it is routed to temporary files from which it is retrieved
+ * when the shell exits */
+extern Boolean usePipes;
+
+/* TRUE if we aren't supposed to really make anything, just see if the
+ * targets are out-of-date */
+extern Boolean queryFlag;
+
+/* TRUE if environment should be searched for all variables before
+ * the global context */
+extern Boolean checkEnvFirst;
+
+/* List of specific variables for which the environment should be
+ * searched before the global context */
+extern Lst envFirstVars;
+
+extern struct GNode *DEFAULT; /* .DEFAULT rule */
+
+/* Variables defined in a global context, e.g in the Makefile itself */
+extern struct GNode *VAR_GLOBAL;
+
+/* Variables defined on the command line */
+extern struct GNode *VAR_CMD;
+
+/* 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 char var_Error[];
+
+/* The time at the start of this whole process */
+extern time_t now;
+
+extern Boolean oldVars; /* Do old-style variable substitution */
+
+/* The system include path. */
+extern Lst sysIncPath;
+
+extern int debug;
+
+#endif /* globals_h_1c1edb96 */
diff --git a/usr.bin/make/hash.c b/usr.bin/make/hash.c
index 5a54668..503d328 100644
--- a/usr.bin/make/hash.c
+++ b/usr.bin/make/hash.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -49,10 +49,14 @@ __FBSDID("$FreeBSD$");
* table. Hash tables grow automatically as the amount of
* information increases.
*/
+
+#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
-#include "sprite.h"
-#include "make.h"
+
#include "hash.h"
+#include "sprite.h"
+#include "util.h"
/*
* Forward references to local procedures that are used before they're
diff --git a/usr.bin/make/hash.h b/usr.bin/make/hash.h
index 19d02ce..d537b2a 100644
--- a/usr.bin/make/hash.h
+++ b/usr.bin/make/hash.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -40,14 +40,16 @@
* $FreeBSD$
*/
+#ifndef hash_h_f6312f46
+#define hash_h_f6312f46
+
/* hash.h --
*
* This file contains definitions used by the hash module,
* which maintains hash tables.
*/
-#ifndef _HASH
-#define _HASH
+#include "sprite.h"
/*
* The following defines one entry in the hash table.
@@ -98,4 +100,4 @@ void Hash_DeleteEntry(Hash_Table *, Hash_Entry *);
Hash_Entry *Hash_EnumFirst(const Hash_Table *, Hash_Search *);
Hash_Entry *Hash_EnumNext(Hash_Search *);
-#endif /* _HASH */
+#endif /* hash_h_f6312f46 */
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 22d1cc2..6231bef 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -103,26 +103,34 @@ __FBSDID("$FreeBSD$");
*/
#include <sys/types.h>
+#include <sys/select.h>
#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/time.h>
#ifdef USE_KQUEUE
#include <sys/event.h>
#endif
#include <sys/wait.h>
-#include <err.h>
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <stdio.h>
#include <string.h>
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
#include <utime.h>
-#include "make.h"
-#include "hash.h"
+
+#include "arch.h"
+#include "compat.h"
#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
#include "job.h"
+#include "make.h"
+#include "parse.h"
#include "pathnames.h"
+#include "str.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
#define STATIC static
diff --git a/usr.bin/make/job.h b/usr.bin/make/job.h
index 33c9923..8506b7d 100644
--- a/usr.bin/make/job.h
+++ b/usr.bin/make/job.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -40,13 +40,20 @@
* $FreeBSD$
*/
+#ifndef job_h_4678dfd1
+#define job_h_4678dfd1
+
/*-
* job.h --
* Definitions pertaining to the running of jobs in parallel mode.
- * Exported from job.c for the use of remote-execution modules.
*/
-#ifndef _JOB_H_
-#define _JOB_H_
+
+#include <stdio.h>
+
+#include "sprite.h"
+
+struct GNode;
+struct LstNode;
#define TMPPAT "/tmp/makeXXXXXXXXXX"
@@ -60,28 +67,9 @@
#define SEL_USEC 0
#endif /* !USE_KQUEUE */
-/*-
+/*
* Job Table definitions.
*
- * Each job has several things associated with it:
- * 1) The process id of the child shell
- * 2) The graph node describing the target being made by this job
- * 3) A LstNode for the first command to be saved after the job
- * completes. This is NULL if there was no "..." in the job's
- * commands.
- * 4) An FILE* for writing out the commands. This is only
- * used before the job is actually started.
- * 5) A union of things used for handling the shell's output. Different
- * parts of the union are used based on the value of the usePipes
- * flag. If it is true, the output is being caught via a pipe and
- * the descriptors of our pipe, an array in which output is line
- * buffered and the current position in that buffer are all
- * maintained for each job. If, on the other hand, usePipes is false,
- * the output is routed to a temporary file and all that is kept
- * is the name of the file and the descriptor open to the file.
- * 6) A word of flags which determine how the module handles errors,
- * echoing, etc. for the job
- *
* The job "table" is kept as a linked Lst in 'jobs', with the number of
* active jobs maintained in the 'nJobs' variable. At no time will this
* exceed the value of 'maxJobs', initialized by the Job_Init function.
@@ -92,15 +80,30 @@
*/
#define JOB_BUFSIZE 1024
typedef struct Job {
- int pid; /* The child's process ID */
- char tfile[sizeof(TMPPAT)];
- /* Temporary file to use for job */
- GNode *node; /* The target the child is making */
- LstNode *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 */
- short flags; /* Flags to control treatment of job */
+ int pid; /* The child's process ID */
+
+ /* Temporary file to use for job */
+ char tfile[sizeof(TMPPAT)];
+
+ struct GNode *node; /* The target the child is making */
+
+ /*
+ * A LstNode for the first command to be saved after the job completes.
+ * This is NULL if there was no "..." in the job's commands.
+ */
+ LstNode *tailCmds;
+
+ /*
+ * An FILE* for writing out the commands. This is only
+ * used before the job is actually started.
+ */
+ FILE *cmdFILE;
+
+ /*
+ * A word of flags which determine how the module handles errors,
+ * echoing, etc. for the job
+ */
+ 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
@@ -114,30 +117,57 @@ typedef struct Job {
#define JOB_CONTINUING 0x200 /* We are in the process of resuming this job.
* Used to avoid infinite recursion between
* JobFinish and JobRestart */
- union {
- struct {
- int op_inPipe; /* Input side of pipe associated
- * with job's output channel */
- int op_outPipe; /* Output side of pipe associated with
- * job's output channel */
- char op_outBuf[JOB_BUFSIZE + 1];
- /* Buffer for storing the output of the
- * job, line by line */
- int op_curPos; /* Current position in op_outBuf */
- } o_pipe; /* data used when catching the output via
- * a pipe */
- struct {
- char of_outFile[sizeof(TMPPAT)];
- /* Name of file to which shell output
- * was rerouted */
- int of_outFd; /* Stream open to the output
- * file. Used to funnel all
- * from a single job to one file
- * while still allowing
- * multiple shell invocations */
- } o_file; /* Data used when catching the output in
- * a temporary file */
- } output; /* Data for tracking a shell's output */
+
+ /* union for handling shell's output */
+ union {
+ /*
+ * This part is used when usePipes is true.
+ * The output is being caught via a pipe and the descriptors
+ * of our pipe, an array in which output is line buffered and
+ * the current position in that buffer are all maintained for
+ * each job.
+ */
+ struct {
+ /*
+ * Input side of pipe associated with
+ * job's output channel
+ */
+ int op_inPipe;
+
+ /*
+ * Output side of pipe associated with job's
+ * output channel
+ */
+ int op_outPipe;
+
+ /*
+ * Buffer for storing the output of the
+ * job, line by line
+ */
+ char op_outBuf[JOB_BUFSIZE + 1];
+
+ /* Current position in op_outBuf */
+ int op_curPos;
+ } o_pipe;
+
+ /*
+ * If usePipes is false the output is routed to a temporary
+ * file and all that is kept is the name of the file and the
+ * descriptor open to the file.
+ */
+ struct {
+ /* Name of file to which shell output was rerouted */
+ char of_outFile[sizeof(TMPPAT)];
+
+ /*
+ * Stream open to the output file. Used to funnel all
+ * from a single job to one file while still allowing
+ * multiple shell invocations
+ */
+ int of_outFd;
+ } o_file;
+
+ } output; /* Data for tracking a shell's output */
} Job;
#define outPipe output.o_pipe.op_outPipe
@@ -149,22 +179,6 @@ typedef struct Job {
/*-
* Shell Specifications:
- * Each shell type has associated with it the following information:
- * 1) The string which must match the last character of the shell name
- * for the shell to be considered of this type. The longest match
- * wins.
- * 2) A command to issue to turn off echoing of command lines
- * 3) A command to issue to turn echoing back on again
- * 4) What the shell prints, and its length, when given the echo-off
- * command. This line will not be printed when received from the shell
- * 5) A boolean to tell if the shell has the ability to control
- * error checking for individual commands.
- * 6) The string to turn this checking on.
- * 7) The string to turn it off.
- * 8) The command-flag to give to cause the shell to start echoing
- * commands right away.
- * 9) The command-flag to cause the shell to Lib_Exit when an error is
- * detected in one of the commands.
*
* Some special stuff goes on if a shell doesn't have error control. In such
* a case, errCheck becomes a printf template for echoing the command,
@@ -173,30 +187,42 @@ typedef struct Job {
* strings is empty when hasErrCtl is FALSE, the command will be executed
* anyway as is and if it causes an error, so be it.
*/
-#define DEF_SHELL_STRUCT(TAG, CONST) \
-struct TAG { \
- 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 \
- * shell. This is usually the command which \
- * was executed to turn off echoing */ \
- int 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 */ \
- /* \
- * command-line flags \
- */ \
- CONST char *echo; /* echo commands */ \
- CONST char *exit; /* exit on error */ \
+#define DEF_SHELL_STRUCT(TAG, CONST) \
+struct TAG { \
+ /* \
+ * 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. \
+ */ \
+ CONST char *name; \
+ \
+ /* True if both echoOff and echoOn defined */ \
+ Boolean hasEchoCtl; \
+ \
+ CONST char *echoOff; /* command to turn off echo */ \
+ CONST char *echoOn; /* command to turn it back on */\
+ \
+ /* \
+ * What the shell prints, and its length, when given the \
+ * echo-off command. This line will not be printed when \
+ * received from the shell. This is usually the command which \
+ * was executed to turn off echoing \
+ */ \
+ CONST char *noPrint; \
+ int noPLen; /* length of noPrint command */ \
+ \
+ /* set if can control error checking for individual commands */ \
+ Boolean hasErrCtl; \
+ \
+ /* string to turn error checking on */ \
+ CONST char *errCheck; \
+ \
+ /* string to turn off error checking */ \
+ CONST char *ignErr; \
+ \
+ CONST char *echo; /* command line flag: echo commands */ \
+ CONST char *exit; /* command line flag: exit on error */ \
}
typedef DEF_SHELL_STRUCT(Shell,) Shell;
@@ -205,13 +231,12 @@ extern char *shellPath;
extern char *shellName;
extern int maxJobs; /* Number of jobs that may run */
-
void Shell_Init(void);
-void Job_Touch(GNode *, Boolean);
-Boolean Job_CheckCommands(GNode *, void (*abortProc)(const char *, ...));
+void Job_Touch(struct GNode *, Boolean);
+Boolean Job_CheckCommands(struct GNode *, void (*abortProc)(const char *, ...));
void Job_CatchChildren(Boolean);
void Job_CatchOutput(int flag);
-void Job_Make(GNode *);
+void Job_Make(struct GNode *);
void Job_Init(int);
Boolean Job_Full(void);
Boolean Job_Empty(void);
@@ -220,4 +245,4 @@ int Job_Finish(void);
void Job_Wait(void);
void Job_AbortAll(void);
-#endif /* _JOB_H_ */
+#endif /* job_h_4678dfd1 */
diff --git a/usr.bin/make/lst.h b/usr.bin/make/lst.h
index 4aa55c0..2aa0676 100644
--- a/usr.bin/make/lst.h
+++ b/usr.bin/make/lst.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988, 1989 by Adam de Boor
@@ -40,16 +40,15 @@
* $FreeBSD$
*/
+#ifndef lst_h_38f3ead1
+#define lst_h_38f3ead1
+
/*-
* lst.h --
* Header for using the list library
*/
-#ifndef _LST_H_
-#define _LST_H_
-#include <sys/param.h>
-#include <stdlib.h>
-#include "sprite.h"
+#include "sprite.h"
/*
* Structure of a list node.
@@ -198,5 +197,4 @@ void *Lst_DeQueue(Lst *);
*/
#define Lst_IsEmpty(L) (!Lst_Valid(L) || (L)->firstPtr == NULL)
-
-#endif /* _LST_H_ */
+#endif /* lst_h_38f3ead1 */
diff --git a/usr.bin/make/lst.lib/lstAppend.c b/usr.bin/make/lst.lib/lstAppend.c
index 297926c..ec372e7 100644
--- a/usr.bin/make/lst.lib/lstAppend.c
+++ b/usr.bin/make/lst.lib/lstAppend.c
@@ -46,8 +46,11 @@ __FBSDID("$FreeBSD$");
* Add a new node with a new datum after an existing node
*/
-#include "make.h"
+#include <stdio.h>
+
#include "lst.h"
+#include "make.h"
+#include "util.h"
/*-
*-----------------------------------------------------------------------
diff --git a/usr.bin/make/lst.lib/lstConcat.c b/usr.bin/make/lst.lib/lstConcat.c
index e6bf54a..c42f560 100644
--- a/usr.bin/make/lst.lib/lstConcat.c
+++ b/usr.bin/make/lst.lib/lstConcat.c
@@ -46,7 +46,10 @@ __FBSDID("$FreeBSD$");
* Function to concatentate two lists.
*/
+#include <stdio.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
/*-
diff --git a/usr.bin/make/lst.lib/lstDeQueue.c b/usr.bin/make/lst.lib/lstDeQueue.c
index 961411c..de0b197 100644
--- a/usr.bin/make/lst.lib/lstDeQueue.c
+++ b/usr.bin/make/lst.lib/lstDeQueue.c
@@ -46,8 +46,11 @@ __FBSDID("$FreeBSD$");
* Remove the node and return its datum from the head of the list
*/
+#include <stdio.h>
+
#include "make.h"
#include "lst.h"
+#include "util.h"
/*-
*-----------------------------------------------------------------------
diff --git a/usr.bin/make/lst.lib/lstDestroy.c b/usr.bin/make/lst.lib/lstDestroy.c
index 39d5239..834e269 100644
--- a/usr.bin/make/lst.lib/lstDestroy.c
+++ b/usr.bin/make/lst.lib/lstDestroy.c
@@ -46,7 +46,10 @@ __FBSDID("$FreeBSD$");
* Nuke a list and all its resources
*/
+#include <stdlib.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
/*-
diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c
index 807cc19..8fe565d 100644
--- a/usr.bin/make/lst.lib/lstDupl.c
+++ b/usr.bin/make/lst.lib/lstDupl.c
@@ -47,7 +47,10 @@ __FBSDID("$FreeBSD$");
* elements.
*/
+#include <stdio.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
/*-
diff --git a/usr.bin/make/lst.lib/lstFindFrom.c b/usr.bin/make/lst.lib/lstFindFrom.c
index ecdbc3e..72cd5fe 100644
--- a/usr.bin/make/lst.lib/lstFindFrom.c
+++ b/usr.bin/make/lst.lib/lstFindFrom.c
@@ -46,7 +46,10 @@ __FBSDID("$FreeBSD$");
* Find a node on a list from a given starting point. Used by Lst_Find.
*/
+#include <stdio.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
/*-
diff --git a/usr.bin/make/lst.lib/lstForEachFrom.c b/usr.bin/make/lst.lib/lstForEachFrom.c
index b129ea8..a741911 100644
--- a/usr.bin/make/lst.lib/lstForEachFrom.c
+++ b/usr.bin/make/lst.lib/lstForEachFrom.c
@@ -47,7 +47,11 @@ __FBSDID("$FreeBSD$");
* a given point.
*/
+#include <stdio.h>
+#include <stdlib.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
/*-
diff --git a/usr.bin/make/lst.lib/lstInsert.c b/usr.bin/make/lst.lib/lstInsert.c
index 5bb7a0d..19d72f1 100644
--- a/usr.bin/make/lst.lib/lstInsert.c
+++ b/usr.bin/make/lst.lib/lstInsert.c
@@ -46,7 +46,10 @@ __FBSDID("$FreeBSD$");
* Insert a new datum before an old one
*/
+#include <stdio.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
/*-
diff --git a/usr.bin/make/lst.lib/lstMember.c b/usr.bin/make/lst.lib/lstMember.c
index 8084e16..a08c10e 100644
--- a/usr.bin/make/lst.lib/lstMember.c
+++ b/usr.bin/make/lst.lib/lstMember.c
@@ -46,7 +46,10 @@ __FBSDID("$FreeBSD$");
* See if a given datum is on a given list.
*/
+#include <stdio.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
LstNode *
diff --git a/usr.bin/make/lst.lib/lstRemove.c b/usr.bin/make/lst.lib/lstRemove.c
index aa0fd99..ed92df8 100644
--- a/usr.bin/make/lst.lib/lstRemove.c
+++ b/usr.bin/make/lst.lib/lstRemove.c
@@ -46,7 +46,11 @@ __FBSDID("$FreeBSD$");
* Remove an element from a list
*/
+#include <stdio.h>
+#include <stdlib.h>
+
#include "make.h"
+#include "util.h"
#include "lst.h"
/*-
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index e29df4a..d665496 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -60,32 +60,37 @@ __FBSDID("$FreeBSD$");
* the .MFLAGS target.
*/
+#ifndef MACHINE
+#include <sys/utsname.h>
+#endif
#include <sys/param.h>
-#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/resource.h>
-#ifndef MACHINE
-#include <sys/utsname.h>
-#endif
#include <sys/wait.h>
-
#include <err.h>
#include <errno.h>
-#include <fcntl.h>
#include <signal.h>
-#include <stdarg.h>
-#include <stdio.h>
#include <stdlib.h>
-#include <sysexits.h>
+#include <string.h>
#include <unistd.h>
-#include "make.h"
-#include "hash.h"
+#include "arch.h"
+#include "compat.h"
+#include "config.h"
#include "dir.h"
+#include "globals.h"
#include "job.h"
+#include "make.h"
+#include "nonints.h"
+#include "parse.h"
#include "pathnames.h"
+#include "str.h"
+#include "suff.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
#define WANT_ENV_MKLVL 1
#define MKLVL_MAXVAL 500
@@ -97,7 +102,7 @@ __FBSDID("$FreeBSD$");
Lst create = Lst_Initializer(create);
time_t now; /* Time at start of make */
-GNode *DEFAULT; /* .DEFAULT node */
+struct GNode *DEFAULT; /* .DEFAULT node */
Boolean allPrecious; /* .PRECIOUS given on line by itself */
static Boolean noBuiltins; /* -r flag */
@@ -1141,3 +1146,8 @@ usage(void)
" [-m directory] [-V variable] [variable=value] [target ...]");
exit(2);
}
+
+void foo(void);
+void foo(void)
+{
+}
diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c
index fb4040d..1f11840 100644
--- a/usr.bin/make/make.c
+++ b/usr.bin/make/make.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -73,10 +73,19 @@ __FBSDID("$FreeBSD$");
* and perform the .USE actions if so.
*/
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
-#include "job.h"
+#include <stdlib.h>
+
+#include "arch.h"
+#include "config.h"
+#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
+#include "job.h"
+#include "make.h"
+#include "suff.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/* The current fringe of the graph. These are nodes which await examination
* by MakeOODate. It is added to by Make_Update and subtracted from by
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h
index 19438a3..9395e09 100644
--- a/usr.bin/make/make.h
+++ b/usr.bin/make/make.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -39,125 +39,18 @@
* $FreeBSD$
*/
+#ifndef make_h_a91074b9
+#define make_h_a91074b9
+
/*-
* make.h --
* The global definitions for pmake
*/
-#ifndef _MAKE_H_
-#define _MAKE_H_
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <stdlib.h>
-#include <unistd.h>
#include "sprite.h"
-#include "lst.h"
-#include "config.h"
-#include "buf.h"
-
-/*-
- * The structure for an individual graph node. Each node has several
- * pieces of data associated with it.
- * 1) the name of the target it describes
- * 2) the location of the target file in the filesystem.
- * 3) the type of operator used to define its sources (qv. parse.c)
- * 4) whether it is involved in this invocation of make
- * 5) whether the target has been remade
- * 6) whether any of its children has been remade
- * 7) the number of its children that are, as yet, unmade
- * 8) its modification time
- * 9) the modification time of its youngest child (qv. make.c)
- * 10) a list of nodes for which this is a source
- * 11) a list of nodes on which this depends
- * 12) a list of nodes that depend on this, as gleaned from the
- * transformation rules.
- * 13) a list of nodes of the same name created by the :: operator
- * 14) a list of nodes that must be made (if they're made) before
- * this node can be, but that do no enter into the datedness of
- * this node.
- * 15) a list of nodes that must be made (if they're made) after
- * this node is, but that do not depend on this node, in the
- * normal sense.
- * 16) a Lst of ``local'' variables that are specific to this target
- * and this target only (qv. var.c [$@ $< $?, etc.])
- * 17) a Lst of strings that are commands to be given to a shell
- * to create this target.
- */
-typedef struct GNode {
- char *name; /* The target's name */
- char *path; /* The full pathname of the file */
- int type; /* Its type (see the OP flags, below) */
- int order; /* Its wait weight */
-
- Boolean make; /* TRUE if this target needs to be remade */
- enum {
- UNMADE, BEINGMADE, MADE, UPTODATE, ERROR, ABORTED,
- CYCLE, ENDCYCLE
- } made; /* Set to reflect the state of processing
- * on this node:
- * UNMADE - Not examined yet
- * BEINGMADE - Target is already being made.
- * Indicates a cycle in the graph. (compat
- * mode only)
- * MADE - Was out-of-date and has been made
- * UPTODATE - Was already up-to-date
- * ERROR - An error occured while it was being
- * made (used only in compat mode)
- * ABORTED - The target was aborted due to
- * an error making an inferior (compat).
- * CYCLE - Marked as potentially being part of
- * a graph cycle. If we come back to a
- * node marked this way, it is printed
- * and 'made' is changed to ENDCYCLE.
- * ENDCYCLE - the cycle has been completely
- * printed. Go back and unmark all its
- * members.
- */
- Boolean childMade; /* TRUE if one of this target's children was
- * made */
- int unmade; /* The number of unmade children */
-
- int mtime; /* Its modification time */
- int cmtime; /* The modification time of its youngest
- * child */
-
- Lst iParents; /* Links to parents for which this is an
- * implied source, if any */
- Lst cohorts; /* Other nodes for the :: operator */
- Lst parents; /* Nodes that depend on this one */
- Lst children; /* Nodes on which this one depends */
- Lst successors; /* Nodes that must be made after this one */
- Lst preds; /* Nodes that must be made before this one */
-
- Lst context; /* The local variables */
- Lst commands; /* Creation commands */
-
- /* current command executing in compat mode */
- LstNode *compat_command;
- struct _Suff *suffix; /* Suffix for the node (determined by
- * Suff_FindDeps and opaque to everyone
- * but the Suff module) */
-} GNode;
-
-
-/*
- * Definitions for handling #include specifications
- */
-typedef struct {
- char *str;
- char *ptr;
-} PTR;
-typedef struct IFile {
- char *fname; /* name of previous file */
- int lineno; /* saved line number */
- FILE *F; /* the open stream */
- PTR *p; /* the char pointer */
-} IFile;
+struct GNode;
+struct Lst;
/*
* The OP_ constants are used when parsing a dependency line as a way of
@@ -216,38 +109,6 @@ typedef struct IFile {
#define OP_NOP(t) (((t) & OP_OPMASK) == 0x00000000)
/*
- * The TARG_ constants are used when calling the Targ_FindNode and
- * Targ_FindList functions in targ.c. They simply tell the functions what to
- * do if the desired node(s) is (are) not found. If the TARG_CREATE constant
- * is given, a new, empty node will be created for the target, placed in the
- * table of all targets and its address returned. If TARG_NOCREATE is given,
- * a NULL pointer will be returned.
- */
-#define TARG_CREATE 0x01 /* create node if not found */
-#define TARG_NOCREATE 0x00 /* don't create it */
-
-/*
- * There are several places where expandable buffers are used (parse.c and
- * var.c). This constant is merely the starting point for those buffers. If
- * lines tend to be much shorter than this, it would be best to reduce BSIZE.
- * If longer, it should be increased. Reducing it will cause more copying to
- * be done for longer lines, but will save space for shorter ones. In any
- * case, it ought to be a power of two simply because most storage allocation
- * schemes allocate in powers of two.
- */
-#define MAKE_BSIZE 256 /* starting size for expandable buffers */
-
-/*
- * These constants are all used by the Str_Concat function to decide how the
- * final string should look. If STR_ADDSPACE is given, a space will be
- * placed between the two strings. If STR_ADDSLASH is given, a '/' will
- * be used instead of a space. If neither is given, no intervening characters
- * will be placed between the two strings in the final output.
- */
-#define STR_ADDSPACE 0x01 /* add a space when Str_Concat'ing */
-#define STR_ADDSLASH 0x04 /* add a slash when Str_Concat'ing */
-
-/*
* Error levels for parsing. PARSE_FATAL means the process cannot continue
* once the makefile has been parsed. PARSE_WARNING means it can. Passed
* as the first argument to Parse_Error.
@@ -256,13 +117,6 @@ typedef struct IFile {
#define PARSE_FATAL 1
/*
- * Values returned by Cond_Eval.
- */
-#define COND_PARSE 0 /* Parse the next lines */
-#define COND_SKIP 1 /* Skip the next lines */
-#define COND_INVALID 2 /* Not a conditional statement */
-
-/*
* Definitions for the "local" variables. Used only for clarity.
*/
#define TARGET "@" /* Target of dependency */
@@ -280,108 +134,11 @@ typedef struct IFile {
#define FPREFIX "*F" /* file part of PREFIX */
#define DPREFIX "*D" /* directory part of PREFIX */
-/*
- * Global Variables
- */
-/* The list of target names specified on the command line.
- * Used to resolve #if make(...) statements */
-extern Lst create;
-
-/* The list of directories to search when looking for targets */
-extern Lst dirSearchPath;
-
-extern IFile curFile; /* current makefile */
-
-/* The list of directories to search when looking for includes */
-extern Lst parseIncPath;
-
-extern Boolean jobsRunning; /* True if jobs are running */
-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 beVerbose; /* True if should print extra cruft */
-extern Boolean noExecute; /* True if should execute nothing */
-extern Boolean allPrecious; /* True if every target is precious */
-extern Boolean keepgoing; /* True if should continue on unaffected
- * portions of the graph when have an error
- * in one portion */
-extern Boolean touchFlag; /* TRUE if targets should just be 'touched'
- * if out of date. Set by the -t flag */
-extern Boolean usePipes; /* TRUE if should capture the output of
- * subshells by means of pipes. Otherwise it
- * is routed to temporary files from which it
- * is retrieved when the shell exits */
-extern Boolean queryFlag; /* TRUE if we aren't supposed to really make
- * anything, just see if the targets are out-
- * of-date */
-
-extern Boolean checkEnvFirst; /* TRUE if environment should be searched for
- * all variables before the global context */
-
-/* List of specific variables for which the environment should be
- * searched before the global context */
-extern Lst envFirstVars;
-
-extern GNode *DEFAULT; /* .DEFAULT rule */
-
-extern GNode *VAR_GLOBAL; /* Variables defined in a global context, e.g
- * in the Makefile itself */
-extern GNode *VAR_CMD; /* Variables defined on the command line */
-extern char var_Error[]; /* Value returned by Var_Parse when an error
- * is encountered. It actually points to
- * an empty string, so naive callers needn't
- * worry about it. */
-
-extern time_t now; /* The time at the start of this whole
- * process */
-
-extern Boolean oldVars; /* Do old-style variable substitution */
-
-/* The system include path. */
-extern Lst sysIncPath;
-
-/*
- * debug control:
- * There is one bit per module. It is up to the module what debug
- * information to print.
- */
-extern int debug;
-#define DEBUG_ARCH 0x0001
-#define DEBUG_COND 0x0002
-#define DEBUG_DIR 0x0004
-#define DEBUG_GRAPH1 0x0008
-#define DEBUG_GRAPH2 0x0010
-#define DEBUG_JOB 0x0020
-#define DEBUG_MAKE 0x0040
-#define DEBUG_SUFF 0x0080
-#define DEBUG_TARG 0x0100
-#define DEBUG_VAR 0x0200
-#define DEBUG_FOR 0x0400
-#define DEBUG_LOUD 0x0800
-
-#define CONCAT(a,b) a##b
-
-#define DEBUG(module) (debug & CONCAT(DEBUG_,module))
-#define DEBUGF(module,args) \
-do { \
- if (DEBUG(module)) { \
- Debug args ; \
- } \
-} while (0)
-#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/')))
-#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1])))
-
-/*
- * Since there are so many, all functions that return non-integer values are
- * extracted by means of a sed script or two and stuck in the file "nonints.h"
- */
-#include "nonints.h"
-
-int Make_TimeStamp(GNode *, GNode *);
-Boolean Make_OODate(GNode *);
-int Make_HandleUse(GNode *, GNode *);
-void Make_Update(GNode *);
-void Make_DoAllVar(GNode *);
-Boolean Make_Run(Lst *);
+int Make_TimeStamp(struct GNode *, struct GNode *);
+Boolean Make_OODate(struct GNode *);
+int Make_HandleUse(struct GNode *, struct GNode *);
+void Make_Update(struct GNode *);
+void Make_DoAllVar(struct GNode *);
+Boolean Make_Run(struct Lst *);
-#endif /* _MAKE_H_ */
+#endif /* make_h_a91074b9 */
diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h
index 561b24c..a983834 100644
--- a/usr.bin/make/nonints.h
+++ b/usr.bin/make/nonints.h
@@ -39,104 +39,11 @@
* $FreeBSD$
*/
-/* arch.c */
-ReturnStatus Arch_ParseArchive(char **, Lst *, GNode *);
-void Arch_Touch(GNode *);
-void Arch_TouchLib(GNode *);
-int Arch_MTime(GNode *);
-int Arch_MemMTime(GNode *);
-void Arch_FindLib(GNode *, Lst *);
-Boolean Arch_LibOODate(GNode *);
-void Arch_Init(void);
-
-/* compat.c */
-void Compat_Run(Lst *);
-int Compat_RunCommand(void *, void *);
-
-/* cond.c */
-int Cond_Eval(char *);
-void Cond_End(void);
-
-/* for.c */
-int For_Eval(char *);
-void For_Run(int);
+#ifndef nonints_h_33c5dafb
+#define nonints_h_33c5dafb
/* main.c */
void Main_ParseArgLine(char *, int);
char *Cmd_Exec(char *, char **);
-void Debug(const char *, ...);
-void Error(const char *, ...);
-void Fatal(const char *, ...);
-void Punt(const char *, ...);
-void DieHorribly(void);
-int PrintAddr(void *, void *);
-void Finish(int);
-char *estrdup(const char *);
-void *emalloc(size_t);
-void *erealloc(void *, size_t);
-void enomem(void);
-int eunlink(const char *);
-
-/* parse.c */
-void Parse_Error(int, const char *, ...);
-Boolean Parse_AnyExport(void);
-Boolean Parse_IsVar(char *);
-void Parse_DoVar(char *, GNode *);
-void Parse_AddIncludeDir(char *);
-void Parse_File(char *, FILE *);
-void Parse_Init(void);
-void Parse_FromString(char *, int);
-void Parse_MainName(Lst *);
-
-/* str.c */
-void str_init(void);
-char *str_concat(const char *, const char *, int);
-char **brk_string(char *, int *, Boolean);
-char *MAKEFLAGS_quote(const char *);
-char **MAKEFLAGS_break(const char *, int *);
-int Str_Match(const char *, const char *);
-const char *Str_SYSVMatch(const char *, const char *, int *);
-void Str_SYSVSubst(Buffer, const char *, const char *, int);
-
-/* suff.c */
-void Suff_ClearSuffixes(void);
-Boolean Suff_IsTransform(char *);
-GNode *Suff_AddTransform(char *);
-int Suff_EndTransform(void *, void *);
-void Suff_AddSuffix(char *);
-Lst *Suff_GetPath(char *);
-void Suff_DoPaths(void);
-void Suff_AddInclude(char *);
-void Suff_AddLib(char *);
-void Suff_FindDeps(GNode *);
-void Suff_SetNull(char *);
-void Suff_Init(void);
-void Suff_PrintAll(void);
-
-/* targ.c */
-void Targ_Init(void);
-GNode *Targ_NewGN(char *);
-GNode *Targ_FindNode(char *, int);
-void Targ_FindList(Lst *, Lst *, int);
-Boolean Targ_Ignore(GNode *);
-Boolean Targ_Silent(GNode *);
-Boolean Targ_Precious(GNode *);
-void Targ_SetMain(GNode *);
-int Targ_PrintCmd(void *, void *);
-char *Targ_FmtTime(time_t);
-void Targ_PrintType(int);
-void Targ_PrintGraph(int);
-/* var.c */
-void Var_Delete(char *, GNode *);
-void Var_Set(char *, char *, GNode *);
-void Var_Append(char *, char *, GNode *);
-Boolean Var_Exists(char *, GNode *);
-char *Var_Value(char *, GNode *, char **);
-char *Var_Quote(const char *);
-char *Var_Parse(char *, GNode *, Boolean, size_t *, Boolean *);
-char *Var_Subst(char *, char *, GNode *, Boolean);
-char *Var_GetTail(char *);
-char *Var_GetHead(char *);
-void Var_Init(void);
-void Var_Dump(GNode *);
+#endif /* nonints_h_33c5dafb */
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index eb1a5d0..dc1a455 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -81,16 +81,30 @@ __FBSDID("$FreeBSD$");
* Parse_MainName Returns a Lst of the main target to create.
*/
-#include <stdarg.h>
#include <ctype.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdlib.h>
#include <err.h>
-#include <stdio.h>
-#include "make.h"
-#include "hash.h"
+
+#include "arch.h"
+#include "buf.h"
+#include "cond.h"
+#include "config.h"
#include "dir.h"
+#include "for.h"
+#include "globals.h"
+#include "GNode.h"
#include "job.h"
-#include "buf.h"
+#include "make.h"
+#include "nonints.h"
+#include "parse.h"
#include "pathnames.h"
+#include "str.h"
+#include "suff.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/*
* These values are returned by ParseEOF to tell Parse_File whether to
diff --git a/usr.bin/make/parse.h b/usr.bin/make/parse.h
new file mode 100644
index 0000000..04c4df7
--- /dev/null
+++ b/usr.bin/make/parse.h
@@ -0,0 +1,75 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef parse_h_470eeb9a
+#define parse_h_470eeb9a
+
+#include <stdio.h>
+
+#include "sprite.h"
+
+struct GNode;
+struct Lst;
+
+/*
+ * Definitions for handling #include specifications
+ */
+typedef struct {
+ char *str;
+ char *ptr;
+} PTR;
+typedef struct IFile {
+ char *fname; /* name of previous file */
+ int lineno; /* saved line number */
+ FILE *F; /* the open stream */
+ PTR *p; /* the char pointer */
+} IFile;
+
+void Parse_Error(int, const char *, ...);
+Boolean Parse_AnyExport(void);
+Boolean Parse_IsVar(char *);
+void Parse_DoVar(char *, struct GNode *);
+void Parse_AddIncludeDir(char *);
+void Parse_File(char *, FILE *);
+void Parse_Init(void);
+void Parse_FromString(char *, int);
+void Parse_MainName(struct Lst *);
+
+#endif /* parse_h_470eeb9a */
diff --git a/usr.bin/make/pathnames.h b/usr.bin/make/pathnames.h
index d16167c..0b75a48 100644
--- a/usr.bin/make/pathnames.h
+++ b/usr.bin/make/pathnames.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -10,11 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -34,6 +30,9 @@
* $FreeBSD$
*/
+#ifndef pathnames_h_235b888a
+#define pathnames_h_235b888a
+
#ifndef _PATH_OBJDIR
#define _PATH_OBJDIR "obj"
#endif /* ! _PATH_OBJDIR */
@@ -49,3 +48,5 @@
#ifndef _PATH_DEFSYSPATH
#define _PATH_DEFSYSPATH "/usr/share/mk"
#endif /* ! _PATH_DEFSYSPATH */
+
+#endif /* pathnames_h_235b888a */
diff --git a/usr.bin/make/sprite.h b/usr.bin/make/sprite.h
index 4445a00..156318a 100644
--- a/usr.bin/make/sprite.h
+++ b/usr.bin/make/sprite.h
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -39,15 +39,15 @@
* $FreeBSD$
*/
+#ifndef sprite_h_000823c6
+#define sprite_h_000823c6
+
/*
* sprite.h --
*
* Common constants and type declarations for Sprite.
*/
-#ifndef _SPRITE
-#define _SPRITE
-
/*
* A boolean type is defined as an integer, not an enum. This allows a
* boolean argument to be an expression that isn't strictly 0 or 1 valued.
@@ -56,14 +56,12 @@
typedef int Boolean;
#ifndef TRUE
#define TRUE 1
-#endif /* TRUE */
-#ifndef FALSE
#define FALSE 0
-#endif /* FALSE */
+#endif /* TRUE */
typedef int ReturnStatus;
#define SUCCESS 0
#define FAILURE 1
-#endif /* _SPRITE */
+#endif /* sprite_h_000823c6 */
diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c
index 9903980..22633ae 100644
--- a/usr.bin/make/str.c
+++ b/usr.bin/make/str.c
@@ -41,7 +41,14 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "make.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "globals.h"
+#include "str.h"
+#include "util.h"
+#include "var.h"
static char **argv, *buffer;
static int argmax, curlen;
diff --git a/usr.bin/make/str.h b/usr.bin/make/str.h
new file mode 100644
index 0000000..d7d2ae0
--- /dev/null
+++ b/usr.bin/make/str.h
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef str_h_44db59e6
+#define str_h_44db59e6
+
+#include "buf.h"
+#include "sprite.h"
+
+/*
+ * These constants are all used by the Str_Concat function to decide how the
+ * final string should look. If STR_ADDSPACE is given, a space will be
+ * placed between the two strings. If STR_ADDSLASH is given, a '/' will
+ * be used instead of a space. If neither is given, no intervening characters
+ * will be placed between the two strings in the final output.
+ */
+#define STR_ADDSPACE 0x01 /* add a space when Str_Concat'ing */
+#define STR_ADDSLASH 0x04 /* add a slash when Str_Concat'ing */
+
+void str_init(void);
+char *str_concat(const char *, const char *, int);
+char **brk_string(char *, int *, Boolean);
+char *MAKEFLAGS_quote(const char *);
+char **MAKEFLAGS_break(const char *, int *);
+int Str_Match(const char *, const char *);
+const char *Str_SYSVMatch(const char *, const char *, int *);
+void Str_SYSVSubst(Buffer, const char *, const char *, int);
+
+#endif /* str_h_44db59e6 */
diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c
index dce4bca..8c0f7ca 100644
--- a/usr.bin/make/suff.c
+++ b/usr.bin/make/suff.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -90,10 +90,22 @@ __FBSDID("$FreeBSD$");
* if the target had no implicit sources.
*/
-#include <stdio.h>
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
+#include <string.h>
+#include <stdlib.h>
+
+#include "arch.h"
+#include "config.h"
+#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
+#include "lst.h"
+#include "make.h"
+#include "parse.h"
+#include "str.h"
+#include "suff.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/* Lst of suffixes */
static Lst sufflist = Lst_Initializer(sufflist);
diff --git a/usr.bin/make/suff.h b/usr.bin/make/suff.h
new file mode 100644
index 0000000..35887ca
--- /dev/null
+++ b/usr.bin/make/suff.h
@@ -0,0 +1,60 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef suff_h_2d5a821c
+#define suff_h_2d5a821c
+
+struct GNode;
+
+void Suff_ClearSuffixes(void);
+Boolean Suff_IsTransform(char *);
+struct GNode *Suff_AddTransform(char *);
+int Suff_EndTransform(void *, void *);
+void Suff_AddSuffix(char *);
+Lst *Suff_GetPath(char *);
+void Suff_DoPaths(void);
+void Suff_AddInclude(char *);
+void Suff_AddLib(char *);
+void Suff_FindDeps(struct GNode *);
+void Suff_SetNull(char *);
+void Suff_Init(void);
+void Suff_PrintAll(void);
+
+#endif /* suff_h_2d5a821c */
diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c
index cce8bcc..57de36c 100644
--- a/usr.bin/make/targ.c
+++ b/usr.bin/make/targ.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -80,11 +80,18 @@ __FBSDID("$FreeBSD$");
* print something for suffixes, too, but...
*/
-#include <stdio.h>
-#include <time.h>
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
+#include <stdio.h>
+#include <string.h>
+
+#include "dir.h"
+#include "globals.h"
+#include "GNode.h"
+#include "hash.h"
+#include "make.h"
+#include "suff.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/* the list of all targets found so far */
static Lst allTargets = Lst_Initializer(allTargets);
diff --git a/usr.bin/make/targ.h b/usr.bin/make/targ.h
new file mode 100644
index 0000000..fa536c2
--- /dev/null
+++ b/usr.bin/make/targ.h
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef targ_h_6ded1830
+#define targ_h_6ded1830
+
+#include <time.h>
+
+/*
+ * The TARG_ constants are used when calling the Targ_FindNode and
+ * Targ_FindList functions in targ.c. They simply tell the functions what to
+ * do if the desired node(s) is (are) not found. If the TARG_CREATE constant
+ * is given, a new, empty node will be created for the target, placed in the
+ * table of all targets and its address returned. If TARG_NOCREATE is given,
+ * a NULL pointer will be returned.
+ */
+#define TARG_CREATE 0x01 /* create node if not found */
+#define TARG_NOCREATE 0x00 /* don't create it */
+
+struct GNode;
+struct Lst;
+
+void Targ_Init(void);
+struct GNode *Targ_NewGN(char *);
+struct GNode *Targ_FindNode(char *, int);
+void Targ_FindList(struct Lst *, struct Lst *, int);
+Boolean Targ_Ignore(struct GNode *);
+Boolean Targ_Silent(struct GNode *);
+Boolean Targ_Precious(struct GNode *);
+void Targ_SetMain(struct GNode *);
+int Targ_PrintCmd(void *, void *);
+char *Targ_FmtTime(time_t);
+void Targ_PrintType(int);
+void Targ_PrintGraph(int);
+
+#endif /* targ_h_6ded1830 */
diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c
index 29e1e50..31d708e 100644
--- a/usr.bin/make/util.c
+++ b/usr.bin/make/util.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 2002 Juli Mallett. All rights reserved.
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -50,19 +50,16 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
-#include <stdlib.h>
#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <sysexits.h>
#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
-#include "make.h"
-#include "hash.h"
-#include "dir.h"
+#include "globals.h"
#include "job.h"
-#include "pathnames.h"
+#include "targ.h"
+#include "util.h"
/*-
* Debug --
diff --git a/usr.bin/make/util.h b/usr.bin/make/util.h
new file mode 100644
index 0000000..844197f
--- /dev/null
+++ b/usr.bin/make/util.h
@@ -0,0 +1,90 @@
+/*-
+ * Copyright (c) 1988, 1989, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1989 by Berkeley Softworks
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Adam de Boor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef util_h_b7020fdb
+#define util_h_b7020fdb
+
+#include <sys/types.h>
+
+#define CONCAT(a,b) a##b
+
+/*
+ * debug control:
+ * There is one bit per module. It is up to the module what debug
+ * information to print.
+ */
+#define DEBUG_ARCH 0x0001
+#define DEBUG_COND 0x0002
+#define DEBUG_DIR 0x0004
+#define DEBUG_GRAPH1 0x0008
+#define DEBUG_GRAPH2 0x0010
+#define DEBUG_JOB 0x0020
+#define DEBUG_MAKE 0x0040
+#define DEBUG_SUFF 0x0080
+#define DEBUG_TARG 0x0100
+#define DEBUG_VAR 0x0200
+#define DEBUG_FOR 0x0400
+#define DEBUG_LOUD 0x0800
+
+#define DEBUG(module) (debug & CONCAT(DEBUG_,module))
+#define DEBUGF(module,args) \
+do { \
+ if (DEBUG(module)) { \
+ Debug args ; \
+ } \
+} while (0)
+
+#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/')))
+#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1])))
+
+void Debug(const char *, ...);
+void Error(const char *, ...);
+void Fatal(const char *, ...);
+void Punt(const char *, ...);
+void DieHorribly(void);
+int PrintAddr(void *, void *);
+void Finish(int);
+char *estrdup(const char *);
+void *emalloc(size_t);
+void *erealloc(void *, size_t);
+void enomem(void);
+int eunlink(const char *);
+
+#endif /* util_h_b7020fdb */
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index a136d01..672dd50 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1989 by Berkeley Softworks
@@ -83,13 +83,21 @@ __FBSDID("$FreeBSD$");
* XXX: There's a lot of duplication in these functions.
*/
-#include <ctype.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <stdlib.h>
-#include "make.h"
-#include "buf.h"
-#include "var.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "buf.h"
+#include "config.h"
+#include "globals.h"
+#include "GNode.h"
+#include "make.h"
+#include "nonints.h"
+#include "parse.h"
+#include "str.h"
+#include "targ.h"
+#include "util.h"
+#include "var.h"
/*
* This is a harmless return value for Var_Parse that can be used by Var_Subst
diff --git a/usr.bin/make/var.h b/usr.bin/make/var.h
index 530577e..a52e684 100644
--- a/usr.bin/make/var.h
+++ b/usr.bin/make/var.h
@@ -39,6 +39,16 @@
* $FreeBSD$
*/
+#ifndef var_h_9cccafce
+#define var_h_9cccafce
+
+#include <regex.h>
+
+#include "buf.h"
+#include "config.h"
+
+struct GNode;
+
typedef struct Var {
char *name; /* the variable's name */
Buffer val; /* its value */
@@ -95,3 +105,18 @@ Boolean VarSYSVMatch(const char *, Boolean, Buffer, void *);
Boolean VarNoMatch(const char *, Boolean, Buffer, void *);
Boolean VarRESubstitute(const char *, Boolean, Buffer, void *);
Boolean VarSubstitute(const char *, Boolean, Buffer, void *);
+
+void Var_Delete(char *, struct GNode *);
+void Var_Set(char *, char *, struct GNode *);
+void Var_Append(char *, char *, struct GNode *);
+Boolean Var_Exists(char *, struct GNode *);
+char *Var_Value(char *, struct GNode *, char **);
+char *Var_Quote(const char *);
+char *Var_Parse(char *, struct GNode *, Boolean, size_t *, Boolean *);
+char *Var_Subst(char *, char *, struct GNode *, Boolean);
+char *Var_GetTail(char *);
+char *Var_GetHead(char *);
+void Var_Init(void);
+void Var_Dump(struct GNode *);
+
+#endif /* var_h_9cccafce */
diff --git a/usr.bin/make/var_modify.c b/usr.bin/make/var_modify.c
index 5b1ad20..beacacb 100644
--- a/usr.bin/make/var_modify.c
+++ b/usr.bin/make/var_modify.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 2002 Juli Mallett.
* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -42,13 +42,15 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <ctype.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <stdlib.h>
-#include "make.h"
-#include "buf.h"
-#include "var.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "buf.h"
+#include "config.h"
+#include "str.h"
+#include "util.h"
+#include "var.h"
/*-
*-----------------------------------------------------------------------
OpenPOWER on IntegriCloud