yacc.am 2.3 KB

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