]> git.saurik.com Git - bison.git/blame - src/Makefile.am
maint: run "make update-copyright"
[bison.git] / src / Makefile.am
CommitLineData
3b2942e6 1# Make bison/src.
2c8a9dfa 2
219c26ea 3# Copyright (C) 2001-2010 Free Software Foundation, Inc.
2c8a9dfa 4
f16b0819 5# This program is free software: you can redistribute it and/or modify
3b2942e6 6# it under the terms of the GNU General Public License as published by
f16b0819
PE
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
3b2942e6
PE
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.
f16b0819 14#
3b2942e6 15# You should have received a copy of the GNU General Public License
f16b0819 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
095a3fb5 17
b5775a81 18AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
3b2942e6 19AM_CPPFLAGS = -I$(top_srcdir)/lib
9abb46d5 20AM_YFLAGS = "-dv"
2c8a9dfa 21
be14ade5 22LDADD = ../lib/libbison.a $(LIBINTL)
8ebbae2a 23
cd3684cf
AD
24# Use our own Bison to build the parser. Of course, you ought to
25# keep a sane version of Bison nearby...
07c39ae9 26YACC = ../tests/bison -y --warnings=all,error
cd3684cf 27
a0f6b076 28bin_PROGRAMS = bison
f0057011 29bin_SCRIPTS = $(YACC_SCRIPT)
a504e06d 30EXTRA_SCRIPTS = yacc
a0f6b076 31
04098407 32bison_SOURCES = \
0c15323d 33 LR0.c LR0.h \
a945ec39 34 assoc.c assoc.h \
0c15323d
AD
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 \
e9071366 40 flex-scanner.h \
0c15323d
AD
41 getargs.c getargs.h \
42 gram.c gram.h \
43 lalr.h lalr.c \
8efe435c 44 location.c location.h \
0c15323d
AD
45 main.c \
46 muscle_tab.c muscle_tab.h \
47 nullable.c nullable.h \
0c15323d
AD
48 output.c output.h \
49 parse-gram.h parse-gram.y \
50 print.c print.h \
51 print_graph.c print_graph.h \
41d7a5f2 52 print-xml.c print-xml.h \
0c15323d
AD
53 reader.c reader.h \
54 reduce.c reduce.h \
0e4d5753 55 relation.c relation.h \
e9071366
AD
56 scan-code.h scan-code-c.c \
57 scan-gram.h scan-gram-c.c \
58 scan-skel.h scan-skel-c.c \
0c15323d 59 state.c state.h \
56c47203 60 symlist.c symlist.h \
0c15323d
AD
61 symtab.c symtab.h \
62 system.h \
c6f1a33c 63 tables.h tables.c \
5bf3d7c1 64 uniqstr.c uniqstr.h \
35fe0834 65 graphviz.c graphviz.h
a0f6b076 66
e9071366 67EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
2cec9080 68
e9071366
AD
69BUILT_SOURCES = \
70parse-gram.c parse-gram.h \
e9071366
AD
71scan-code.c \
72scan-skel.c \
4862bdfd 73scan-gram.c
a67cef01 74
d8388d7a
PE
75MOSTLYCLEANFILES = yacc
76
77yacc:
78 echo '#! /bin/sh' >$@
5a43d418 79 echo "exec '$(bindir)/bison' -y "'"$$@"' >>$@
d8388d7a
PE
80 chmod a+x $@
81
0c15323d
AD
82echo:
83 echo $(bison_SOURCES) $(noinst_HEADERS)
04098407
PE
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