Merge branch 'minor'
[automake.git] / lib / am / yacc.am
blob28f05d2deb56babaf6a99e5dcfd9be55d292f3ed
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1998-2017 Free Software Foundation, Inc.
4 ## This program is free software; you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation; either version 2, or (at your option)
7 ## any later version.
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 ## We want to disable the Yacc rebuild rule when
18 ##   1. AM_MAINTAINER_MODE is used, and
19 ##   2. --enable-maintainer-mode is not specified, and
20 ##   3. parser.c already exist, and
21 ##   4. parser.y and parser.c are distributed.
22 ## Point #3 is because "make maintainer-clean" erases parser.c, yet
23 ## the GNU Coding Standards require that ./configure; make works even
24 ## after that.
25 ## Point #4 is because parsers listed in nodist_*_SOURCES are always
26 ## built on the user's side, so it makes no sense to disable them.
28 ## Points #1, #2, #3 are solved by unconditionally prefixing the rule
29 ## with $(am__skipyacc) defined below only when needed.
31 ## Point #4 requires a condition on whether parser.y/parser.c are
32 ## distributed or not.  We cannot have a generic rule that works in
33 ## both cases, so we ensure in automake that nodist_ parsers always
34 ## use non-generic rules.
35 if %?FIRST%
36 if %?MAINTAINER-MODE%
37 @MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
38 endif %?MAINTAINER-MODE%
39 ## The 's/c$/h/' substitution *must* be the last one.
40 am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
41                    -e s/c++$$/h++/ -e s/c$$/h/
42 endif %?FIRST%
44 ?GENERIC?%EXT%%DERIVED-EXT%:
45 ?!GENERIC?%OBJ%: %SOURCE%
46 ?GENERIC?       %VERBOSE%$(am__skipyacc) $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h `echo %OBJ% | $(am__yacc_c2h)` y.output %BASE%.output -- %COMPILE%
47 ?!GENERIC?      %VERBOSE% \
48 ?!GENERIC??DIST_SOURCE? $(am__skipyacc) \
49 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
50 ?!GENERIC?      $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h `echo %OBJ% | $(am__yacc_c2h)` y.output %BASE%.output -- %COMPILE%