diff options
author | harti <harti@FreeBSD.org> | 2005-04-28 12:05:43 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2005-04-28 12:05:43 +0000 |
commit | cb2545c6526a804b90d024436133d94df2b327b1 (patch) | |
tree | 0d176618cda0fc388668180ccba3cfe67d19aa17 /usr.bin/make/Makefile | |
parent | cb5a9ccd732dad2fb703d20cb1775266c9a916df (diff) | |
download | FreeBSD-src-cb2545c6526a804b90d024436133d94df2b327b1.zip FreeBSD-src-cb2545c6526a804b90d024436133d94df2b327b1.tar.gz |
Use a minimal perfect hash for the special sources/targets too. Add
the corresponding magic to create the hash function to the Makefile.
Diffstat (limited to 'usr.bin/make/Makefile')
-rw-r--r-- | usr.bin/make/Makefile | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/usr.bin/make/Makefile b/usr.bin/make/Makefile index 0e15bb9..751bd8b 100644 --- a/usr.bin/make/Makefile +++ b/usr.bin/make/Makefile @@ -22,26 +22,29 @@ CFLAGS+=-D__FBSDID=__RCSID main.o: ${MAKEFILE} -# Directive table. We use a hash table. This hash table has been +# Directive and keyword tables. We use hash tables. These hash tables have been # generated with mph which can be found on the usual GNU mirrors. -# If you change the directives (adding, deleting, reordering) you -# need to create a new table and hash function (directive_hash). +# If you change the directives or keywords (adding, deleting, reordering) you +# need to create new tables and hash functions (directive_hash, keyword_hash). # # The following changes have been made to the generated code: # -# o prefix the names of the g, T0 and T1 arrays with 'directive_'. +# o prefix the names of the g, T0 and T1 arrays with 'directive_' +# resp. 'keyword_'. # # o make the type of the tables 'const [un]signed char' (if you change # anything make sure that the numbers fit into a char). # # o make the hash function use the length for termination, -# not the trailing '\0', via the -l flag in emitc and some editing. +# not the trailing '\0', via the -l flag in emitc and some editing +# (only for directive_hash). LOCALBASE ?= /usr/local MPH ?= ${LOCALBASE}/bin/mph EMITC ?= ${LOCALBASE}/bin/emitc .PRECIOUS: hash + hash: ( echo '/*' ; \ echo ' * DO NOT EDIT' ; \ @@ -71,7 +74,23 @@ hash: -e 's/int len)/size_t len)/' \ -e 's/= T0\[/= directive_T0\[/' \ -e 's/= T1\[/= directive_T1\[/' \ - -e 's/g\[f/directive_g[f/g' \ + -e 's/g\[f/directive_g[f/g' ; \ + cat ${.CURDIR}/parse.c | sed \ + -e '1,/KEYWORD-START-TAG/d' \ + -e '/KEYWORD-END-TAG/,$$d' \ + -e 's/^[^"]*"\([^"]*\)".*$$/\1/' | \ + ${MPH} -d2 -m1 | ${EMITC} -l -s | \ + sed \ + -e 's/^static int g\[\]/static const signed char keyword_g[]/' \ + -e 's/^static int T0\[\]/static const u_char keyword_T0[]/' \ + -e 's/^static int T1\[\]/static const u_char keyword_T1[]/' \ + -e '/^#define uchar unsigned char/d' \ + -e 's/uchar/u_char/g' \ + -e 's/^hash(/keyword_hash(/' \ + -e 's/int len)/size_t len)/' \ + -e 's/= T0\[/= keyword_T0\[/' \ + -e 's/= T1\[/= keyword_T1\[/' \ + -e 's/g\[f/keyword_g[f/g' \ ) > ${.CURDIR}/directive_hash.c # Set the shell which make(1) uses. Bourne is the default, but a decent |