]> git.saurik.com Git - bison.git/blob - src/Makefile.am
Between Bison releases, manually append `+' to the previous Bison
[bison.git] / src / Makefile.am
1 ## Copyright (C) 2001, 2002, 2003, 2004, 2005 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
18 DEFS += -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(datadir)/locale\"
19
20 AM_CFLAGS = $(WARNING_CFLAGS) $(WERROR_CFLAGS)
21 AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib
22 AM_YFLAGS = "-dv"
23
24 LDADD = ../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...
28 YACC = ../tests/bison -y
29
30 bin_PROGRAMS = bison
31 bin_SCRIPTS = $(YACC_SCRIPT)
32 EXTRA_SCRIPTS = yacc
33
34 bison_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 getargs.c getargs.h \
43 gram.c gram.h \
44 lalr.h lalr.c \
45 location.c location.h \
46 main.c \
47 muscle_tab.c muscle_tab.h \
48 nullable.c nullable.h \
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 \
55 revision.c revision.h \
56 relation.c relation.h \
57 scan-gram-c.c \
58 scan-skel-c.c scan-skel.h \
59 state.c state.h \
60 symlist.c symlist.h \
61 symtab.c symtab.h \
62 system.h \
63 tables.h tables.c \
64 uniqstr.c uniqstr.h \
65 vcg.c vcg.h \
66 vcg_defaults.h
67
68 EXTRA_bison_SOURCES = scan-skel.l scan-gram.l
69
70 BUILT_SOURCES = revision.c scan-skel.c scan-gram.c parse-gram.c parse-gram.h
71
72 MOSTLYCLEANFILES = yacc
73
74 yacc:
75 echo '#! /bin/sh' >$@
76 echo 'exec $(bindir)/bison -y "$$@"' >>$@
77 chmod a+x $@
78
79 echo:
80 echo $(bison_SOURCES) $(noinst_HEADERS)
81
82 revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
83 case "$(VERSION)" in \
84 *+*) sed -n \
85 's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
86 $(top_srcdir)/ChangeLog \
87 ;; \
88 *) echo 'const char *revision = "";' \
89 ;; \
90 esac >$@
91
92 # The following rule is not designed to be portable,
93 # and relies on tools that not everyone has.
94
95 # Most functions in src/*.c should have static scope.
96 # Any that don't must be marked with `extern', but `main'
97 # and `usage' are exceptions. They're always extern, but
98 # don't need to be marked.
99 #
100 # The second nm|grep checks for file-scope variables with `extern' scope.
101 sc_tight_scope: $(all_programs)
102 @t=exceptions-$$$$; \
103 trap 's=$$?; rm -f $$t; exit $$s' 0 1 2 13 15; \
104 ( printf '^main$$\n^usage$$\n'; \
105 grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
106 | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
107 if nm -e *.$(OBJEXT) \
108 | sed -n 's/.* T //p' \
109 | grep -Ev -f $$t; then \
110 echo 'the above functions should have static scope' 1>&2; \
111 exit 1; \
112 fi; \
113 ( printf '^program_name$$\n'; \
114 sed -n 's/^extern .*[* ]\([a-zA-Z_][a-zA-Z_0-9]*\);$$/^\1$$/p' \
115 $$(ls $(SOURCES) | grep '\.h$$') /dev/null) > $$t; \
116 if nm -e *.$(OBJEXT) \
117 | sed -n 's/.* [BD] //p' \
118 | grep -Ev -f $$t; then \
119 echo 'the above variables should have static scope' 1>&2; \
120 exit 1; \
121 fi