[RFA,01/13] A simpler way to make the "arch" build directory
Commit Message
This implements a simpler way to make the "arch" build directory --
namely, now it is done as an order-only dependency in the Makefile,
rather than being created when config.status is run. This simpler
because it means that the build directories can be changed without
re-running autoconf.
ChangeLog
2017-11-21 Tom Tromey <tom@tromey.com>
* configure.ac (CONFIG_SRC_SUBDIR): Don't subst.
* configure: Rebuild.
* Makefile.in (CONFIG_SRC_SUBDIR): Redefine.
(CONFIG_DEP_SUBDIR): New variable.
(%.o): Add order-only dependency.
($(CONFIG_DEP_SUBDIR)): New target.
---
gdb/ChangeLog | 9 +++++++++
gdb/Makefile.in | 10 ++++++++--
gdb/configure | 15 ---------------
gdb/configure.ac | 11 -----------
4 files changed, 17 insertions(+), 28 deletions(-)
@@ -640,9 +640,11 @@ CONFIG_ALL = @CONFIG_ALL@
CONFIG_CLEAN = @CONFIG_CLEAN@
CONFIG_INSTALL = @CONFIG_INSTALL@
CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
-CONFIG_SRC_SUBDIR = @CONFIG_SRC_SUBDIR@
HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
+CONFIG_SRC_SUBDIR = arch
+CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
+
# -I. for config files.
# -I$(srcdir) for gdb internal headers.
# -I$(srcdir)/config for more generic config files.
@@ -1920,10 +1922,14 @@ all: gdb$(EXEEXT) $(CONFIG_ALL)
@$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do
# Rule for compiling .c files in the top-level gdb directory.
-%.o: %.c
+# The order-only dependencies ensure that we create the build subdirectories.
+%.o: %.c | $(CONFIG_DEP_SUBDIR)
$(COMPILE) $<
$(POSTCOMPILE)
+$(CONFIG_DEP_SUBDIR):
+ $(SHELL) $(srcdir)/../mkinstalldirs $@
+
# Rules for compiling .c files in the various source subdirectories.
%.o: $(srcdir)/cli/%.c
$(COMPILE) $<
@@ -733,7 +733,6 @@ LIBINTL_DEP
LIBINTL
USE_NLS
CCDEPMODE
-CONFIG_SRC_SUBDIR
DEPDIR
am__leading_dot
CXX_DIALECT
@@ -5950,13 +5949,6 @@ DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depdir"
-# Create sub-directories for objects and dependencies.
-CONFIG_SRC_SUBDIR="arch"
-
-
-ac_config_commands="$ac_config_commands gdbdepdir"
-
-
depcc="$CC" am_compiler_list=
am_depcomp=$ac_aux_dir/depcomp
@@ -18013,7 +18005,6 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# INIT-COMMANDS
#
ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR
-ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR CONFIG_SRC_SUBDIR="$CONFIG_SRC_SUBDIR"
_ACEOF
@@ -18025,7 +18016,6 @@ do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
"depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;;
- "gdbdepdir") CONFIG_COMMANDS="$CONFIG_COMMANDS gdbdepdir" ;;
"jit-reader.h") CONFIG_FILES="$CONFIG_FILES jit-reader.h:jit-reader.in" ;;
"$ac_config_links_1") CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;;
"gcore") CONFIG_FILES="$CONFIG_FILES gcore" ;;
@@ -18649,11 +18639,6 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
"depdir":C) $SHELL $ac_aux_dir/mkinstalldirs $DEPDIR ;;
- "gdbdepdir":C)
- for subdir in ${CONFIG_SRC_SUBDIR}
- do
- $SHELL $ac_aux_dir/mkinstalldirs $subdir/$DEPDIR
- done ;;
"gcore":F) chmod +x gcore ;;
"Makefile":F)
case x$CONFIG_HEADERS in
@@ -44,17 +44,6 @@ AX_CXX_COMPILE_STDCXX(11, , mandatory)
# Dependency checking.
ZW_CREATE_DEPDIR
-# Create sub-directories for objects and dependencies.
-CONFIG_SRC_SUBDIR="arch"
-AC_SUBST(CONFIG_SRC_SUBDIR)
-
-AC_CONFIG_COMMANDS([gdbdepdir],[
- for subdir in ${CONFIG_SRC_SUBDIR}
- do
- $SHELL $ac_aux_dir/mkinstalldirs $subdir/$DEPDIR
- done],
- [ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR CONFIG_SRC_SUBDIR="$CONFIG_SRC_SUBDIR"])
-
ZW_PROG_COMPILER_DEPENDENCIES([CC])
gnulib_extra_configure_args=