1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004,
3 ## 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
23 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
24 .PHONY install-%EXEC?exec:data%-am: install-%DIR%PROGRAMS
25 install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
27 test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
28 ## Funny invocation because Makefile variable can be empty, leading to
29 ## a syntax error in sh.
30 @list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
31 for p in $$list; do echo "$$p $$p"; done | \
32 ## On Cygwin with libtool test won't see `foo.exe' but instead `foo'.
33 ## So we check for both.
34 sed 's/$(EXEEXT)$$//' | \
35 while read p p1; do if test -f $$p%LIBTOOL? || test -f $$p1%; \
36 then echo "$$p"; echo "$$p"; else :; fi; \
38 ## We now have a list of sourcefile pairs, separated by newline.
39 ## Turn that into "sourcefile source_base target_dir xformed_target_base",
40 ## with newlines being turned into spaces in a second step.
41 sed -e 'p;s,.*/,,;n;h' -e '%BASE?s|.*|.|:s|[^/]*$$||; s|^$$|.|%' \
42 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
43 sed 'N;N;N;s,\n, ,g' | \
44 ## The following awk script turns that into one line containing directories
45 ## and then lines of 'type target_name_or_directory sources...', with type
46 ## 'd' designating directories, and 'f' files.
47 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
48 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
49 if ($$2 == $$4) files[d] = files[d] " " $$1; \
50 else { print "f", $$3 "/" $$4, $$1; } } \
51 END { for (d in files) print "f", d, files[d] }' | \
52 while read type dir files; do \
53 ?!BASE? case $$type in \
54 ?!BASE? d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
55 ?!BASE? $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
57 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
58 test -z "$$files" || { \
59 ?!LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
60 ?!LIBTOOL? $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
61 ## Note that we explicitly set the libtool mode. This avoids any
62 ## lossage if the install program doesn't have a name that libtool
64 ?LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
65 ?LIBTOOL? $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
78 .PHONY uninstall-am: uninstall-%DIR%PROGRAMS
79 uninstall-%DIR%PROGRAMS:
81 @list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
82 files=`for p in $$list; do echo "$$p"; done | \
83 ## Remove any leading directory before applying $(transform),
84 ## but keep the directory part in the hold buffer, in order to
85 ## reapply it again afterwards in the nobase case. Append $(EXEEXT).
86 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
87 -e 's/$$/$(EXEEXT)/'%BASE? : -e 'x;s,[^/]*$$,,;G;s,\n,,'%`; \
88 test -n "$$list" || exit 0; \
89 echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
90 cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files
98 .PHONY clean-am: clean-%DIR%PROGRAMS
100 ?!LIBTOOL? -test -z "$(%DIR%_PROGRAMS)" || rm -f $(%DIR%_PROGRAMS)
101 ## Under Cygwin, we build `program$(EXEEXT)'. However, if this
102 ## program uses a Libtool library, Libtool will move it in
103 ## `_libs/program$(EXEEXT)' and create a `program' wrapper (without
104 ## `$(EXEEXT)'). Therefore, if Libtool is used, we must try to erase
105 ## both `program$(EXEEXT)' and `program'.
106 ## Cleaning the `_libs/' or `.libs/' directory is done from clean-libtool.
107 ## FIXME: In the future (i.e., when it works) it would be nice to delegate
108 ## this task to `libtool --mode=clean'.
109 ?LIBTOOL? @list='$(%DIR%_PROGRAMS)'; test -n "$$list" || exit 0; \
110 ?LIBTOOL? echo " rm -f" $$list; \
111 ?LIBTOOL? rm -f $$list || exit $$?; \
112 ?LIBTOOL? test -n "$(EXEEXT)" || exit 0; \
113 ?LIBTOOL? list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
114 ?LIBTOOL? echo " rm -f" $$list; \
115 ?LIBTOOL? rm -f $$list
123 .PHONY installcheck-am: installcheck-%DIR%PROGRAMS
124 installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
125 bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
126 case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
127 ## Match $(srcdir)/$$p in addition to $$p because Sun make might rewrite
128 ## filenames in AM_INSTALLCHECK_STD_OPTIONS_EXEMPT during VPATH builds.
129 *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
131 ## Strip the directory and $(EXEEXT) before applying $(transform).
133 sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
134 ## Insert the directory back if nobase_ is used.
135 ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
136 for opt in --help --version; do \
137 if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \
138 2>c$${pid}_.err </dev/null \
139 && test -n "`cat c$${pid}_.out`" \
140 && test -z "`cat c$${pid}_.err`"; then :; \
141 else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
143 done; rm -f c$${pid}_.???; exit $$bad