built-sources-subdir.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #! /bin/sh
  2. # Copyright (C) 2001-2017 Free Software Foundation, Inc.
  3. #
  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.
  8. #
  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.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Make sure when using SUBDIRS that all BUILT_SOURCES are built.
  17. # A bug occurred where subdirs do not have all-recursive or
  18. # all-recursive-am which depended on BUILT_SOURCES.
  19. required=cc
  20. . test-init.sh
  21. mkdir lib
  22. cat >> configure.ac << 'END'
  23. AC_CONFIG_FILES([lib/Makefile])
  24. AC_PROG_RANLIB
  25. AC_PROG_CC
  26. AM_PROG_AR
  27. AC_OUTPUT
  28. END
  29. cat > Makefile.am << 'END'
  30. SUBDIRS = lib
  31. END
  32. cat > lib/Makefile.am << 'END'
  33. pkgdata_DATA =
  34. noinst_LIBRARIES = libfoo.a
  35. libfoo_a_SOURCES = foo.c
  36. BUILT_SOURCES = foo.h
  37. foo.h:
  38. echo \#define FOO_DEFINE 1 >$@
  39. CLEANFILES = $(BUILT_SOURCES)
  40. END
  41. cat > lib/foo.c << 'END'
  42. #include <foo.h>
  43. int foo (void) { return !FOO_DEFINE; }
  44. END
  45. $ACLOCAL
  46. $AUTOCONF
  47. $AUTOMAKE --copy --add-missing
  48. ./configure
  49. $MAKE
  50. $MAKE distcheck
  51. :