]> git.saurik.com Git - bison.git/blob - src/Makefile.am
POSIX: warn if %prec's token was not defined.
[bison.git] / src / Makefile.am
1 # Make bison/src.
2
3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 # Free Software 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 = $(WARN_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 --report=all
28
29 bin_PROGRAMS = bison
30 bin_SCRIPTS = $(YACC_SCRIPT)
31 EXTRA_SCRIPTS = yacc
32
33 bison_SOURCES = \
34 AnnotationList.c AnnotationList.h \
35 InadequacyList.c InadequacyList.h \
36 LR0.c LR0.h \
37 Sbitset.c Sbitset.h \
38 assoc.c assoc.h \
39 closure.c closure.h \
40 complain.c complain.h \
41 conflicts.c conflicts.h \
42 derives.c derives.h \
43 files.c files.h \
44 flex-scanner.h \
45 getargs.c getargs.h \
46 gram.c gram.h \
47 lalr.h lalr.c \
48 ielr.h ielr.c \
49 location.c location.h \
50 main.c \
51 muscle-tab.c muscle-tab.h \
52 named-ref.c named-ref.h \
53 nullable.c nullable.h \
54 output.c output.h \
55 parse-gram.h parse-gram.y \
56 print.c print.h \
57 print_graph.c print_graph.h \
58 print-xml.c print-xml.h \
59 reader.c reader.h \
60 reduce.c reduce.h \
61 relation.c relation.h \
62 scan-code.h scan-code-c.c \
63 scan-gram.h scan-gram-c.c \
64 scan-skel.h scan-skel-c.c \
65 state.c state.h \
66 symlist.c symlist.h \
67 symtab.c symtab.h \
68 system.h \
69 tables.h tables.c \
70 uniqstr.c uniqstr.h \
71 graphviz.c graphviz.h
72
73 EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
74
75 BUILT_SOURCES = \
76 parse-gram.c parse-gram.h \
77 scan-code.c \
78 scan-skel.c \
79 scan-gram.c
80
81 MOSTLYCLEANFILES = yacc
82
83 yacc:
84 echo '#! /bin/sh' >$@
85 echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@
86 chmod a+x $@
87
88 echo:
89 echo $(bison_SOURCES) $(noinst_HEADERS)
90
91 # The following rule is not designed to be portable,
92 # and relies on tools that not everyone has.
93
94 # Most functions in src/*.c should have static scope.
95 # Any that don't must be marked with `extern', but `main'
96 # and `usage' are exceptions. They're always extern, but
97 # don't need to be marked.
98 #
99 # The second nm|grep checks for file-scope variables with `extern' scope.
100 sc_tight_scope: $(all_programs)
101 @t=exceptions-$$$$; \
102 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
103 ( printf '^main$$\n^usage$$\n'; \
104 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
105 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
106 if nm -e *.$(OBJEXT) \
107 | sed -n 's/.* T //p' \
108 | grep -Ev -f $$t; then \
109 echo 'the above functions should have static scope' 1>&2; \
110 exit 1; \
111 fi; \
112 ( printf '^program_name$$\n'; \
113 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
114 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
115 if nm -e *.$(OBJEXT) \
116 | sed -n 's/.* [BD] //p' \
117 | grep -Ev -f $$t; then \
118 echo 'the above variables should have static scope' 1>&2; \
119 exit 1; \
120 fi