3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 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 2, or (at your option)
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, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
22 AM_CPPFLAGS = -I$(top_srcdir)/lib
25 LDADD = ../lib/libbison.a $(LIBINTL)
27 # Use our own Bison to build the parser. Of course, you ought to
28 # keep a sane version of Bison nearby...
29 YACC = ../tests/bison -y
32 bin_SCRIPTS = $(YACC_SCRIPT)
39 complain.c complain.h \
40 conflicts.c conflicts.h \
47 location.c location.h \
49 muscle_tab.c muscle_tab.h \
50 nullable.c nullable.h \
52 parse-gram.h parse-gram.y \
54 print_graph.c print_graph.h \
57 revision.c revision.h \
58 relation.c relation.h \
59 scan-code.h scan-code-c.c \
60 scan-gram.h scan-gram-c.c \
61 scan-skel.h scan-skel-c.c \
70 EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
73 parse-gram.c parse-gram.h \
79 MOSTLYCLEANFILES = yacc
83 echo "exec '$(bindir)/bison' -y \"$$@\"" >>$@
87 echo $(bison_SOURCES) $(noinst_HEADERS)
89 revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
90 case "$(VERSION)" in \
92 's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
93 $(top_srcdir)/ChangeLog \
95 *) echo 'const char *revision = "";' \
99 # The following rule is not designed to be portable,
100 # and relies on tools that not everyone has.
102 # Most functions in src/*.c should have static scope.
103 # Any that don't must be marked with `extern', but `main'
104 # and `usage' are exceptions. They're always extern, but
105 # don't need to be marked.
107 # The second nm|grep checks for file-scope variables with `extern' scope.
108 sc_tight_scope: $(all_programs)
109 @t=exceptions-$$$$; \
110 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
111 ( printf '^main$$\n^usage$$\n'; \
112 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
113 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
114 if nm -e *.$(OBJEXT) \
115 | sed -n 's/.* T //p' \
116 | grep -Ev -f $$t; then \
117 echo 'the above functions should have static scope' 1>&2; \
120 ( printf '^program_name$$\n'; \
121 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
122 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
123 if nm -e *.$(OBJEXT) \
124 | sed -n 's/.* [BD] //p' \
125 | grep -Ev -f $$t; then \
126 echo 'the above variables should have static scope' 1>&2; \