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