progs.am 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. ## automake - create Makefile.in from Makefile.am
  2. ## Copyright (C) 1994-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. ## ------------ ##
  14. ## Installing. ##
  15. ## ------------ ##
  16. if %?INSTALL%
  17. am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
  18. ?EXEC?.PHONY install-exec-am: install-%DIR%PROGRAMS
  19. ?!EXEC?.PHONY install-data-am: install-%DIR%PROGRAMS
  20. install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
  21. @$(NORMAL_INSTALL)
  22. ## Funny invocation because Makefile variable can be empty, leading to
  23. ## a syntax error in sh.
  24. @list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
  25. if test -n "$$list"; then \
  26. echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
  27. $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
  28. fi; \
  29. for p in $$list; do echo "$$p $$p"; done | \
  30. ## On Cygwin with libtool test won't see 'foo.exe' but instead 'foo'.
  31. ## So we check for both.
  32. sed 's/$(EXEEXT)$$//' | \
  33. while read p p1; do if test -f $$p \
  34. ?LIBTOOL? || test -f $$p1 \
  35. ; then echo "$$p"; echo "$$p"; else :; fi; \
  36. done | \
  37. ## We now have a list of sourcefile pairs, separated by newline.
  38. ## Turn that into "sourcefile source_base target_dir xformed_target_base",
  39. ## with newlines being turned into spaces in a second step.
  40. sed -e 'p;s,.*/,,;n;h' \
  41. ?BASE? -e 's|.*|.|' \
  42. ?!BASE? -e 's|[^/]*$$||; s|^$$|.|' \
  43. -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
  44. sed 'N;N;N;s,\n, ,g' | \
  45. ## The following awk script turns that into one line containing directories
  46. ## and then lines of 'type target_name_or_directory sources ...', with type
  47. ## 'd' designating directories, and 'f' files.
  48. $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
  49. { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
  50. if ($$2 == $$4) files[d] = files[d] " " $$1; \
  51. else { print "f", $$3 "/" $$4, $$1; } } \
  52. END { for (d in files) print "f", d, files[d] }' | \
  53. while read type dir files; do \
  54. ?!BASE? case $$type in \
  55. ?!BASE? d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
  56. ?!BASE? $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
  57. ?!BASE? f) \
  58. if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
  59. test -z "$$files" || { \
  60. ?!LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
  61. ?!LIBTOOL? $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
  62. ## Note that we explicitly set the libtool mode. This avoids any
  63. ## lossage if the install program doesn't have a name that libtool
  64. ## expects.
  65. ?LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
  66. ?LIBTOOL? $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
  67. } \
  68. ?!BASE? ;; esac \
  69. ; done
  70. endif %?INSTALL%
  71. ## -------------- ##
  72. ## Uninstalling. ##
  73. ## -------------- ##
  74. if %?INSTALL%
  75. .PHONY uninstall-am: uninstall-%DIR%PROGRAMS
  76. uninstall-%DIR%PROGRAMS:
  77. @$(NORMAL_UNINSTALL)
  78. @list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
  79. files=`for p in $$list; do echo "$$p"; done | \
  80. ## Remove any leading directory before applying $(transform),
  81. ## but keep the directory part in the hold buffer, in order to
  82. ## reapply it again afterwards in the nobase case. Append $(EXEEXT).
  83. sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
  84. -e 's/$$/$(EXEEXT)/' \
  85. ?!BASE? -e 'x;s,[^/]*$$,,;G;s,\n,,' \
  86. `; \
  87. test -n "$$list" || exit 0; \
  88. echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
  89. cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files
  90. endif %?INSTALL%
  91. ## ---------- ##
  92. ## Cleaning. ##
  93. ## ---------- ##
  94. .PHONY clean-am: clean-%DIR%PROGRAMS
  95. clean-%DIR%PROGRAMS:
  96. ?!LIBTOOL? -test -z "$(%DIR%_PROGRAMS)" || rm -f $(%DIR%_PROGRAMS)
  97. ## Under Cygwin, we build 'program$(EXEEXT)'. However, if this
  98. ## program uses a Libtool library, Libtool will move it in
  99. ## '_libs/program$(EXEEXT)' and create a 'program' wrapper (without
  100. ## '$(EXEEXT)'). Therefore, if Libtool is used, we must try to erase
  101. ## both 'program$(EXEEXT)' and 'program'.
  102. ## Cleaning the '_libs/' or '.libs/' directory is done from clean-libtool.
  103. ## FIXME: In the future (i.e., when it works) it would be nice to delegate
  104. ## this task to "libtool --mode=clean".
  105. ?LIBTOOL? @list='$(%DIR%_PROGRAMS)'; test -n "$$list" || exit 0; \
  106. ?LIBTOOL? echo " rm -f" $$list; \
  107. ?LIBTOOL? rm -f $$list || exit $$?; \
  108. ?LIBTOOL? test -n "$(EXEEXT)" || exit 0; \
  109. ?LIBTOOL? list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
  110. ?LIBTOOL? echo " rm -f" $$list; \
  111. ?LIBTOOL? rm -f $$list
  112. ## ---------- ##
  113. ## Checking. ##
  114. ## ---------- ##
  115. if %?CK-OPTS%
  116. .PHONY installcheck-am: installcheck-%DIR%PROGRAMS
  117. installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
  118. bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
  119. case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
  120. ## Match $(srcdir)/$$p in addition to $$p because Sun make might rewrite
  121. ## filenames in AM_INSTALLCHECK_STD_OPTIONS_EXEMPT during VPATH builds.
  122. *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
  123. esac; \
  124. ## Strip the directory and $(EXEEXT) before applying $(transform).
  125. f=`echo "$$p" | \
  126. sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
  127. ## Insert the directory back if nobase_ is used.
  128. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
  129. for opt in --help --version; do \
  130. if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \
  131. 2>c$${pid}_.err </dev/null \
  132. && test -n "`cat c$${pid}_.out`" \
  133. && test -z "`cat c$${pid}_.err`"; then :; \
  134. else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
  135. done; \
  136. done; rm -f c$${pid}_.???; exit $$bad
  137. endif %?CK-OPTS%