Similar to
f38307f5 (Replicate src dir in build dir), this patch change
configure and Makefile to generate object files in arch/ directory.
gdb/gdbserver:
2017-10-17 Yao Qi <yao.qi@linaro.org>
* Makefile.in (CONFIG_SRC_SUBDIR): New variable.
(clean): Remove .o files in CONFIG_SRC_SUBDIR.
(distclean): Remove DEPDIR in CONFIG_SRC_SUBDIR.
(arch-i386.o, arch-amd64.o): Remove rules.
(arch/%.o): New rule.
Update POSTCOMPILE and COMPILE.pre.
* configure.ac: Invoke AC_CONFIG_COMMANDS.
* configure: Re-generated.
* configure.srv: Replace arch-i386.o with arch/i386.o.
Replace arch-amd64.o with arch/amd64.o.
+2017-10-17 Yao Qi <yao.qi@linaro.org>
+
+ * Makefile.in (CONFIG_SRC_SUBDIR): New variable.
+ (clean): Remove .o files in CONFIG_SRC_SUBDIR.
+ (distclean): Remove DEPDIR in CONFIG_SRC_SUBDIR.
+ (arch-i386.o, arch-amd64.o): Remove rules.
+ (arch/%.o): New rule.
+ Update POSTCOMPILE and COMPILE.pre.
+ * configure.ac: Invoke AC_CONFIG_COMMANDS.
+ * configure: Re-generated.
+ * configure.srv: Replace arch-i386.o with arch/i386.o.
+ Replace arch-amd64.o with arch/amd64.o.
+
2017-10-16 Yao Qi <yao.qi@linaro.org>
* configure: Regenerated.
infodir = @infodir@
htmldir = $(prefix)/html
includedir = @includedir@
+CONFIG_SRC_SUBDIR = @CONFIG_SRC_SUBDIR@
SHELL = @SHELL@
EXEEXT = @EXEEXT@
rm -f *-generated.c
rm -f stamp-xml
rm -f $(DEPDIR)/*.Po
+ for i in $(CONFIG_SRC_SUBDIR); do \
+ rm -f $$i/*.o; \
+ rm -f $$i/$(DEPDIR)/*; \
+ done
@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
maintainer-clean realclean distclean: clean
rm -rf $(GNULIB_BUILDDIR)
rm -f Makefile config.status config.h stamp-h config.log
rm -f Makefile
+ for i in $(CONFIG_SRC_SUBDIR); do \
+ rmdir $$i/$(DEPDIR); \
+ done
subdir_do: force
@for i in $(DODIRS); do \
$(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
$(POSTCOMPILE)
-arch-i386.o: ../arch/i386.c
- $(COMPILE) $<
- $(POSTCOMPILE)
-
-arch-amd64.o: ../arch/amd64.c
+arch/%.o: ../arch/%.c
$(COMPILE) $<
$(POSTCOMPILE)
# into place if the compile succeeds. We need this because gcc does
# not atomically write the dependency output file.
override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \
- -MF $(DEPDIR)/$(basename $(@F)).Tpo
-override POSTCOMPILE = @mv $(DEPDIR)/$(basename $(@F)).Tpo \
- $(DEPDIR)/$(basename $(@F)).Po
+ -MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo
+override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \
+ $(@D)/$(DEPDIR)/$(basename $(@F)).Po
else
override COMPILE.pre = source='$<' object='$@' libtool=no \
- DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) $(CC)
+ DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) \
+ $(CXX) -x c++ $(CXX_DIALECT)
# depcomp handles atomicity for us, so we don't need a postcompile
# step.
override POSTCOMPILE =
ustlibs
ALLOCA
CCDEPMODE
+CONFIG_SRC_SUBDIR
DEPDIR
am__leading_dot
host_noncanonical
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
# 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
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" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
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 ;;
"Makefile":F) case x$CONFIG_HEADERS in
xconfig.h:config.in)
echo > stamp-h ;;
# 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=
;;
i[34567]86-*-cygwin*) srv_regobj=""
srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
- srv_tgtobj="${srv_tgtobj} arch-i386.o"
+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
srv_xmlfiles="$srv_i386_xmlfiles"
;;
i[34567]86-*-linux*) srv_regobj="$srv_i386_linux_regobj"
srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles"
srv_tgtobj="amd64-linux-siginfo.o"
fi
- srv_tgtobj="${srv_tgtobj} arch-i386.o"
+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
srv_tgtobj="${srv_tgtobj} $srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
;;
i[34567]86-*-lynxos*) srv_regobj=""
srv_tgtobj="lynx-low.o lynx-i386-low.o fork-child.o fork-inferior.o"
- srv_tgtobj="${srv_tgtobj} arch-i386.o"
+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
srv_xmlfiles="i386/i386.xml"
srv_xmlfiles="${srv_xmlfiles} i386/32bit-core.xml"
srv_xmlfiles="${srv_xmlfiles} i386/32bit-sse.xml"
i[34567]86-*-mingw32ce*)
srv_regobj=""
srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
- srv_tgtobj="${srv_tgtobj} arch-i386.o"
+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
srv_tgtobj="${srv_tgtobj} wincecompat.o"
srv_xmlfiles="$srv_i386_xmlfiles"
# hostio_last_error implementation is in win32-low.c
;;
i[34567]86-*-mingw*) srv_regobj=""
srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
- srv_tgtobj="${srv_tgtobj} arch-i386.o"
+ srv_tgtobj="${srv_tgtobj} arch/i386.o"
srv_xmlfiles="$srv_i386_xmlfiles"
srv_mingw=yes
;;
i[34567]86-*-nto*) srv_regobj=""
- srv_tgtobj="nto-low.o nto-x86-low.o arch-i386.o"
+ srv_tgtobj="nto-low.o nto-x86-low.o arch/i386.o"
srv_xmlfiles="$srv_i386_xmlfiles"
srv_qnx="yes"
;;
;;
x86_64-*-linux*) srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
- srv_tgtobj="${srv_tgtobj} arch-i386.o arch-amd64.o"
+ srv_tgtobj="${srv_tgtobj} arch/i386.o arch/amd64.o"
srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
srv_tgtobj="${srv_tgtobj} x86-linux-dregs.o"
;;
x86_64-*-mingw*) srv_regobj=""
srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
- srv_tgtobj="${srv_tgtobj} arch-amd64.o"
+ srv_tgtobj="${srv_tgtobj} arch/amd64.o"
srv_xmlfiles="$srv_i386_xmlfiles $srv_amd64_xmlfiles"
srv_mingw=yes
;;
x86_64-*-cygwin*) srv_regobj=""
srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
- srv_tgtobj="${srv_tgtobj} arch-amd64.o"
+ srv_tgtobj="${srv_tgtobj} arch/amd64.o"
srv_xmlfiles="$srv_i386_xmlfiles"
;;