]> git.saurik.com Git - bison.git/blame - src/Makefile.am
* bootstrap: Undo changes to gnulib files that autoreconf made.
[bison.git] / src / Makefile.am
CommitLineData
57beea57 1## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
2c8a9dfa
AD
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
0fb669f9
PE
15## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16## 02110-1301 USA
2c8a9dfa 17
04098407 18DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\"
095a3fb5 19
9abb46d5 20AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
dd0e0635 21AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
9abb46d5 22AM_YFLAGS = "-dv"
2c8a9dfa 23
be14ade5 24LDADD = ../lib/libbison.a $(LIBINTL)
8ebbae2a 25
cd3684cf
AD
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
a0f6b076 30bin_PROGRAMS = bison
f0057011 31bin_SCRIPTS = $(YACC_SCRIPT)
a504e06d 32EXTRA_SCRIPTS = yacc
a0f6b076 33
04098407 34bison_SOURCES = \
0c15323d 35 LR0.c LR0.h \
a945ec39 36 assoc.c assoc.h \
0c15323d
AD
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 getargs.c getargs.h \
43 gram.c gram.h \
44 lalr.h lalr.c \
8efe435c 45 location.c location.h \
0c15323d
AD
46 main.c \
47 muscle_tab.c muscle_tab.h \
48 nullable.c nullable.h \
0c15323d
AD
49 output.c output.h \
50 parse-gram.h parse-gram.y \
51 print.c print.h \
52 print_graph.c print_graph.h \
53 reader.c reader.h \
54 reduce.c reduce.h \
0e4d5753 55 relation.c relation.h \
2cec9080
PE
56 scan-gram-c.c \
57 scan-skel-c.c scan-skel.h \
0c15323d 58 state.c state.h \
56c47203 59 symlist.c symlist.h \
0c15323d
AD
60 symtab.c symtab.h \
61 system.h \
c6f1a33c 62 tables.h tables.c \
5bf3d7c1 63 uniqstr.c uniqstr.h \
0c15323d
AD
64 vcg.c vcg.h \
65 vcg_defaults.h
a0f6b076 66
2cec9080
PE
67EXTRA_bison_SOURCES = scan-skel.l scan-gram.l
68
e9955c83 69BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h
a67cef01 70
d8388d7a
PE
71MOSTLYCLEANFILES = yacc
72
73yacc:
74 echo '#! /bin/sh' >$@
75 echo 'exec $(bindir)/bison -y "$$@"' >>$@
76 chmod a+x $@
77
0c15323d
AD
78echo:
79 echo $(bison_SOURCES) $(noinst_HEADERS)
04098407
PE
80
81# The following rule is not designed to be portable,
82# and relies on tools that not everyone has.
83
84# Most functions in src/*.c should have static scope.
85# Any that don't must be marked with `extern', but `main'
86# and `usage' are exceptions. They're always extern, but
87# don't need to be marked.
88#
89# The second nm|grep checks for file-scope variables with `extern' scope.
90sc_tight_scope: $(all_programs)
91 @t=exceptions-$$$$; \
92 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
93 ( printf '^main$$\n^usage$$\n'; \
94 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
95 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
96 if nm -e *.$(OBJEXT) \
97 | sed -n 's/.* T //p' \
98 | grep -Ev -f $$t; then \
99 echo 'the above functions should have static scope' 1>&2; \
100 exit 1; \
101 fi; \
102 ( printf '^program_name$$\n'; \
103 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
104 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
105 if nm -e *.$(OBJEXT) \
106 | sed -n 's/.* [BD] //p' \
107 | grep -Ev -f $$t; then \
108 echo 'the above variables should have static scope' 1>&2; \
109 exit 1; \
110 fi