my @common_sometimes =
(
'aclocal.m4', 'acconfig.h', 'config.h.top',
- 'config.h.bot', 'stamp-h.in', 'stamp-vti'
+ 'config.h.bot', 'stamp-vti'
);
# Copyright on generated Makefile.ins.
my @distclean_config;
foreach my $spec (@config_headers)
{
- my ($out, @ins) = split_config_file_spec ($spec);
$hdr_index += 1;
- my $header_dir = dirname ($out);
+ # $CONFIG_H_PATH: config.h from top level.
+ my ($config_h_path, @ins) = split_config_file_spec ($spec);
+ my $config_h_dir = dirname ($config_h_path);
# If the header is in the current directory we want to build
# the header here. Otherwise, if we're at the topmost
# directory and the header's directory doesn't have a
# Makefile, then we also want to build the header.
- if ($relative_dir eq $header_dir
- || ($relative_dir eq '.' && ! &is_make_dir ($header_dir)))
+ if ($relative_dir eq $config_h_dir
+ || ($relative_dir eq '.' && ! &is_make_dir ($config_h_dir)))
{
my ($cn_sans_dir, $stamp_dir);
- if ($relative_dir eq $header_dir)
+ if ($relative_dir eq $config_h_dir)
{
- $cn_sans_dir = basename ($out);
+ $cn_sans_dir = basename ($config_h_path);
$stamp_dir = '';
}
else
{
- $cn_sans_dir = $out;
- if ($header_dir eq '.')
+ $cn_sans_dir = $config_h_path;
+ if ($config_h_dir eq '.')
{
$stamp_dir = '';
}
else
{
- $stamp_dir = $header_dir . '/';
+ $stamp_dir = $config_h_dir . '/';
}
}
# Header defined and in this directory.
my @files;
- if (-f $out . '.top')
+ if (-f $config_h_path . '.top')
{
push (@files, "$cn_sans_dir.top");
}
- if (-f $out . '.bot')
+ if (-f $config_h_path . '.bot')
{
push (@files, "$cn_sans_dir.bot");
}
push (@files, '$(top_srcdir)/acconfig.h');
}
- my $stamp_name = "stamp-h$hdr_index";
- my $out_dir = dirname ($in0_sans_dir);
-
+ my $stamp = "${stamp_dir}stamp-h${hdr_index}";
$output_rules .=
file_contents ('remake-hdr',
- ('FILES' => "@files",
- 'CONFIG_HEADER' => $cn_sans_dir,
- 'CONFIG_HEADER_IN' => $in0_sans_dir,
- 'CONFIG_HEADER_FULL' => $out,
- 'STAMP' => "$stamp_dir$stamp_name",
- 'SRC_STAMP' => "$out_dir/$stamp_name"));
-
- create ("$relative_dir/$out_dir/$stamp_name.in");
- require_file ($config_header_location, $FOREIGN,
- "$out_dir/$stamp_name.in");
+ ('FILES' => "@files",
+ 'CONFIG_H' => $cn_sans_dir,
+ 'CONFIG_HIN' => $in0_sans_dir,
+ 'CONFIG_H_PATH' => $config_h_path,
+ 'STAMP' => "$stamp"));
push @distclean_config, $cn_sans_dir;
}
## Explicitly look in srcdir for benefit of non-GNU makes.
-%CONFIG_HEADER%: %STAMP%
+%CONFIG_H%: %STAMP%
## Recover from removal of CONFIG_HEADER
@if test ! -f $@; then \
rm -f %STAMP%; \
else :; fi
-%STAMP%: $(srcdir)/%CONFIG_HEADER_IN% $(top_builddir)/config.status
+%STAMP%: $(srcdir)/%CONFIG_HIN% $(top_builddir)/config.status
@rm -f %STAMP%
- cd $(top_builddir) && $(SHELL) ./config.status %CONFIG_HEADER_FULL%
+ cd $(top_builddir) && $(SHELL) ./config.status %CONFIG_H_PATH%
-## SRC_STAMP takes into account a possible subdir where CONFIG_HEADER_IN is
-$(srcdir)/%CONFIG_HEADER_IN%: %MAINTAINER-MODE% $(srcdir)/%SRC_STAMP%.in
-## Recover from removal of CONFIG_HEADER_IN
- @if test ! -f $@; then \
- rm -f $(srcdir)/%SRC_STAMP%.in; \
- $(MAKE) $(srcdir)/%SRC_STAMP%.in; \
- else :; fi
-
-
-$(srcdir)/%SRC_STAMP%.in: $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %FILES%
- @rm -f $(srcdir)/%SRC_STAMP%.in $(srcdir)/%SRC_STAMP%.inT
-## We used to try to get a real timestamp here. But the fear is that
-## that will cause unnecessary cvs conflicts
- @echo timestamp > $(srcdir)/%SRC_STAMP%.inT 2> /dev/null
+$(srcdir)/%CONFIG_HIN%: %MAINTAINER-MODE% $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %FILES%
cd $(top_srcdir) && $(AUTOHEADER)
-## Creating the timestamp first, and moving it later, helps ensure that
-## it will be older than the header file, avoiding needless triggering
-## of the rebuild rule.
- @mv $(srcdir)/%SRC_STAMP%.inT $(srcdir)/%SRC_STAMP%.in
+## Autoheader has the bad habit of not changing the time stamp if
+## config.hin is unchanged, which breaks Make targets. Since what
+## must not changed gratuitiously is config.h, which is already handled
+## by config.status, there is no reason to make things complex for
+## config.hin.
+ touch $(srcdir)/%CONFIG_HIN%