[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: allow convenient library in subdirectory
From: |
Alexandre Duret-Lutz |
Subject: |
Re: allow convenient library in subdirectory |
Date: |
17 Jul 2001 11:50:44 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
>>> "Tom" == Tom Tromey <address@hidden> writes:
>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
>>> "Tim" == Tim Van Holder <address@hidden> writes:
[...]
adl> Allow libraries to lie in a subdirectory
[...]
Tom> Note that actually doing this might not work yet.
Tom> Nothing ensures that the build directory will be created.
Yes, I discovered this while running `make distcheck', and my
workaround was to use subdir-objects (so that the directory
would already exists at $(AR) time). Hence the other report about
subdir-objects :).
Tom> This is an infrastructural thing we need to work out in a uniform
Tom> way (we handle it in an ad hoc way in a couple places already)
I found this in handle_single_transform_list, but nowhere else,
maybe I missed something. Anyway, with the patch included
below, I was able to distcheck my project without using
subdir-objects.
Index: ChangeLog
from Alexandre Duret-Lutz <address@hidden>
* automake.in (require_build_directory): New function, extracted
from ...
(handle_single_transform_list): ... here.
(handle_libraries): Use basename to check library name. Make the
library dependent on $dirname/.dirstamp in case it lies in $dirname.
* lib/am/library.am (%LIBRARY%): Depend on %XLIBRARY_DIRSTAMP%.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1154
diff -u -r1.1154 automake.in
--- automake.in 2001/07/17 05:53:47 1.1154
+++ automake.in 2001/07/17 09:23:23
@@ -2011,24 +2011,7 @@
push (@dep_list, '.deps/' . $directory . '/.dirstamp');
}
- if (! defined $directory_map{$directory})
- {
- $directory_map{$directory} = 1;
-
- # Directory must be removed by `make distclean'.
- $compile_clean_files{$directory . "/.dirstamp"} =
- $DIST_CLEAN;
- $output_rules .= ($directory . "/.dirstamp:\n"
- . "address@hidden(mkinstalldirs)
$directory\n"
- . "\t\@: > $directory/.dirstamp\n");
- if ($use_dependencies)
- {
- $output_rules .= ('.deps/' . $directory
- . "/.dirstamp:\n"
- . "address@hidden(mkinstalldirs)
.deps/$directory\n"
- . "\t\@: >
.deps/$directory/.dirstamp\n");
- }
- }
+ &require_build_directory ($directory);
}
&pretty_print_rule ($object . ':', "\t", @dep_list)
@@ -2539,7 +2522,7 @@
foreach my $onelib (@liblist)
{
# Check that the library fits the standard naming convention.
- if ($onelib !~ m%^(?:.*/)?lib[^/]*\.a$%)
+ if (basename ($onelib) !~ /^lib.*\.a/)
{
# FIXME should put line number here. That means mapping
# from library name back to variable name.
@@ -2584,9 +2567,20 @@
&handle_source_transform ($xlib, $onelib, $obj);
+ # If the resulting library lies into a subdirectory,
+ # make sure this directory exists.
+ my $dirstamp = '';
+ my $dirname = dirname ($onelib);
+ if ($dirname ne '.')
+ {
+ &require_build_directory ($dirname);
+ $dirstamp = "$dirname/.dirstamp"
+ }
+
$output_rules .= &file_contents ('library',
('LIBRARY' => $onelib,
- 'XLIBRARY' => $xlib));
+ 'XLIBRARY' => $xlib,
+ 'XLIBRARY_DIRSTAMP' => $dirstamp));
}
if ($seen_libobjs)
@@ -7642,6 +7636,37 @@
@config_aux_path = @require_file_paths;
# avoid unsightly '/.'s.
$config_aux_dir = '$(top_srcdir)' . ($dir eq '.' ? "" : "/$dir");
+}
+
+################################################################
+
+# &require_build_directory($DIRECTORY)
+# ------------------------------------
+# Emit rules to create $DIRECTORY and .deps/$DIRECTORY on demand.
+# Targets requiring these directories will just have to be made dependent
+# on $DIRECTORY/.dirstamp and/or .deps/$DIRECTORY/.dirstamp.
+sub require_build_directory
+{
+ my $directory = shift;
+
+ if (! defined $directory_map{$directory})
+ {
+ $directory_map{$directory} = 1;
+
+ # Directory must be removed by `make distclean'.
+ $compile_clean_files{$directory . "/.dirstamp"} =
+ $DIST_CLEAN;
+ $output_rules .= ($directory . "/.dirstamp:\n"
+ . "address@hidden(mkinstalldirs) $directory\n"
+ . "\t\@: > $directory/.dirstamp\n");
+ if ($use_dependencies)
+ {
+ $output_rules .= ('.deps/' . $directory
+ . "/.dirstamp:\n"
+ . "address@hidden(mkinstalldirs)
.deps/$directory\n"
+ . "\t\@: > .deps/$directory/.dirstamp\n");
+ }
+ }
}
################################################################
Index: lib/am/library.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/library.am,v
retrieving revision 1.13
diff -u -r1.13 library.am
--- lib/am/library.am 2001/02/27 09:12:42 1.13
+++ lib/am/library.am 2001/07/17 09:23:23
@@ -15,7 +15,7 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-%LIBRARY%: $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_DEPENDENCIES)
+%LIBRARY%: $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_DEPENDENCIES) %XLIBRARY_DIRSTAMP%
-rm -f %LIBRARY%
$(%XLIBRARY%_AR) %LIBRARY% $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_LIBADD)
$(RANLIB) %LIBRARY%
--
Alexandre Duret-Lutz
- Re: allow convenient library in subdirectory, (continued)
Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/16
- Re: allow convenient library in subdirectory, Tim Van Holder, 2001/07/17
- Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/17
- Re: allow convenient library in subdirectory, Tim Van Holder, 2001/07/17
- Re: allow convenient library in subdirectory, Tim Van Holder, 2001/07/17
- Re: allow convenient library in subdirectory, Akim Demaille, 2001/07/18
Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/16
- Re: allow convenient library in subdirectory,
Alexandre Duret-Lutz <=
- Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/17
- Re: allow convenient library in subdirectory, Alexandre Duret-Lutz, 2001/07/18
- Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/18
- Re: allow convenient library in subdirectory, Alexandre Duret-Lutz, 2001/07/19
- Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/19
- Re: allow convenient library in subdirectory, Tim Van Holder, 2001/07/19
- Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/19
- Re: allow convenient library in subdirectory, Tim Van Holder, 2001/07/20
- Re: allow convenient library in subdirectory, Tom Tromey, 2001/07/20