3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
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.
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.
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/>.
19 AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
20 AM_CPPFLAGS = -I$(top_srcdir)/lib
23 LDADD = ../lib/libbison.a $(LIBINTL)
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
30 bin_SCRIPTS = $(YACC_SCRIPT)
37 complain.c complain.h \
38 conflicts.c conflicts.h \
45 location.c location.h \
47 muscle_tab.c muscle_tab.h \
48 nullable.c nullable.h \
50 parse-gram.h parse-gram.y \
52 print_graph.c print_graph.h \
53 print-xml.c print-xml.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 \
68 EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
71 parse-gram.c parse-gram.h \
76 MOSTLYCLEANFILES = yacc
80 echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@
84 echo $(bison_SOURCES) $(noinst_HEADERS)
86 # The following rule is not designed to be portable,
87 # and relies on tools that not everyone has.
89 # Most functions in src/*.c should have static scope.
90 # Any that don't must be marked with `extern', but `main'
91 # and `usage' are exceptions. They're always extern, but
92 # don't need to be marked.
94 # The second nm|grep checks for file-scope variables with `extern' scope.
95 sc_tight_scope: $(all_programs)
97 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
98 ( printf '^main$$\n^usage$$\n'; \
99 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
100 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
101 if nm -e *.$(OBJEXT) \
102 | sed -n 's/.* T //p' \
103 | grep -Ev -f $$t; then \
104 echo 'the above functions should have static scope' 1>&2; \
107 ( printf '^program_name$$\n'; \
108 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
109 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
110 if nm -e *.$(OBJEXT) \
111 | sed -n 's/.* [BD] //p' \
112 | grep -Ev -f $$t; then \
113 echo 'the above variables should have static scope' 1>&2; \