]> git.saurik.com Git - bison.git/blame_incremental - src/Makefile.am
Prepare for 2.4.2 release.
[bison.git] / src / Makefile.am
... / ...
CommitLineData
1# Make bison/src.
2
3# Copyright (C) 2001-2010 Free Software Foundation, Inc.
4
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.
9#
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.
14#
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/>.
17
18AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
19AM_CPPFLAGS = -I$(top_srcdir)/lib
20AM_YFLAGS = "-dv"
21
22LDADD = ../lib/libbison.a $(LIBINTL)
23
24# Use our own Bison to build the parser. Of course, you ought to
25# keep a sane version of Bison nearby...
26YACC = ../tests/bison -y --warnings=all,error
27
28bin_PROGRAMS = bison
29bin_SCRIPTS = $(YACC_SCRIPT)
30EXTRA_SCRIPTS = yacc
31
32bison_SOURCES = \
33 LR0.c LR0.h \
34 assoc.c assoc.h \
35 closure.c closure.h \
36 complain.c complain.h \
37 conflicts.c conflicts.h \
38 derives.c derives.h \
39 files.c files.h \
40 flex-scanner.h \
41 getargs.c getargs.h \
42 gram.c gram.h \
43 lalr.h lalr.c \
44 location.c location.h \
45 main.c \
46 muscle_tab.c muscle_tab.h \
47 nullable.c nullable.h \
48 output.c output.h \
49 parse-gram.h parse-gram.y \
50 print.c print.h \
51 print_graph.c print_graph.h \
52 print-xml.c print-xml.h \
53 reader.c reader.h \
54 reduce.c reduce.h \
55 relation.c relation.h \
56 scan-code.h scan-code-c.c \
57 scan-gram.h scan-gram-c.c \
58 scan-skel.h scan-skel-c.c \
59 state.c state.h \
60 symlist.c symlist.h \
61 symtab.c symtab.h \
62 system.h \
63 tables.h tables.c \
64 uniqstr.c uniqstr.h \
65 graphviz.c graphviz.h
66
67EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
68
69BUILT_SOURCES = \
70parse-gram.c parse-gram.h \
71scan-code.c \
72scan-skel.c \
73scan-gram.c
74
75MOSTLYCLEANFILES = yacc
76
77yacc:
78 echo '#! /bin/sh' >$@
79 echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@
80 chmod a+x $@
81
82echo:
83 echo $(bison_SOURCES) $(noinst_HEADERS)
84
85# The following rule is not designed to be portable,
86# and relies on tools that not everyone has.
87
88# Most functions in src/*.c should have static scope.
89# Any that don't must be marked with `extern', but `main'
90# and `usage' are exceptions. They're always extern, but
91# don't need to be marked.
92#
93# The second nm|grep checks for file-scope variables with `extern' scope.
94sc_tight_scope: $(all_programs)
95 @t=exceptions-$$$$; \
96 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
97 ( printf '^main$$\n^usage$$\n'; \
98 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
99 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
100 if nm -e *.$(OBJEXT) \
101 | sed -n 's/.* T //p' \
102 | grep -Ev -f $$t; then \
103 echo 'the above functions should have static scope' 1>&2; \
104 exit 1; \
105 fi; \
106 ( printf '^program_name$$\n'; \
107 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
108 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
109 if nm -e *.$(OBJEXT) \
110 | sed -n 's/.* [BD] //p' \
111 | grep -Ev -f $$t; then \
112 echo 'the above variables should have static scope' 1>&2; \
113 exit 1; \
114 fi