1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-2012 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)
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 <http://www.gnu.org/licenses/>.
22 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
23 .PHONY install-%EXEC?exec:data%-am: install-%DIR%PROGRAMS
24 install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
26 test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
27 ## Funny invocation because Makefile variable can be empty, leading to
28 ## a syntax error in sh.
29 @list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
30 for p in $$list; do echo "$$p $$p"; done | \
31 ## On Cygwin with libtool test won't see `foo.exe' but instead `foo'.
32 ## So we check for both.
33 sed 's/$(EXEEXT)$$//' | \
34 while read p p1; do if test -f $$p%LIBTOOL? || test -f $$p1%; \
35 then echo "$$p"; echo "$$p"; else :; fi; \
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' -e '%BASE?s|.*|.|:s|[^/]*$$||; s|^$$|.|%' \
41 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
42 sed 'N;N;N;s,\n, ,g' | \
43 ## The following awk script turns that into one line containing directories
44 ## and then lines of 'type target_name_or_directory sources ...', with type
45 ## 'd' designating directories, and 'f' files.
46 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
47 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
48 if ($$2 == $$4) files[d] = files[d] " " $$1; \
49 else { print "f", $$3 "/" $$4, $$1; } } \
50 END { for (d in files) print "f", d, files[d] }' | \
51 while read type dir files; do \
52 ?!BASE? case $$type in \
53 ?!BASE? d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
54 ?!BASE? $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
56 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
57 test -z "$$files" || { \
58 ?!LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
59 ?!LIBTOOL? $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
60 ## Note that we explicitly set the libtool mode. This avoids any
61 ## lossage if the install program doesn't have a name that libtool
63 ?LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
64 ?LIBTOOL? $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
77 .PHONY uninstall-am: uninstall-%DIR%PROGRAMS
78 uninstall-%DIR%PROGRAMS:
80 @list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
81 files=`for p in $$list; do echo "$$p"; done | \
82 ## Remove any leading directory before applying $(transform),
83 ## but keep the directory part in the hold buffer, in order to
84 ## reapply it again afterwards in the nobase case. Append $(EXEEXT).
85 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
86 -e 's/$$/$(EXEEXT)/'%BASE? : -e 'x;s,[^/]*$$,,;G;s,\n,,'%`; \
87 test -n "$$list" || exit 0; \
88 echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
89 cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files
97 .PHONY clean-am: clean-%DIR%PROGRAMS
99 ?!LIBTOOL? -test -z "$(%DIR%_PROGRAMS)" || rm -f $(%DIR%_PROGRAMS)
100 ## Under Cygwin, we build `program$(EXEEXT)'. However, if this
101 ## program uses a Libtool library, Libtool will move it in
102 ## `_libs/program$(EXEEXT)' and create a `program' wrapper (without
103 ## `$(EXEEXT)'). Therefore, if Libtool is used, we must try to erase
104 ## both `program$(EXEEXT)' and `program'.
105 ## Cleaning the `_libs/' or `.libs/' directory is done from clean-libtool.
106 ## FIXME: In the future (i.e., when it works) it would be nice to delegate
107 ## this task to `libtool --mode=clean'.
108 ?LIBTOOL? @list='$(%DIR%_PROGRAMS)'; test -n "$$list" || exit 0; \
109 ?LIBTOOL? echo " rm -f" $$list; \
110 ?LIBTOOL? rm -f $$list || exit $$?; \
111 ?LIBTOOL? test -n "$(EXEEXT)" || exit 0; \
112 ?LIBTOOL? list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
113 ?LIBTOOL? echo " rm -f" $$list; \
114 ?LIBTOOL? rm -f $$list
122 .PHONY installcheck-am: installcheck-%DIR%PROGRAMS
123 installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
124 bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
125 case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
126 ## Match $(srcdir)/$$p in addition to $$p because Sun make might rewrite
127 ## filenames in AM_INSTALLCHECK_STD_OPTIONS_EXEMPT during VPATH builds.
128 *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
130 ## Strip the directory and $(EXEEXT) before applying $(transform).
132 sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
133 ## Insert the directory back if nobase_ is used.
134 ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
135 for opt in --help --version; do \
136 if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \
137 2>c$${pid}_.err </dev/null \
138 && test -n "`cat c$${pid}_.out`" \
139 && test -z "`cat c$${pid}_.err`"; then :; \
140 else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
142 done; rm -f c$${pid}_.???; exit $$bad