summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2020-01-13 13:59:25 +0000
committerMarc Espie <espie@cvs.openbsd.org>2020-01-13 13:59:25 +0000
commitbf79a0eec5864ef84c6e90298ae692ede1001da4 (patch)
tree524367b00957281ebdc380d3de40d3f184f8a10a /usr.bin/make
parent345c16a9d5f3d18086d41b7fe0138972d5bc84e2 (diff)
a lot of special keywors (.INCLUDE/.LIBRARIES) were removed a few releases
ago. Document what's actually going on with special keywords (mostly .PATH has special semantics) and document that SPECIAL_NOTHING corresponds to ignoring former keywords.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/gnode.h6
-rw-r--r--usr.bin/make/parse.c51
2 files changed, 20 insertions, 37 deletions
diff --git a/usr.bin/make/gnode.h b/usr.bin/make/gnode.h
index a6e382f289d..00efe9f5bef 100644
--- a/usr.bin/make/gnode.h
+++ b/usr.bin/make/gnode.h
@@ -1,6 +1,6 @@
#ifndef GNODE_H
#define GNODE_H
-/* $OpenBSD: gnode.h,v 1.35 2020/01/13 13:48:20 espie Exp $ */
+/* $OpenBSD: gnode.h,v 1.36 2020/01/13 13:59:24 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -80,7 +80,9 @@
#define SPECIAL_EXEC 4U
#define SPECIAL_IGNORE 5U
-#define SPECIAL_NOTHING 6U
+#define SPECIAL_NOTHING 6U /* this is used for things we
+ * recognize for compatibility but
+ * don't do anything with... */
#define SPECIAL_INVISIBLE 8U
#define SPECIAL_JOIN 9U
#define SPECIAL_MADE 11U
diff --git a/usr.bin/make/parse.c b/usr.bin/make/parse.c
index d64c289481d..19a15ca776d 100644
--- a/usr.bin/make/parse.c
+++ b/usr.bin/make/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.126 2020/01/13 13:54:44 espie Exp $ */
+/* $OpenBSD: parse.c,v 1.127 2020/01/13 13:59:24 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
@@ -837,6 +837,7 @@ ParseDoDependency(const char *line) /* the line to parse */
Array_Reset(&gsources);
cp = parse_do_targets(&paths, &tOp, line);
+ assert(specType == SPECIAL_PATH || Lst_IsEmpty(&paths));
if (cp == NULL || specType == SPECIAL_ERROR) {
/* invalidate targets for further processing */
Array_Reset(&gtargets);
@@ -855,15 +856,11 @@ ParseDoDependency(const char *line) /* the line to parse */
line = cp;
- /*
- * Several special targets take different actions if present with no
- * sources:
- * a .SUFFIXES line with no sources clears out all old suffixes
- * a .PRECIOUS line makes all targets precious
- * a .IGNORE line ignores errors for all targets
- * a .SILENT line creates silence when making all targets
- * a .PATH removes all directories from the search path(s).
- */
+ /* Several special targets have specific semantics with no source:
+ * .SUFFIXES clears out all old suffixes
+ * .PRECIOUS/.IGNORE/.SILENT
+ * apply to all target
+ * .PATH clears out all search paths. */
if (!*line) {
switch (specType) {
case SPECIAL_SUFFIXES:
@@ -885,42 +882,26 @@ ParseDoDependency(const char *line) /* the line to parse */
break;
}
} else if (specType == SPECIAL_MFLAGS) {
- /* Call on functions in main.c to deal with these arguments */
Main_ParseArgLine(line);
return;
} else if (specType == SPECIAL_NOTPARALLEL) {
return;
}
- /*
- * NOW GO FOR THE SOURCES
- */
+ /* NOW GO FOR THE SOURCES */
if (specType == SPECIAL_SUFFIXES || specType == SPECIAL_PATH ||
specType == SPECIAL_NOTHING) {
while (*line) {
- /*
- * If the target was one that doesn't take files as its
- * sources but takes something like suffixes, we take each
- * space-separated word on the line as a something and deal
- * with it accordingly.
- *
- * If the target was .SUFFIXES, we take each source as a
- * suffix and add it to the list of suffixes maintained by
- * the Suff module.
- *
- * If the target was a .PATH, we add the source as a
- * directory to search on the search path.
+ /* Some special targets take a list of space-separated
+ * words. For each word,
*
- * If it was .INCLUDES, the source is taken to be the
- * suffix of files which will be #included and whose search
- * path should be present in the .INCLUDES variable.
+ * if .SUFFIXES, add it to the list of suffixes maintained
+ * by suff.c.
*
- * If it was .LIBS, the source is taken to be the suffix of
- * files which are considered libraries and whose search
- * path should be present in the .LIBS variable.
+ * if .PATHS, add it as a directory on the main search path.
*
- * If it was .NULL, the source is the suffix to use when a
- * file has no valid suffix.
+ * if .LIBS/.INCLUDE/.NULL... this has been deprecated,
+ * ignore
*/
while (*cp && !ISSPACE(*cp))
cp++;
@@ -936,6 +917,7 @@ ParseDoDependency(const char *line) /* the line to parse */
ln = Lst_Adv(ln))
Dir_AddDiri(Lst_Datum(ln), line, cp);
break;
+ Lst_Destroy(&paths, NOFREE);
}
default:
break;
@@ -946,7 +928,6 @@ ParseDoDependency(const char *line) /* the line to parse */
cp++;
line = cp;
}
- Lst_Destroy(&paths, NOFREE);
} else {
while (*line) {
/*