3 # Copyright (C) 2001-2012 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
19 AM_CPPFLAGS = -I$(top_srcdir)/lib
22 LDADD = ../lib/libbison.a $(LIBINTL)
24 # Use our own Bison to build the parser. Of course, you ought to
25 # keep a sane version of Bison nearby...
26 YACC = ../tests/bison -y --warnings=all,error --report=all
29 bin_SCRIPTS = $(YACC_SCRIPT)
33 AnnotationList.c AnnotationList.h \
34 InadequacyList.c InadequacyList.h \
39 complain.c complain.h \
40 conflicts.c conflicts.h \
48 location.c location.h \
50 muscle-tab.c muscle-tab.h \
51 named-ref.c named-ref.h \
52 nullable.c nullable.h \
54 parse-gram.h parse-gram.y \
56 print_graph.c print_graph.h \
57 print-xml.c print-xml.h \
60 relation.c relation.h \
61 scan-code.h scan-code-c.c \
62 scan-gram.h scan-gram-c.c \
63 scan-skel.h scan-skel-c.c \
72 EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
75 parse-gram.c parse-gram.h \
80 MOSTLYCLEANFILES = yacc
83 $(AM_V_GEN)echo '#! /bin/sh' >$@
84 $(AM_V_at)echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@
85 $(AM_V_at)chmod a+x $@
88 echo $(bison_SOURCES) $(noinst_HEADERS)
90 # The following rule is not designed to be portable,
91 # and relies on tools that not everyone has.
93 # Most functions in src/*.c should have static scope.
94 # Any that don't must be marked with `extern', but `main'
95 # and `usage' are exceptions. They're always extern, but
96 # don't need to be marked.
98 # The second nm|grep checks for file-scope variables with `extern' scope.
99 sc_tight_scope: $(all_programs)
100 @t=exceptions-$$$$; \
101 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
102 ( printf '^main$$\n^usage$$\n'; \
103 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
104 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
105 if nm -e *.$(OBJEXT) \
106 | sed -n 's/.* T //p' \
107 | grep -Ev -f $$t; then \
108 echo 'the above functions should have static scope' 1>&2; \
111 ( printf '^program_name$$\n'; \
112 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
113 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
114 if nm -e *.$(OBJEXT) \
115 | sed -n 's/.* [BD] //p' \
116 | grep -Ev -f $$t; then \
117 echo 'the above variables should have static scope' 1>&2; \