1 ## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 2 of the License, or
6 ## (at your option) any later version.
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program; if not, write to the Free Software
15 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\"
20 AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
21 AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
24 LDADD = ../lib/libbison.a $(LIBINTL)
26 # Use our own Bison to build the parser. Of course, you ought to
27 # keep a sane version of Bison nearby...
28 YACC = ../tests/bison -y
31 bin_SCRIPTS = $(YACC_SCRIPT)
38 complain.c complain.h \
39 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 \
55 relation.c relation.h \
57 scan-skel-c.c scan-skel.h \
67 EXTRA_bison_SOURCES = scan-skel.l scan-gram.l
69 BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h
71 MOSTLYCLEANFILES = yacc
75 echo 'exec $(bindir)/bison -y "$$@"' >>$@
79 echo $(bison_SOURCES) $(noinst_HEADERS)
81 # The following rule is not designed to be portable,
82 # and relies on tools that not everyone has.
84 # Most functions in src/*.c should have static scope.
85 # Any that don't must be marked with `extern', but `main'
86 # and `usage' are exceptions. They're always extern, but
87 # don't need to be marked.
89 # The second nm|grep checks for file-scope variables with `extern' scope.
90 sc_tight_scope: $(all_programs)
92 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
93 ( printf '^main$$\n^usage$$\n'; \
94 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
95 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
96 if nm -e *.$(OBJEXT) \
97 | sed -n 's/.* T //p' \
98 | grep -Ev -f $$t; then \
99 echo 'the above functions should have static scope' 1>&2; \
102 ( printf '^program_name$$\n'; \
103 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
104 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
105 if nm -e *.$(OBJEXT) \
106 | sed -n 's/.* [BD] //p' \
107 | grep -Ev -f $$t; then \
108 echo 'the above variables should have static scope' 1>&2; \