]>
Commit | Line | Data |
---|---|---|
3b2942e6 | 1 | # Make bison/src. |
2c8a9dfa | 2 | |
efa02545 | 3 | # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software |
3b2942e6 | 4 | # Foundation, Inc. |
2c8a9dfa | 5 | |
f16b0819 | 6 | # This program is free software: you can redistribute it and/or modify |
3b2942e6 | 7 | # it under the terms of the GNU General Public License as published by |
f16b0819 PE |
8 | # the Free Software Foundation, either version 3 of the License, or |
9 | # (at your option) any later version. | |
10 | # | |
3b2942e6 PE |
11 | # This program is distributed in the hope that it will be useful, |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
f16b0819 | 15 | # |
3b2942e6 | 16 | # You should have received a copy of the GNU General Public License |
f16b0819 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
095a3fb5 | 18 | |
9abb46d5 | 19 | AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS) |
3b2942e6 | 20 | AM_CPPFLAGS = -I$(top_srcdir)/lib |
9abb46d5 | 21 | AM_YFLAGS = "-dv" |
2c8a9dfa | 22 | |
be14ade5 | 23 | LDADD = ../lib/libbison.a $(LIBINTL) |
8ebbae2a | 24 | |
cd3684cf AD |
25 | # Use our own Bison to build the parser. Of course, you ought to |
26 | # keep a sane version of Bison nearby... | |
07c39ae9 | 27 | YACC = ../tests/bison -y --warnings=all,error |
cd3684cf | 28 | |
a0f6b076 | 29 | bin_PROGRAMS = bison |
f0057011 | 30 | bin_SCRIPTS = $(YACC_SCRIPT) |
a504e06d | 31 | EXTRA_SCRIPTS = yacc |
a0f6b076 | 32 | |
04098407 | 33 | bison_SOURCES = \ |
0c15323d | 34 | LR0.c LR0.h \ |
a945ec39 | 35 | assoc.c assoc.h \ |
0c15323d AD |
36 | closure.c closure.h \ |
37 | complain.c complain.h \ | |
38 | conflicts.c conflicts.h \ | |
39 | derives.c derives.h \ | |
40 | files.c files.h \ | |
e9071366 | 41 | flex-scanner.h \ |
0c15323d AD |
42 | getargs.c getargs.h \ |
43 | gram.c gram.h \ | |
44 | lalr.h lalr.c \ | |
8efe435c | 45 | location.c location.h \ |
0c15323d AD |
46 | main.c \ |
47 | muscle_tab.c muscle_tab.h \ | |
48 | nullable.c nullable.h \ | |
0c15323d AD |
49 | output.c output.h \ |
50 | parse-gram.h parse-gram.y \ | |
51 | print.c print.h \ | |
52 | print_graph.c print_graph.h \ | |
41d7a5f2 | 53 | print-xml.c print-xml.h \ |
0c15323d AD |
54 | reader.c reader.h \ |
55 | reduce.c reduce.h \ | |
7891a7c4 | 56 | revision.c revision.h \ |
0e4d5753 | 57 | relation.c relation.h \ |
e9071366 AD |
58 | scan-code.h scan-code-c.c \ |
59 | scan-gram.h scan-gram-c.c \ | |
60 | scan-skel.h scan-skel-c.c \ | |
0c15323d | 61 | state.c state.h \ |
56c47203 | 62 | symlist.c symlist.h \ |
0c15323d AD |
63 | symtab.c symtab.h \ |
64 | system.h \ | |
c6f1a33c | 65 | tables.h tables.c \ |
5bf3d7c1 | 66 | uniqstr.c uniqstr.h \ |
35fe0834 | 67 | graphviz.c graphviz.h |
a0f6b076 | 68 | |
e9071366 | 69 | EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l |
2cec9080 | 70 | |
e9071366 AD |
71 | BUILT_SOURCES = \ |
72 | parse-gram.c parse-gram.h \ | |
73 | revision.c \ | |
74 | scan-code.c \ | |
75 | scan-skel.c \ | |
4862bdfd | 76 | scan-gram.c |
a67cef01 | 77 | |
d8388d7a PE |
78 | MOSTLYCLEANFILES = yacc |
79 | ||
80 | yacc: | |
81 | echo '#! /bin/sh' >$@ | |
5a43d418 | 82 | echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@ |
d8388d7a PE |
83 | chmod a+x $@ |
84 | ||
0c15323d AD |
85 | echo: |
86 | echo $(bison_SOURCES) $(noinst_HEADERS) | |
04098407 | 87 | |
7891a7c4 JD |
88 | revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog |
89 | case "$(VERSION)" in \ | |
90 | *+*) sed -n \ | |
91 | 's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \ | |
92 | $(top_srcdir)/ChangeLog \ | |
93 | ;; \ | |
94 | *) echo 'const char *revision = "";' \ | |
95 | ;; \ | |
96 | esac >$@ | |
97 | ||
04098407 PE |
98 | # The following rule is not designed to be portable, |
99 | # and relies on tools that not everyone has. | |
100 | ||
101 | # Most functions in src/*.c should have static scope. | |
102 | # Any that don't must be marked with `extern', but `main' | |
103 | # and `usage' are exceptions. They're always extern, but | |
104 | # don't need to be marked. | |
105 | # | |
106 | # The second nm|grep checks for file-scope variables with `extern' scope. | |
107 | sc_tight_scope: $(all_programs) | |
108 | @t=exceptions-$$$$; \ | |
109 | trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \ | |
110 | ( printf '^main$$\n^usage$$\n'; \ | |
111 | grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \ | |
112 | | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \ | |
113 | if nm -e *.$(OBJEXT) \ | |
114 | | sed -n 's/.* T //p' \ | |
115 | | grep -Ev -f $$t; then \ | |
116 | echo 'the above functions should have static scope' 1>&2; \ | |
117 | exit 1; \ | |
118 | fi; \ | |
119 | ( printf '^program_name$$\n'; \ | |
120 | sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \ | |
121 | $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \ | |
122 | if nm -e *.$(OBJEXT) \ | |
123 | | sed -n 's/.* [BD] //p' \ | |
124 | | grep -Ev -f $$t; then \ | |
125 | echo 'the above variables should have static scope' 1>&2; \ | |
126 | exit 1; \ | |
127 | fi |