[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `make install' and $(BUILT_SOURCES)
From: |
Alexandre Duret-Lutz |
Subject: |
Re: `make install' and $(BUILT_SOURCES) |
Date: |
Sun, 06 Apr 2003 21:25:37 +0200 |
User-agent: |
Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.2 (gnu/linux) |
[sorry for the delay]
>>> "zaufi" == Alexander Turbov <address@hidden> writes:
zaufi> Hi,
zaufi> I found a problem running `make install' in my project.
zaufi> It contain generation of valued file (needed to success
zaufi> compile sources) as BUILT_SOURCES definition. Targes
zaufi> such as `all' and `check' work fine, except `install',
zaufi> becouse it is not depended on $(BUILT_SOURCES).
zaufi> As I can see in generated Makefile there is no way to
zaufi> make $(BUILT_SOURCES) if `make install' running on
zaufi> "clean" source tree (i.e. typing `make install' just
zaufi> after ./configure) So... my suggestion: Why not to
zaufi> change `install' rule like this:
zaufi> install: $(BUILT_SOURCES)
zaufi> $(MAKE) $(AM_MAKEFLAGS) install-recursive
zaufi> such as `all' and `check' defined... ???
Thanks for the suggestion. I'm installing the following on HEAD
and branch-1-7. It will be in Automake 1.7.4.
2003-04-06 Alexandre Duret-Lutz <address@hidden>
* 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.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1440
diff -u -r1.1440 automake.in
--- automake.in 6 Apr 2003 18:31:11 -0000 1.1440
+++ automake.in 6 Apr 2003 19:24:07 -0000
@@ -1571,7 +1571,7 @@
$output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
}
- &handle_installdirs;
+ &handle_install;
&handle_clean;
&handle_factored_dependencies;
@@ -4811,15 +4811,20 @@
$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') || '');
}
Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.329
diff -u -r1.329 automake.texi
--- automake.texi 6 Apr 2003 18:31:11 -0000 1.329
+++ automake.texi 6 Apr 2003 19:24:20 -0000
@@ -3549,10 +3549,11 @@
@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
address@hidden 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
address@hidden 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
@@ -3567,12 +3568,12 @@
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
address@hidden 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.,
address@hidden 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.
@@ -3657,8 +3658,8 @@
@end example
However, as said earlier, @code{BUILT_SOURCES} applies only to the
address@hidden and @code{check} targets. It still fails if you try to run
address@hidden foo} explicitly:
address@hidden, @code{check}, and @code{install} targets. It still fails
+if you try to run @code{make foo} explicitly:
@example
% make clean
Index: lib/am/install.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/install.am,v
retrieving revision 1.10
diff -u -r1.10 install.am
--- lib/am/install.am 8 Jul 2002 19:41:23 -0000 1.10
+++ lib/am/install.am 6 Apr 2003 19:24:20 -0000
@@ -1,5 +1,5 @@
## 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
@@ -36,13 +36,13 @@
.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
Index: tests/check3.test
===================================================================
RCS file: /cvs/automake/automake/tests/check3.test,v
retrieving revision 1.1
diff -u -r1.1 check3.test
--- tests/check3.test 29 Nov 2002 21:53:06 -0000 1.1
+++ tests/check3.test 6 Apr 2003 19:24:20 -0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
#
# This file is part of GNU Automake.
#
@@ -18,7 +18,7 @@
# 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
@@ -48,6 +48,9 @@
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:
@@ -58,7 +61,7 @@
$ACLOCAL
$AUTOCONF
$AUTOMAKE
-./configure
+./configure --prefix `pwd`/inst
$MAKE check >stdout
cat stdout
grep 'PASS: subrun.sh' stdout
@@ -67,3 +70,12 @@
# 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
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: `make install' and $(BUILT_SOURCES),
Alexandre Duret-Lutz <=