Mercurial > octave
diff build-aux/subst-script-vals.in.sh @ 21398:7e8a410e6124
break generated file dependence on Makefile (bug #46063)
* build-aux/mk-mxarray-h.in.sh, build-aux/mk-version-h.in.sh,
build-aux/subst-config-vals.in.sh,
build-aux/subst-cross-config-vals.in.sh,
build-aux/subst-default-vals.in.sh,
build-aux/subst-f77-isnan-macro.in.sh,
build-aux/subst-script-vals.in.sh: New files with commands extracted
from build-aux/common.mk.
* build-aux/common.mk (ADDRESS_SANITIZER_OPTIONS,
do_subst_config_vals, do_subst_cross_config_vals,
do_subst_default_vals, do_subst_script_vals):
Eliminate macros that are now in script files.
(FONTCONFIG_CPPFLAGS, FT2_CPPFLAGS, LIBEXT): Move definition to configure.ac,
use AC_SUBST to put values in subst-config-vals.sh and
build-aux/subst-cross-config-vals.sh.
(startupfiledir, localstartupfiledir): Move definition to configure.ac,
use AC_SUBST to put values in subst-default-vals.sh.
(ALL_FFLAGS): Delete unused macro.
(simple-filter-rule): New macro.
* build-aux/mk-default-qt-settings.in.sh: Rename and adapt from
libgui/mk-default-qt-settings.in.
* build-aux/mk-f77-def.in.sh: Rename and adapt from
liboctave/cruft/mkf77def.in.
* Makefile.am (EXTRA_DIST): Include new files in the list.
* acinclude.m4 (OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES): Assume file names
have the suffix .sh and are generated from .in.sh.
* Makefile.am (run-octave): Depend on build-aux/subst-script-vals.sh
instead of Makefile.
(octave-config.h): Use move-if-change rule.
* configure.ac: Use ${X} instead of $(X) for variables in
OCTAVE_SET_DEFAULT args.
(SHARED_LIBS, STATIC_LIBS): AC_SUBST them.
Protect timestamp of oct-conf-post.h with a move-if-change rule.
* etc/module.mk (etc/icons/octave.appdata.xml,
etc/icons/octave.desktop): Don't depend on Makefile.
* libgui/module.mk (libgui/default-qt-settings):
Depend on build-aux/mk-default-qt-settings.sh instead of Makefile.
* build-env.h, build-env.cc (ALL_CFLAGS, ALL_CXXFLAGS, ALL_FFLAGS,
ALL_LDFLAGS, LIBFLAGS): Delete variables.
* libinterp/corefcn/module.mk ($(OPT_HANDLERS), $(COREFCN_FT2_DF),
libinterp/corefcn/defaults.h, libinterp/corefcn/graphics.h,
libinterp/corefcn/graphics-props.cc, libinterp/corefcn/oct-errno.cc,
libinterp/corefcn/mxarray.h, libinterp/corefcn/oct-tex-lexer.ll):
Depend on timestamp file to ensure destination directory exists.
(libinterp/corefcn/graphics.h, libinterp/corefcn/graphics-props.cc,
libinterp/corefcn/oct-errno.cc, libinterp/corefcn/oct-tex-lexer.ll,
libinterp/corefcn/oct-tex-symbols.cc):
Use mv instead of move-if-change.
(libinterp/corefcn/mxarray.h): Use script to substitute values.
Depend on libinterp/corefcn/mxarray.in.h instead of Makefile
* libinterp/corefcn/toplev.cc (octave_config_info): Don't include
ALL_CFLAGS, ALL_CXXFLAGS, ALL_FFLAGS, ALL_LDFLAGS, of LIBFLAGS in the
list.
* libinterp/module.mk ($(SRC_DEF_FILES)): Don't depend on Makefile.
(libinterp/build-env.cc, libinterp/build-env-features.cc,
libinterp/builtins.cc, libinterp/builtin-defun-decls.h,
libinterp/dldfcn/PKG_ADD, libinterp/.DOCSTRINGS): Depend on timestamp
file to ensure destination directory exists.
(libinterp/build-env.cc): Depend on build-aux/subst-config-vals.sh
instead of Makefile.
(libinterp/version.h): Use script to substitute values.
Depend on build-aux/mk-version-h.sh instead of libinterp/version.in.h.
* liboctave/cruft/module.mk (liboctave/cruft/cruft.def): Depend on
timestamp file to ensure destination directory exists.
(liboctave_DISTCLEANFILES): Remove liboctave/cruft/mkf77def from the
list.
(liboctave_EXTRA_DIST): Don't add liboctave/cruft/mkf77def.in to the
list.
* liboctave/cruft/ranlib/module.mk
(liboctave/cruft/ranlib/ranlib.def): Depend on timestamp file to
ensure destination directory exists.
* liboctave/cruft/slatec-fn/module.mk
(liboctave/cruft/slatec-fn/erfc.f, liboctave/cruft/slatec-fn/derfc.f):
Depend on timestamp file to ensure destination directory exists.
Use script to substitute values. Depend on
build-aux/subst-f77-isnan-macro.sh instead of Makefile.
(do-subst-isnan-macro): Delete macro.
* scripts/module.mk (GEN_FCN_FILES_TEMPLATE): Use simple-filter-rule
to execute build-aux/subst-config-vals.sh. Depend on
build-aux/subst-config-vals.sh instead of Makefile.
(scripts/.DOCSTRINGS): Don't depend on Makefile. Do depend on
timestamp file to ensure destination directory exists.
* src/module.mk (src/$(host_triplet)-mkoctfile.cc,
src/$(host_triplet)-octave-config.cc): Depend on
build-aux/subst-cross-config-vals.sh instead of Makefile.
(src/octave-config.cc, src/mkoctfile.cc, src/main.cc): Depend on
build-aux/subst-default-vals.sh instead of Makefile.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 04 Mar 2016 12:51:00 -0500 |
parents | |
children | 9429c39994f8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build-aux/subst-script-vals.in.sh Fri Mar 04 12:51:00 2016 -0500 @@ -0,0 +1,62 @@ +#! /bin/sh +# +# Copyright (C) 2016 John W. Eaton +# +# This file is part of Octave. +# +# Octave is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# Octave is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with Octave; see the file COPYING. If not, see +# <http://www.gnu.org/licenses/>. + +: ${SED=@SED@} + +## Use two steps so that we can interpolate values without having to +## determine the order in which to set variable values. + +## These must use ' so that embedded variables are not interpolated +## (the values they reference may not be defined before they are used). + +AWK="@AWK@" +FIND="@FIND@" +SED="@SED@" +ADDRESS_SANITIZER_OPTIONS="@ADDRESS_SANITIZER_OPTIONS@" +abs_top_srcdir="@abs_top_srcdir@" +abs_top_builddir="@abs_top_builddir@" + +## These must use " so that embedded variables are interpolated. + +## Is there a better way? + +function expand_var () +{ + eval tmp="\$$1" + while echo "$tmp" | grep '\${[A-Za-z_][A-Za-z0-9_]*}' > /dev/null; do + eval tmp="$tmp" + done + eval $1="'$tmp'" +} + +expand_var AWK +expand_var FIND +expand_var SED +expand_var ADDRESS_SANITIZER_OPTIONS +expand_var abs_top_srcdir +expand_var abs_top_builddir + +$SED \ + -e "s|%AWK%|${AWK}|g" \ + -e "s|%FIND%|${FIND}|g" \ + -e "s|%SED%|${SED}|g" \ + -e "s|%ADDRESS_SANITIZER_OPTIONS%|${ADDRESS_SANITIZER_OPTIONS}|g" \ + -e "s|%abs_top_srcdir%|${abs_top_srcdir}|" \ + -e "s|%builddir%|${abs_top_builddir}|"