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