]> git.saurik.com Git - bison.git/blame_incremental - src/Makefile.am
In the grammar scanner, STRING_FINISH unclosed constructs and return
[bison.git] / src / Makefile.am
... / ...
CommitLineData
1## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
2
3## This program is free software; you can redistribute it and/or modify
4## it under the terms of the GNU General Public License as published by
5## the Free Software Foundation; either version 2 of the License, or
6## (at your option) any later version.
7
8## This program is distributed in the hope that it will be useful,
9## but WITHOUT ANY WARRANTY; without even the implied warranty of
10## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11## GNU General Public License for more details.
12
13## You should have received a copy of the GNU General Public License
14## along with this program; if not, write to the Free Software
15## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16## 02110-1301 USA
17
18DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\"
19
20AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
21AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
22AM_YFLAGS = "-dv"
23
24LDADD = ../lib/libbison.a $(LIBINTL)
25
26# Use our own Bison to build the parser. Of course, you ought to
27# keep a sane version of Bison nearby...
28YACC = ../tests/bison -y
29
30bin_PROGRAMS = bison
31bin_SCRIPTS = $(YACC_SCRIPT)
32EXTRA_SCRIPTS = yacc
33
34bison_SOURCES = \
35 LR0.c LR0.h \
36 assoc.c assoc.h \
37 closure.c closure.h \
38 complain.c complain.h \
39 conflicts.c conflicts.h \
40 derives.c derives.h \
41 files.c files.h \
42 flex-scanner.h \
43 getargs.c getargs.h \
44 gram.c gram.h \
45 lalr.h lalr.c \
46 location.c location.h \
47 main.c \
48 muscle_tab.c muscle_tab.h \
49 nullable.c nullable.h \
50 output.c output.h \
51 parse-gram.h parse-gram.y \
52 print.c print.h \
53 print_graph.c print_graph.h \
54 reader.c reader.h \
55 reduce.c reduce.h \
56 revision.c revision.h \
57 relation.c relation.h \
58 scan-code.h scan-code-c.c \
59 scan-gram.h scan-gram-c.c \
60 scan-skel.h scan-skel-c.c \
61 state.c state.h \
62 symlist.c symlist.h \
63 symtab.c symtab.h \
64 system.h \
65 tables.h tables.c \
66 uniqstr.c uniqstr.h \
67 vcg.c vcg.h \
68 vcg_defaults.h
69
70EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
71
72BUILT_SOURCES = \
73parse-gram.c parse-gram.h \
74revision.c \
75scan-code.c \
76scan-skel.c \
77scan-gram.c
78
79MOSTLYCLEANFILES = yacc
80
81yacc:
82 echo '#! /bin/sh' >$@
83 echo "exec '$(bindir)/bison' -y \"$$@\"" >>$@
84 chmod a+x $@
85
86echo:
87 echo $(bison_SOURCES) $(noinst_HEADERS)
88
89revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
90 case "$(VERSION)" in \
91 *+*) sed -n \
92 's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
93 $(top_srcdir)/ChangeLog \
94 ;; \
95 *) echo 'const char *revision = "";' \
96 ;; \
97 esac >$@
98
99# The following rule is not designed to be portable,
100# and relies on tools that not everyone has.
101
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.
106#
107# The second nm|grep checks for file-scope variables with `extern' scope.
108sc_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; \
118 exit 1; \
119 fi; \
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; \
127 exit 1; \
128 fi