glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace
[bison.git] / examples / c / reccalc / local.mk
blobc38dcbe016dda64ad8a1aae308cec9752622ca97
1 ## Copyright (C) 2019-2021 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 3 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.
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program. If not, see <https://www.gnu.org/licenses/>.
16 reccalcdir = $(docdir)/%D%
18 ## --------- ##
19 ## RecCalc. ##
20 ## --------- ##
22 if FLEX_WORKS
23 check_PROGRAMS += %D%/reccalc
24 TESTS += %D%/reccalc.test
25 nodist_%C%_reccalc_SOURCES = %D%/parse.y %D%/scan.h %D%/scan.c
26 BUILT_SOURCES += $(nodist_%C%_reccalc_SOURCES)
27 # Don't use gnulib's system headers.
28 %C%_reccalc_CPPFLAGS = -I$(top_srcdir)/%D% -I$(top_builddir)/%D%
29 # Fighting warnings triggered by Flex is just too painful.
30 # %C%_reccalc_CFLAGS = $(TEST_CFLAGS)
31 endif FLEX_WORKS
33 %D%/parse.c: $(dependencies)
35 # Tell Make that parse.o depends on scan.h, so that scan.h is built
36 # before parse.o. Obfuscate the name of the target, otherwise
37 # Automake removes its recipe for parse.o and leaves only our
38 # additional dependency.
39 DASH = -
40 %D%/reccalc$(DASH)parse.o: %D%/scan.h
41 # Tell Make scan.o depends on parse.h, except that Make sees only
42 # parse.c, not parse.h. We can't use BUILT_SOURCES to this end, since
43 # we use the built bison.
44 %D%/reccalc$(DASH)scan.o: %D%/parse.c
46 # Likewise, but for Automake before 1.16.
47 %D%/examples_c_reccalc_reccalc$(DASH)parse.o: %D%/scan.h
48 %D%/examples_c_reccalc_reccalc$(DASH)scan.o: %D%/parse.c
50 ## See "info automake 'Multiple Outputs'" for this rule.
51 %D%/scan.c %D%/scan.h: %D%/scan.stamp
52 ## Recover from the removal of $@
53 @if test -f $@; then :; else \
54 trap 'rm -rf %D%/scan.lock %D%/scan.stamp' 1 2 13 15; \
55 ## mkdir is a portable test-and-set
56 if mkdir %D%/scan.lock 2>/dev/null; then \
57 ## This code is being executed by the first process.
58 rm -f %D%/scan.stamp; \
59 $(MAKE) $(AM_MAKEFLAGS) %D%/scan.stamp; \
60 result=$$?; rm -rf %D%/scan.lock; exit $$result; \
61 else \
62 ## This code is being executed by the follower processes.
63 ## Wait until the first process is done.
64 while test -d %D%/scan.lock; do sleep 1; done; \
65 ## Succeed if and only if the first process succeeded.
66 test -f %D%/scan.stamp; \
67 fi; \
70 %D%/scan.stamp: %D%/scan.l
71 $(AM_V_LEX)rm -f $@ $@.tmp
72 $(AM_V_at)$(MKDIR_P) %D%
73 $(AM_V_at)touch $@.tmp
74 ## --header introduced in 2.5.6, renamed as --header-file in 2.6.4.
75 ## Backward compatibility ensured since --header is an unambiguous prefix.
76 $(AM_V_at)$(LEX) $(AM_LFLAGS) $(LFLAGS) -o%D%/scan.c --header=%D%/scan.h $(srcdir)/%D%/scan.l
77 $(AM_V_at)mv $@.tmp $@
80 EXTRA_DIST += %D%/reccalc.test %D%/scan.l
81 dist_reccalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md
82 CLEANFILES += %D%/parse.[ch] %D%/parse.output %D%/scan.[ch] %D%/*.stamp
83 CLEANDIRS += %D%/*.dSYM