(handle_install): ... this. Define maybe_BUILT_SOURCES.
(generate_makefile): Adjust call to handle_install.
* lib/am/install.am (install): Use %maybe_BUILT_SOURCES%.
* automake.texi (Sources, Built sources example): BUILT_SOURCES
is honored by `make install' too.
* tests/check3.test: Make sure that `make install' also depends
upon BUILT_SOURCES.
Report from Alexander Turbov.
2003-04-06 Alexandre Duret-Lutz <adl@gnu.org>
+ * automake.in (handle_installdirs): Rename as ...
+ (handle_install): ... this. Define maybe_BUILT_SOURCES.
+ (generate_makefile): Adjust call to handle_install.
+ * lib/am/install.am (install): Use %maybe_BUILT_SOURCES%.
+ * automake.texi (Sources, Built sources example): BUILT_SOURCES
+ is honored by `make install' too.
+ * tests/check3.test: Make sure that `make install' also depends
+ upon BUILT_SOURCES.
+ Report from Alexander Turbov.
+
* lib/am/libs.am (ARFLAGS): Define.
* automake.in (handle_libraries): Use `$(ARFLAGS)' instead of
hard-coding `cru'.
$output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
}
- &handle_installdirs;
+ &handle_install;
&handle_clean;
&handle_factored_dependencies;
$output_trailer .= file_contents ('footer', new Automake::Location);
}
-# Deal with installdirs target.
-sub handle_installdirs ()
+
+# Generate `make install' rules.
+sub handle_install ()
{
$output_rules .= &file_contents
('install',
new Automake::Location,
- am__installdirs => variable_value ('am__installdirs') || '',
+ maybe_BUILT_SOURCES => (variable_defined ('BUILT_SOURCES')
+ ? (" \$(BUILT_SOURCES)\n"
+ . "\t\$(MAKE) \$(AM_MAKEFLAGS)")
+ : ''),
'installdirs-local' => (target_defined ('installdirs-local')
- ? ' installdirs-local' : ''));
+ ? ' installdirs-local' : ''),
+ am__installdirs => variable_value ('am__installdirs') || '');
}
@cindex BUILT_SOURCES, defined
The @code{BUILT_SOURCES} variable is a workaround for this problem. A
-source file listed in @code{BUILT_SOURCES} is made on @code{make all} or
-@code{make check} before other targets are processed. However, such a
-source file is not @emph{compiled} unless explicitly requested by
-mentioning it in some other @samp{_SOURCES} variable.
+source file listed in @code{BUILT_SOURCES} is made on @code{make all}
+or @code{make check} (or even @code{make install}) before other
+targets are processed. However, such a source file is not
+@emph{compiled} unless explicitly requested by mentioning it in some
+other @samp{_SOURCES} variable.
So, to conclude our introductory example, we could use
@code{BUILT_SOURCES = foo.h} to ensure @file{foo.h} gets built before
another source), because it's a known dependency of the associated
object.
-It might be important to emphasize that @code{BUILT_SOURCES} is honored
-only by @code{make all} and @code{make check}. This means you cannot
-build a specific target (e.g., @code{make foo}) in a clean tree if it
-depends on a built source. However it will succeed if you have run
-@code{make all} earlier, because accurate dependencies are already
-available.
+It might be important to emphasize that @code{BUILT_SOURCES} is
+honored only by @code{make all}, @code{make check} and @code{make
+install}. This means you cannot build a specific target (e.g.,
+@code{make foo}) in a clean tree if it depends on a built source.
+However it will succeed if you have run @code{make all} earlier,
+because accurate dependencies are already available.
The next section illustrates and discusses the handling of built sources
on a toy example.
@end example
However, as said earlier, @code{BUILT_SOURCES} applies only to the
-@code{all} and @code{check} targets. It still fails if you try to run
-@code{make foo} explicitly:
+@code{all}, @code{check}, and @code{install} targets. It still fails
+if you try to run @code{make foo} explicitly:
@example
% make clean
## automake - create Makefile.in from Makefile.am
-## Copyright 2001 Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
.PHONY: install install-exec install-data uninstall
?SUBDIRS?.PHONY: install-recursive install-exec-recursive install-data-recursive uninstall-recursive
-?SUBDIRS?install: install-recursive
+?SUBDIRS?install:%maybe_BUILT_SOURCES% install-recursive
?SUBDIRS?install-exec: install-exec-recursive
?SUBDIRS?install-data: install-data-recursive
?SUBDIRS?uninstall: uninstall-recursive
.PHONY: install-exec-am install-data-am uninstall-am
-?!SUBDIRS?install: install-am
+?!SUBDIRS?install:%maybe_BUILT_SOURCES% install-am
?!SUBDIRS?install-exec: install-exec-am
?!SUBDIRS?install-data: install-data-am
?!SUBDIRS?uninstall: uninstall-am
#! /bin/sh
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-# Make sure `check:' honors $(BUILT_SOURCES).
+# Make sure `check:' and `install:' honor $(BUILT_SOURCES).
# PR/359.
. ./defs || exit 1
BUILT_SOURCES = command2.inc
check_SCRIPTS = echo.sh
echo.sh:
+## The next line ensures that command1.inc has been built before
+## recurring into the subdir.
+ test -f ../command1.inc
(echo '#! /bin/sh'; cat command2.inc) > $@
chmod +x $@
command2.inc:
$ACLOCAL
$AUTOCONF
$AUTOMAKE
-./configure
+./configure --prefix `pwd`/inst
$MAKE check >stdout
cat stdout
grep 'PASS: subrun.sh' stdout
# in check.test and check2.test).
$FGREP 'check: $(BUILT_SOURCES)' Makefile.in
$FGREP 'check: $(BUILT_SOURCES)' dir/Makefile.in
+
+$MAKE clean
+# Sanity checks
+test ! -f command1.inc
+test ! -f dir/command2.inc
+# Now make sure these two files are rebuilt during make install.
+$MAKE install
+test -f command1.inc
+test -f dir/command2.inc