aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/genksyms
diff options
context:
space:
mode:
authorArnaud Lacombe <lacombar@gmail.com>2011-05-23 00:05:28 -0400
committerArnaud Lacombe <lacombar@gmail.com>2011-06-09 14:04:41 -0400
commit880f4499bb4f6883095965bdd3b9237d927e24d8 (patch)
tree19f8b015b84e3a0294edfe3373df67e79386199d /scripts/genksyms
parent6b19e7e49e6d4ce123c16a6b069916045cab9fa0 (diff)
genksyms: migrate parser to implicit rules
Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Diffstat (limited to 'scripts/genksyms')
-rw-r--r--scripts/genksyms/.gitignore7
-rw-r--r--scripts/genksyms/Makefile46
-rw-r--r--scripts/genksyms/lex.l4
3 files changed, 9 insertions, 48 deletions
diff --git a/scripts/genksyms/.gitignore b/scripts/genksyms/.gitignore
index be5cadb1b907..86dc07a01b43 100644
--- a/scripts/genksyms/.gitignore
+++ b/scripts/genksyms/.gitignore
@@ -1,4 +1,5 @@
1keywords.c 1*.hash.c
2lex.c 2*.lex.c
3parse.[ch] 3*.tab.c
4*.tab.h
4genksyms 5genksyms
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index 5cdba24b1412..a5510903e874 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -2,52 +2,12 @@
2hostprogs-y := genksyms 2hostprogs-y := genksyms
3always := $(hostprogs-y) 3always := $(hostprogs-y)
4 4
5genksyms-objs := genksyms.o parse.o lex.o 5genksyms-objs := genksyms.o parse.tab.o lex.lex.o
6 6
7# -I needed for generated C source (shipped source) 7# -I needed for generated C source (shipped source)
8HOSTCFLAGS_parse.tab.o := -I$(src) 8HOSTCFLAGS_parse.tab.o := -I$(src)
9HOSTCFLAGS_lex.lex.o := -I$(src)
9 10
10# dependencies on generated files need to be listed explicitly 11# dependencies on generated files need to be listed explicitly
11$(obj)/lex.o: $(obj)/parse.h $(obj)/keywords.c 12$(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h
12 13
13# -I needed for generated C source (shipped source)
14HOSTCFLAGS_lex.o := -I$(src)
15
16ifdef GENERATE_PARSER
17
18# gperf
19
20quiet_cmd_keywords.c = GPERF $@
21 cmd_keywords.c = gperf -L ANSI-C -a -C -E -g -H is_reserved_hash \
22 -k 1,3,$$ -N is_reserved_word -p -t $< > $@
23
24$(obj)/keywords.c: $(obj)/keywords.gperf FORCE
25 $(call if_changed,keywords.c)
26 cp $@ $@_shipped
27
28# flex
29
30quiet_cmd_lex.c = FLEX $@
31 cmd_lex.c = flex -o$@ -d $<
32
33$(obj)/lex.c: $(obj)/lex.l $(obj)/keywords.c FORCE
34 $(call if_changed,lex.c)
35 cp $@ $@_shipped
36
37# bison
38
39quiet_cmd_parse.c = BISON $@
40 cmd_parse.c = bison -o$@ -dtv $(filter-out FORCE,$^)
41
42$(obj)/parse.c: $(obj)/parse.y FORCE
43 $(call if_changed,parse.c)
44 cp $@ $@_shipped
45 cp $(@:.c=.h) $(@:.c=.h)_shipped
46
47$(obj)/parse.h: $(obj)/parse.c ;
48
49clean-files += parse.output
50
51endif
52
53targets += keywords.c lex.c parse.c parse.h
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
index e4ddd493fec3..400ae06a70df 100644
--- a/scripts/genksyms/lex.l
+++ b/scripts/genksyms/lex.l
@@ -29,7 +29,7 @@
29#include <ctype.h> 29#include <ctype.h>
30 30
31#include "genksyms.h" 31#include "genksyms.h"
32#include "parse.h" 32#include "parse.tab.h"
33 33
34/* We've got a two-level lexer here. We let flex do basic tokenization 34/* We've got a two-level lexer here. We let flex do basic tokenization
35 and then we categorize those basic tokens in the second stage. */ 35 and then we categorize those basic tokens in the second stage. */
@@ -94,7 +94,7 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
94 94
95/* Bring in the keyword recognizer. */ 95/* Bring in the keyword recognizer. */
96 96
97#include "keywords.c" 97#include "keywords.hash.c"
98 98
99 99
100/* Macros to append to our phrase collection list. */ 100/* Macros to append to our phrase collection list. */