Skip to content
Snippets Groups Projects
Commit 868bef3e authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

build system: Fix some time-stamp issues.

* This should reduce unnecessary recompilations after e.g. re-running
  configure or config.status.
parent fc0eb0f7
No related branches found
No related tags found
No related merge requests found
......@@ -883,6 +883,22 @@ AC_CONFIG_HEADERS([include/config.h])
AC_SUBST([XT_FC_FEATURE_DEFS])
AM_SUBST_NOTMAKE([XT_FC_FEATURE_DEFS])
AC_CONFIG_FILES([include/fc_feature_defs.inc])
m4_pushdef([_AC_OUTPUT_FILE],
m4_bpatsubst(m4_dquote(m4_defn([_AC_OUTPUT_FILE])),
[ case \$ac_file in
-. cat "\$ac_tmp/out" && rm -f "\$ac_tmp/out";;
\*. rm -f "\$ac_file" && mv "\$ac_tmp/out" "\$ac_file";;
esac],[ case $ac_file in
-\) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
include/fc_feature_defs.inc\)
if diff "$ac_file" "$ac_tmp/out" >/dev/null 2>&1; then
echo "$ac_file is unchanged"
else
rm -f "$ac_file"; mv "$ac_tmp/out" "$ac_file"
fi
;;
*\) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac]))
AC_CONFIG_FILES([ \
perf/perf_idxsection_get_positions_of_indices_run \
......@@ -931,7 +947,8 @@ AC_CONFIG_FILES([ \
examples/tr_gp2fs_run \
examples/unstruct_halo_exchange_run \
util/serialrun],[chmod a+x "$ac_file"])
AC_CONFIG_FILES([Makefile src/Makefile src/mpi-workarounds/Makefile tests/Makefile examples/Makefile \
AC_CONFIG_FILES([Makefile src/Makefile src/mpi-workarounds/Makefile \
tests/Makefile examples/Makefile \
inst_headers/Makefile inst_headers/f90/Makefile \
src/pkgconfig/yaxt.pc src/pkgconfig/yaxt_c.pc perf/Makefile])
# edit out the am--include-marker that's required for automake 1.16
......
......@@ -47,11 +47,12 @@ nodist_include_HEADERS = yaxt.h
SUBDIRS = . f90
DIST_SUBDIRS = f90 .
../src/xtinclude_Makefile.inc:
(cd ../src ; if test -r Makefile ; then \
$(MAKE) xtinclude_Makefile.inc ; fi)
libyaxt_c_srcdir = ../src
$(libyaxt_c_srcdir)/xtinclude_Makefile.inc:
cd $(libyaxt_c_srcdir) ; if test -r Makefile ; then \
exec $(MAKE) xtinclude_Makefile.inc ; fi
@am__include@ @am__quote@../src/xtinclude_Makefile.inc@am__quote@ # am--include-marker
@am__include@ @am__quote@$(libyaxt_c_srcdir)/xtinclude_Makefile.inc@am__quote@ # am--include-marker
yaxt.h: Makefile $(xtinclude_HEADERS)
$(AM_V_GEN)( echo '/* license */' ; echo '#ifndef YAXT_H' ; echo '#define YAXT_H' ; \
......@@ -65,19 +66,19 @@ yaxt.h: Makefile $(xtinclude_HEADERS)
xt/.dir_stamp:
$(AM_V_GEN)$(MKDIR_P) xt && touch xt/.dir_stamp
$(xtinclude_HEADERS): ../src/$@ ../include/config.h \
$(xtinclude_HEADERS): ../include/config.h \
$(top_srcdir)/scripts/header2installheader.pl xt/.dir_stamp
$(AM_V_GEN) headerbasedir=`test -f '../src/$@' || echo '$(srcdir)/'` ; \
$(AM_V_GEN) headerbasedir=`test -f '$(libyaxt_c_srcdir)/$@' || echo '$(srcdir)/'` ; \
$(PERL) -I$(top_srcdir)/scripts \
$(top_srcdir)/scripts/header2installheader.pl \
--config-header=../include/config.h \
--srcdir=$$headerbasedir../src \
--srcdir=$$headerbasedir$(libyaxt_c_srcdir) \
--c-sizeof-int=$(C_SIZEOF_INT) \
--c-sizeof-long=$(C_SIZEOF_LONG) \
--c-sizeof-long-long=$(C_SIZEOF_LONG_LONG) \
--c-char-is-`test $(C_CHAR_IS_UNSIGNED) = 0 || echo un`signed \
--dstdir=. \
$$headerbasedir../src/$@
$$headerbasedir$(libyaxt_c_srcdir)/$@
clean-local:
rm -rf xt yaxt.h
......
......@@ -84,7 +84,7 @@ foreach my $headerFn (@ARGV)
' should start with ', $srcBaseDir)
if (substr($headerFn, 0, $srcBaseDirStrLen) ne $srcBaseDir);
my ($instHeaderFn) = catfile($dstBaseDir,
substr($headerFn, $srcBaseDirStrLen));
substr($headerFn, $srcBaseDirStrLen+1));
my (undef, $instHeaderDir, undef) = splitpath($instHeaderFn);
mkpath($instHeaderDir)
unless (-d $instHeaderDir);
......@@ -95,8 +95,7 @@ foreach my $headerFn (@ARGV)
my $symprefixsubst = 0;
open($headerFh, '<', $headerFn)
or die('Cannot read header file: ', $headerFn, "\n");
unlink($instHeaderFn) if (-e $instHeaderFn);
open($instHeaderFh, '>', $instHeaderFn)
open($instHeaderFh, '+<', $instHeaderFn)
or die('Cannot open output file for writing: ', $instHeaderFn, "\n");
my @predicateLevels = ({'ignored' => 0, 'expand' => 0});
......@@ -133,10 +132,8 @@ foreach my $headerFn (@ARGV)
'Replacing #ifdef HAVE_CONFIG_H/#include "config.h"/#endif',
' structure at', "\n ", $headerFn, ', line ', $lineno, "\n")
if ($debug > 1);
# print(STDERR join(', ', @headerLineNo), "\n");
splice(@headerContents, $line, 3, @configHInsert);
splice(@headerLineNo, $line, 3, (($lineno) x @configHInsert));
# print(STDERR join(', ', @headerLineNo), "\n");
redo;
}
print(STDERR 'line ', $lineno, "\n") if ($debug > 2);
......@@ -343,7 +340,29 @@ foreach my $headerFn (@ARGV)
die('Unbalanced #if at line ', $predicateLevels[-1]{'line'},
' of ', $headerFn, "\n")
if @predicateLevels > 2;
print($instHeaderFh @headerContents);
my (@oldHeaderContents) = (<$instHeaderFh>);
unless (join('',@oldHeaderContents) eq join('', @headerContents)) {
if ($debug and @oldHeaderContents) {
no warnings 'once';
local *STDTOUT;
open(STDOUT, '>&', STDERR);
if (open(my $diffFh, '|-', 'diff', '-u', $instHeaderFn, '-')) {
print($diffFh @headerContents)
or print (STDERR 'warning: problem writing to diff: ', $!, "\n");
if (!close($diffFh) and $! != 0) {
print (STDERR 'warning: problem running diff: ', $!, "\n");
}
} else {
print (STDERR 'warning: could not launch diff: ', $!, "\n");
}
close(STDOUT);
}
truncate($instHeaderFh, 0)
or die('cannot truncate ', $instHeaderFn, ": $!\n");
seek($instHeaderFh, 0, 0)
or die('failed to position output position: ', $!, "\n");
print($instHeaderFh @headerContents);
}
close($headerFh) && close($instHeaderFh)
or die;
}
......
......@@ -355,10 +355,7 @@ xt_redist_int_i8.f90: \
xtinclude_Makefile.inc: Makefile
$(AM_V_GEN)headers=`echo $(libyaxt_c_la_SOURCES) | sed 's/[ ][ ]*/ /g' | tr ' ' '\n' | grep 'xt/.*\.h$$'` ; \
echo "xtinclude_HEADERS = \\" >$@ ; \
for header in $$headers ; do echo " $$header \\" ; done \
| sed '$$s/\\$$//' >>$@
$(AM_V_GEN)$(PERL) -e 'my @argv = (grep(m{^xt/.*\.h$$}, @ARGV)); my @lens = map length, @argv; my $$maxlen = (sort { $$a <=> $$b } @lens)[-1]; print "xtinclude_HEADERS =", "\t" x (($$maxlen+7)/8-1), "\\\n"; foreach (@argv[0..@argv-2]) { print "\t$$_", "\t" x (($$maxlen+7)/8 - length($$_)/8 + (length($$_)%8 != 0)), "\\\n"; } print "\t$$argv[-1]\n"; print("\n", map { "$$_: \$$(libyaxt_c_srcdir)/$$_\n" } @argv);' $(libyaxt_c_la_SOURCES) >$@.tmp && { cmp "$@.tmp" "$@" >/dev/null || mv "$@.tmp" "$@" ; }
all-local: xtinclude_Makefile.inc
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment