]> git.saurik.com Git - bison.git/blame - src/Makefile.am
2006-10-08 Paolo Bonzini <bonzini@gnu.org>
[bison.git] / src / Makefile.am
CommitLineData
3b2942e6 1# Make bison/src.
2c8a9dfa 2
3b2942e6
PE
3# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
4# Foundation, Inc.
2c8a9dfa 5
3b2942e6
PE
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
2c8a9dfa 10
3b2942e6
PE
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
2c8a9dfa 15
3b2942e6
PE
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19# 02110-1301, USA.
095a3fb5 20
9abb46d5 21AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
3b2942e6 22AM_CPPFLAGS = -I$(top_srcdir)/lib
9abb46d5 23AM_YFLAGS = "-dv"
2c8a9dfa 24
be14ade5 25LDADD = ../lib/libbison.a $(LIBINTL)
8ebbae2a 26
cd3684cf
AD
27# Use our own Bison to build the parser. Of course, you ought to
28# keep a sane version of Bison nearby...
29YACC = ../tests/bison -y
30
a0f6b076 31bin_PROGRAMS = bison
f0057011 32bin_SCRIPTS = $(YACC_SCRIPT)
a504e06d 33EXTRA_SCRIPTS = yacc
a0f6b076 34
04098407 35bison_SOURCES = \
0c15323d 36 LR0.c LR0.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 \
8efe435c 47 location.c location.h \
0c15323d
AD
48 main.c \
49 muscle_tab.c muscle_tab.h \
50 nullable.c nullable.h \
0c15323d
AD
51 output.c output.h \
52 parse-gram.h parse-gram.y \
53 print.c print.h \
54 print_graph.c print_graph.h \
55 reader.c reader.h \
56 reduce.c reduce.h \
7891a7c4 57 revision.c revision.h \
0e4d5753 58 relation.c relation.h \
e9071366
AD
59 scan-code.h scan-code-c.c \
60 scan-gram.h scan-gram-c.c \
61 scan-skel.h scan-skel-c.c \
0c15323d 62 state.c state.h \
56c47203 63 symlist.c symlist.h \
0c15323d
AD
64 symtab.c symtab.h \
65 system.h \
c6f1a33c 66 tables.h tables.c \
5bf3d7c1 67 uniqstr.c uniqstr.h \
0c15323d
AD
68 vcg.c vcg.h \
69 vcg_defaults.h
a0f6b076 70
e9071366 71EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
2cec9080 72
e9071366
AD
73BUILT_SOURCES = \
74parse-gram.c parse-gram.h \
75revision.c \
76scan-code.c \
77scan-skel.c \
4862bdfd 78scan-gram.c
a67cef01 79
d8388d7a
PE
80MOSTLYCLEANFILES = yacc
81
82yacc:
83 echo '#! /bin/sh' >$@
e9071366 84 echo "exec '$(bindir)/bison' -y \"$$@\"" >>$@
d8388d7a
PE
85 chmod a+x $@
86
0c15323d
AD
87echo:
88 echo $(bison_SOURCES) $(noinst_HEADERS)
04098407 89
7891a7c4
JD
90revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
91 case "$(VERSION)" in \
92 *+*) sed -n \
93 's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
94 $(top_srcdir)/ChangeLog \
95 ;; \
96 *) echo 'const char *revision = "";' \
97 ;; \
98 esac >$@
99
04098407
PE
100# The following rule is not designed to be portable,
101# and relies on tools that not everyone has.
102
103# Most functions in src/*.c should have static scope.
104# Any that don't must be marked with `extern', but `main'
105# and `usage' are exceptions. They're always extern, but
106# don't need to be marked.
107#
108# The second nm|grep checks for file-scope variables with `extern' scope.
109sc_tight_scope: $(all_programs)
110 @t=exceptions-$$$$; \
111 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
112 ( printf '^main$$\n^usage$$\n'; \
113 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
114 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
115 if nm -e *.$(OBJEXT) \
116 | sed -n 's/.* T //p' \
117 | grep -Ev -f $$t; then \
118 echo 'the above functions should have static scope' 1>&2; \
119 exit 1; \
120 fi; \
121 ( printf '^program_name$$\n'; \
122 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
123 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
124 if nm -e *.$(OBJEXT) \
125 | sed -n 's/.* [BD] //p' \
126 | grep -Ev -f $$t; then \
127 echo 'the above variables should have static scope' 1>&2; \
128 exit 1; \
129 fi