summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-09-16 10:20:18 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-09-16 10:20:18 +0000
commit2cd743898ff20f9b51a56a61f2005ff0a77a263e (patch)
tree52a9222701218b34f76bdf284408c23736dabebd /usr.bin
parent8a584d88f768826e1abde4fc5380897c5f04b414 (diff)
scaffolding to recognize special targets/sources using ohash functions.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/make/Makefile8
-rw-r--r--usr.bin/make/generate.c41
-rw-r--r--usr.bin/make/node_int.h61
3 files changed, 106 insertions, 4 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile
index 9a19d075a2f..9fb976b96a2 100644
--- a/usr.bin/make/Makefile
+++ b/usr.bin/make/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.44 2007/09/16 10:14:26 espie Exp $
+# $OpenBSD: Makefile,v 1.45 2007/09/16 10:20:17 espie Exp $
PROG= make
CFLAGS+= -I${.OBJDIR} -I${.CURDIR}
@@ -28,7 +28,8 @@ SRCS+= lstAddNew.c lstAppend.c lstConcat.c lstConcatDestroy.c \
CLEANFILES+=generate hashconsts.h generate.o regress.o check
CLEANFILES+=${LIBOBJS} libohash.a
-CLEANFILES+= varhashconsts.h condhashconsts.h generate.o generate
+CLEANFILES+= varhashconsts.h condhashconsts.h nodehashconsts.h
+CLEANFILES+= generate.o generate
beforedepend: varhashconsts.h condhashconsts.h
# may need tweaking if you add variable synonyms or change the hash function
@@ -41,6 +42,9 @@ varhashconsts.h: generate
condhashconsts.h: generate
${.OBJDIR}/generate 2 ${MAGICCONDSLOTS} >${.TARGET}
+nodehashconsts.h: generate
+ ${.OBJDIR}/generate 3 0 >${.TARGET}
+
generate: generate.c stats.c memory.c
${HOSTCC} ${LDSTATIC} -o ${.TARGET} ${HOSTCFLAGS} ${.ALLSRC} ${LDADD}
diff --git a/usr.bin/make/generate.c b/usr.bin/make/generate.c
index 3841756b017..055292dce7c 100644
--- a/usr.bin/make/generate.c
+++ b/usr.bin/make/generate.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: generate.c,v 1.8 2007/09/03 13:56:56 espie Exp $ */
+/* $OpenBSD: generate.c,v 1.9 2007/09/16 10:20:17 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -35,6 +35,7 @@
#include "ohash.h"
#include "cond_int.h"
#include "var_int.h"
+#include "node_int.h"
#define M(x) x, #x
char *table_var[] = {
@@ -84,10 +85,46 @@ char *table_cond[] = {
NULL
};
+char *table_nodes[] = {
+ M(NODE_DEFAULT),
+ M(NODE_EXEC),
+ M(NODE_IGNORE),
+ M(NODE_INCLUDES),
+ M(NODE_INVISIBLE),
+ M(NODE_JOIN),
+ M(NODE_LIBS),
+ M(NODE_MADE),
+ M(NODE_MAIN),
+ M(NODE_MAKE),
+ M(NODE_MAKEFLAGS),
+ M(NODE_MFLAGS),
+ M(NODE_NOTMAIN),
+ M(NODE_NOTPARALLEL),
+ M(NODE_NO_PARALLEL),
+ M(NODE_NULL),
+ M(NODE_OPTIONAL),
+ M(NODE_ORDER),
+ M(NODE_PARALLEL),
+ M(NODE_PATH),
+ M(NODE_PHONY),
+ M(NODE_PRECIOUS),
+ M(NODE_RECURSIVE),
+ M(NODE_SILENT),
+ M(NODE_SINGLESHELL),
+ M(NODE_SUFFIXES),
+ M(NODE_USE),
+ M(NODE_WAIT),
+ M(NODE_BEGIN),
+ M(NODE_END),
+ M(NODE_INTERRUPT),
+ NULL
+};
+
char **table[] = {
table_var,
- table_cond
+ table_cond,
+ table_nodes
};
int
diff --git a/usr.bin/make/node_int.h b/usr.bin/make/node_int.h
new file mode 100644
index 00000000000..f80aec62a91
--- /dev/null
+++ b/usr.bin/make/node_int.h
@@ -0,0 +1,61 @@
+/* $OpenBSD: node_int.h,v 1.1 2007/09/16 10:20:17 espie Exp $ */
+
+/*
+ * Copyright (c) 2007 Marc Espie.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT 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 OPENBSD
+ * PROJECT 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.
+ */
+
+
+/* List of all nodes recognized by the make parser */
+#define NODE_DEFAULT ".DEFAULT"
+#define NODE_EXEC ".EXEC"
+#define NODE_IGNORE ".IGNORE"
+#define NODE_INCLUDES ".INCLUDES"
+#define NODE_INVISIBLE ".INVISIBLE"
+#define NODE_JOIN ".JOIN"
+#define NODE_LIBS ".LIBS"
+#define NODE_MADE ".MADE"
+#define NODE_MAIN ".MAIN"
+#define NODE_MAKE ".MAKE"
+#define NODE_MAKEFLAGS ".MAKEFLAGS"
+#define NODE_MFLAGS ".MFLAGS"
+#define NODE_NOTMAIN ".NOTMAIN"
+#define NODE_NOTPARALLEL ".NOTPARALLEL"
+#define NODE_NO_PARALLEL ".NOPARALLEL"
+#define NODE_NULL ".NULL"
+#define NODE_OPTIONAL ".OPTIONAL"
+#define NODE_ORDER ".ORDER"
+#define NODE_PARALLEL ".PARALLEL"
+#define NODE_PATH ".PATH"
+#define NODE_PHONY ".PHONY"
+#define NODE_PRECIOUS ".PRECIOUS"
+#define NODE_RECURSIVE ".RECURSIVE"
+#define NODE_SILENT ".SILENT"
+#define NODE_SINGLESHELL ".SINGLESHELL"
+#define NODE_SUFFIXES ".SUFFIXES"
+#define NODE_USE ".USE"
+#define NODE_WAIT ".WAIT"
+
+#define NODE_BEGIN ".BEGIN"
+#define NODE_END ".END"
+#define NODE_INTERRUPT ".INTERRUPT"