Makefile.am 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. ## Make Autoconf tests.
  2. # Copyright (C) 2000-2012 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 3 of the License, or
  6. # (at your option) 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 don't actually distribute the built testsuite or package.m4, since one
  14. # only needs m4 to build them, and m4 is required to install Autoconf.
  15. # But if you are borrowing from this file for setting up autotest in your
  16. # project, remember to distribute both testsuite and package.m4.
  17. EXTRA_DIST = $(TESTSUITE_AT) local.at mktests.sh \
  18. atlocal.in wrapper.as statesave.m4
  19. # Running the uninstalled scripts. Build them upon `all', for the manpages.
  20. noinst_SCRIPTS = $(wrappers)
  21. DISTCLEANFILES = atconfig atlocal $(TESTSUITE)
  22. MAINTAINERCLEANFILES = Makefile.in
  23. # Import the dependencies on Autotest and M4sh.
  24. include ../lib/freeze.mk
  25. ## ------------ ##
  26. ## package.m4. ##
  27. ## ------------ ##
  28. # The `:;' works around a redirected compound command bash exit status bug.
  29. package.m4: Makefile
  30. :;{ \
  31. echo '# Signature of the current package.' && \
  32. echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
  33. echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
  34. echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
  35. echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
  36. echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
  37. echo 'm4_define([AT_PACKAGE_URL], [$(PACKAGE_URL)])'; \
  38. } > $@-t
  39. mv $@-t $@
  40. ## ---------- ##
  41. ## Wrappers. ##
  42. ## ---------- ##
  43. wrappers = autoconf autoheader autom4te autoreconf autoscan autoupdate ifnames
  44. CLEANFILES = wrapper.in $(wrappers) package.m4
  45. wrapper.in: $(srcdir)/wrapper.as $(m4sh_m4f_dependencies)
  46. $(MY_AUTOM4TE) --language=M4sh $(srcdir)/wrapper.as -o $@
  47. edit = sed \
  48. -e 's|@wrap_program[@]|$@|g' \
  49. -e 's|@abs_top_srcdir[@]|@abs_top_srcdir@|g' \
  50. -e 's|@abs_top_builddir[@]|@abs_top_builddir@|g' \
  51. -e "s|@configure_input[@]|Generated from $$input.|g"
  52. $(wrappers): wrapper.in
  53. rm -f $@ $@.tmp
  54. input=wrapper.in; \
  55. $(edit) wrapper.in >$@.tmp
  56. chmod +x $@.tmp
  57. chmod a-w $@.tmp
  58. mv -f $@.tmp $@
  59. ## ------------ ##
  60. ## Test suite. ##
  61. ## ------------ ##
  62. TESTSUITE_GENERATED_AT = \
  63. $(srcdir)/aclang.at \
  64. $(srcdir)/acc.at \
  65. $(srcdir)/acfortran.at \
  66. $(srcdir)/acgo.at \
  67. $(srcdir)/acgeneral.at \
  68. $(srcdir)/acstatus.at \
  69. $(srcdir)/acautoheader.at \
  70. $(srcdir)/acautoupdate.at \
  71. $(srcdir)/acspecific.at \
  72. $(srcdir)/acfunctions.at \
  73. $(srcdir)/acheaders.at \
  74. $(srcdir)/actypes.at \
  75. $(srcdir)/aclibs.at \
  76. $(srcdir)/acprograms.at
  77. TESTSUITE_HAND_AT = \
  78. suite.at \
  79. m4sugar.at m4sh.at autotest.at \
  80. base.at tools.at torture.at \
  81. compile.at c.at erlang.at fortran.at go.at \
  82. semantics.at \
  83. autoscan.at \
  84. foreign.at
  85. TESTSUITE_AT = $(TESTSUITE_GENERATED_AT) $(TESTSUITE_HAND_AT)
  86. TESTSUITE = ./testsuite
  87. # Run the non installed autom4te.
  88. # Don't use AUTOM4TE since `make alpha' makes it unavailable although
  89. # we are allowed to use it (since we ship it).
  90. AUTOTEST = $(MY_AUTOM4TE) --language=autotest
  91. $(TESTSUITE): package.m4 \
  92. local.at \
  93. $(TESTSUITE_AT) \
  94. $(autotest_m4f_dependencies)
  95. cd $(top_builddir)/lib/autotest && $(MAKE) $(AM_MAKEFLAGS) autotest.m4f
  96. $(AUTOTEST) -I . -I $(srcdir) suite.at -o $@.tmp
  97. mv $@.tmp $@
  98. atconfig: $(top_builddir)/config.status
  99. cd $(top_builddir) && ./config.status tests/$@
  100. # Avoid a race condition that would make parallel "distclean" fail.
  101. # The rule in clean-local tests for existence of $(TESTSUITE), and
  102. # if found, attempts to run it. But the distclean-generic rule may
  103. # be running in parallel, and it removes $(DISTCLEANFILES) which
  104. # includes $(TESTSUITE). This is the Automake rule, plus our
  105. # dependency, and we silence the warning from 'automake -Wall' by
  106. # hiding the dependency behind a variable.
  107. # TODO - fix this if newer automake accommodates the dependency.
  108. distclean_generic = distclean-generic
  109. $(distclean_generic): clean-local
  110. clean-local:
  111. test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
  112. rm -f *.tmp
  113. rm -f -r autom4te.cache
  114. check-local: atconfig atlocal $(TESTSUITE)
  115. $(SHELL) $(TESTSUITE) $(TESTSUITEFLAGS)
  116. # Run the test suite on the *installed* tree.
  117. installcheck-local: atconfig atlocal $(TESTSUITE)
  118. $(SHELL) $(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
  119. ## ------------------ ##
  120. ## Maintainer rules. ##
  121. ## ------------------ ##
  122. MAINTAINERCLEANFILES += $(TESTSUITE_GENERATED_AT)
  123. ## Producing the test files.
  124. # The files which contain macros we check for syntax. Use $(top_srcdir)
  125. # for the benefit of non-GNU make. Fix the names in the rule below
  126. # where we `cd' to $srcdir.
  127. autoconfdir = $(top_srcdir)/lib/autoconf
  128. AUTOCONF_FILES = $(autoconfdir)/general.m4 \
  129. $(autoconfdir)/status.m4 \
  130. $(autoconfdir)/autoheader.m4 \
  131. $(autoconfdir)/autoupdate.m4 \
  132. $(autoconfdir)/specific.m4 \
  133. $(autoconfdir)/functions.m4 \
  134. $(autoconfdir)/lang.m4 \
  135. $(autoconfdir)/c.m4 \
  136. $(autoconfdir)/erlang.m4 \
  137. $(autoconfdir)/fortran.m4 \
  138. $(autoconfdir)/go.m4 \
  139. $(autoconfdir)/headers.m4 \
  140. $(autoconfdir)/libs.m4 \
  141. $(autoconfdir)/types.m4 \
  142. $(autoconfdir)/programs.m4
  143. $(TESTSUITE_GENERATED_AT): mktests.stamp
  144. ## Recover from the removal of $@
  145. @if test -f $@; then :; else \
  146. rm -f mktests.stamp; \
  147. $(MAKE) $(AM_MAKEFLAGS) mktests.stamp; \
  148. fi
  149. mktests.stamp : mktests.sh $(AUTOCONF_FILES)
  150. @rm -f mktests.tmp
  151. @touch mktests.tmp
  152. cd $(srcdir) && ./mktests.sh \
  153. `echo " "$(AUTOCONF_FILES) | sed 's, [^ ]*/, ../lib/autoconf/,g'`
  154. @mv -f mktests.tmp $@
  155. ## Distribute the stamp file, since we distribute the generated files.
  156. EXTRA_DIST += mktests.stamp
  157. CLEANFILES += mktests.tmp
  158. MAINTAINERCLEANFILES += mktests.stamp
  159. ## maintainer-check ##
  160. # These cannot be run in parallel.
  161. maintainer-check:
  162. $(MAKE) $(AM_MAKEFLAGS) maintainer-check-posix
  163. $(MAKE) $(AM_MAKEFLAGS) maintainer-check-c++
  164. # The hairy heredoc is more robust than using echo.
  165. CLEANFILES += expr
  166. expr:
  167. :;{ \
  168. echo '#! $(SHELL)'; \
  169. echo 'result=`$(EXPR) "$$@"`'; \
  170. echo 'estatus=$$?'; \
  171. echo 'cat <<EOF'; \
  172. echo '$${result:-0}'; \
  173. echo 'EOF'; \
  174. echo 'exit $$estatus'; \
  175. } > $@-t
  176. chmod +x $@-t
  177. mv $@-t $@
  178. # Try the test suite with more severe environments.
  179. maintainer-check-posix: expr
  180. POSIXLY_CORRECT=yes $(MAKE) $(AM_MAKEFLAGS) check
  181. rm expr
  182. # Try using G++ as a C compiler.
  183. maintainer-check-c++:
  184. CC=g++ $(MAKE) $(AM_MAKEFLAGS) check