diff options
author | Yao Qi <yao.qi@linaro.org> | 2017-10-06 11:13:30 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2017-10-06 11:13:30 +0100 |
commit | f38307f593cb8189c82fb39e46e0cd899022e2fb (patch) | |
tree | f7b249704cf83712afaaaf8d87773b598eaed91a /gdb/configure | |
parent | 2f924de654ff8f719faf60b84948397809baaac6 (diff) | |
download | gdb-f38307f593cb8189c82fb39e46e0cd899022e2fb.zip gdb-f38307f593cb8189c82fb39e46e0cd899022e2fb.tar.gz gdb-f38307f593cb8189c82fb39e46e0cd899022e2fb.tar.bz2 |
[RFC] Replicate src dir in build dir
Nowadays, GDB build tree is almost flat, but source tree isn't. We
have arch/ nat/ target/ common/ cli/ mi/ tui/ python/ guile/ directories.
We need to some rules in Makefile for source files in different source
directories, like,
# Rules for compiling .c files in the various source subdirectories.
%.o: ${srcdir}/arch/%.c
$(COMPILE) $<
$(POSTCOMPILE)
%.o: ${srcdir}/nat/%.c
$(COMPILE) $<
$(POSTCOMPILE)
so we should take care of some special case that files' base name is the
same, like,
# Specify an explicit rule for gdb/common/agent.c, to avoid a clash with the
# object file generate by gdb/agent.c.
common-agent.o: $(srcdir)/common/agent.c
$(COMPILE) $(srcdir)/common/agent.c
$(POSTCOMPILE)
As we add more and more files in different directories, it becomes tricky
to name files, because we need take this into account.
This patch takes the first step toward "Replicate src dir in build dir",
that is, we create arch/ directory in buildtree, and put amd64.o there
as an example. Dependency tracking is updated for files with directory
name. Currently, when we build amd64.o,
"-c -o amd64.o -MT amd64.o -MMD -MP -MF .deps/amd64.Tpo"
with this patch applied, it becomes,
"-c -o arch/amd64.o -MT arch/amd64.o -MMD -MP -MF arch/.deps/amd64.o.Tpo"
"make clean" removes the object files, and "make distclean" removes .deps
additionally. configure file create .deps directory in each of
CONFIG_SRC_SUBDIR, and pass it to Makefile.in, so that "make clean" and
"make distclean" can remove stuffs there.
If people agree with this change, I'll add more directories to
CONFIG_SRC_SUBDIR.
gdb:
2017-10-06 Yao Qi <yao.qi@linaro.org>
* Makefile.in (CONFIG_SRC_SUBDIR): New.
(ALL_64_TARGET_OBS): Replace amd64.o with arch/amd64.o.
(clean): Remove object files and dependency files.
(distclean): Remove the directory.
* configure.ac: Invoke AC_CONFIG_COMMANDS.
* configure: Re-generated.
* configure.tgt: Replace amd64.o with arch/amd64.o.
Diffstat (limited to 'gdb/configure')
-rwxr-xr-x | gdb/configure | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/configure b/gdb/configure index 303c7ba..4d473cc 100755 --- a/gdb/configure +++ b/gdb/configure @@ -733,6 +733,7 @@ LIBINTL_DEP LIBINTL USE_NLS CCDEPMODE +CONFIG_SRC_SUBDIR DEPDIR am__leading_dot CXX_DIALECT @@ -5949,6 +5950,13 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depdir" +# Create sub-directories for objects and depedencies. +CONFIG_SRC_SUBDIR="arch" + + +ac_config_commands="$ac_config_commands gdbdepdir" + + depcc="$CC" am_compiler_list= am_depcomp=$ac_aux_dir/depcomp @@ -18006,6 +18014,7 @@ 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 @@ -18017,6 +18026,7 @@ 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" ;; @@ -18640,6 +18650,11 @@ $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 |