[PATCH 2/4] Makefile: Replace explicit subdir rules with pattern rules

Simon Marchi
2016-11-13T03:46:46Z

When adding a file to be compiled to a subdirectory (e.g. mi/), the
current practice is to add an explicit rule, such as:

mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c
$(COMPILE) $(srcdir)/mi/mi-cmd-break.c
$(POSTCOMPILE)

I find it a bit verbose and cumbersome. I tried replacing those rules
with pattern rules, and found no good reason why we shouldn't do it.
For example, the following rule works for all files under mi:

%.o: $(srcdir)/mi/%.c
$(COMPILE) $<
$(POSTCOMPILE)

These pattern rules assume that the source and target files have the
same stem (foo.c and foo.o). In one case, common-agent.o is generated
from common/agent.c, to avoid a conflict with the agent.o in gdb/. In
this case, I kept the explicit rule, which takes precedence over the
pattern rule. We could also rename common/agent.c to
common/common-agent.c to get rid of the special case and still avoid the
clash, as it is done with common/common-regcache.c, for example.

This strategy was the least intrusive I found, as it only requires
changing the rules. I also though of replicating the source directory
structure in the build directory, which would generate common/agent.o
from common/agent.c. However, something was not right with the
dependency tracking (the .deps directory). I did not investigate much
further.

I also though of naming the object files after the directory they are
in, such as:

common_%.o: $(srcdir)/common/%.c
$(COMPILE) $<
$(POSTCOMPILE)

which would make common/agent.c compile to common_agent.o, avoiding the
conflict. However, these two strategies would require changing the
target filenames everywhere, in many files. Not cool.

Built-tested with --enable-targets=all.

gdb/ChangeLog:

(%.o: $(srcdir)/cli/%.c): New rule.
(%.o: $(srcdir)/compile/%.c): New rule.
(%.o: $(srcdir)/gdbtk/generic/%.c): New rule.
(%.o: $(srcdir)/mi/%.c): New rule.
(%.o: $(srcdir)/common/%.c): New rule.
(%.o: $(srcdir)/target/%.c): New rule.
(%.o: $(srcdir)/arch/%.c): New rule.
(%.o: $(srcdir)/nat/%.c): New rule.
(%.o: $(srcdir)/tui/%.c): New rule.
(%.o: $(srcdir)/guile/%.c): New rule.
(%.o: $(srcdir)/python/%.c): New rule.
(cli-cmds.o): Remove.
(cli-decode.o): Likewise.
(cli-dump.o): Likewise.
(cli-interp.o): Likewise.
(cli-logging.o): Likewise.
(cli-script.o): Likewise.
(cli-setshow.o): Likewise.
(cli-utils.o): Likewise.
(compile.o): Likewise.
(compile-c-types.o): Likewise.
(compile-c-symbols.o): Likewise.
(compile-object-load.o): Likewise.
(compile-object-run.o): Likewise.
(compile-loc2c.o): Likewise.
(compile-c-support.o): Likewise.
(gdbtk.o): Likewise.
(gdbtk-bp.o): Likewise.
(gdbtk-cmds.o): Likewise.
(gdbtk-hooks.o): Likewise.
(gdbtk-interp.o): Likewise.
(gdbtk-main.o): Likewise.
(gdbtk-register.o): Likewise.
(gdbtk-stack.o): Likewise.
(gdbtk-varobj.o): Likewise.
(gdbtk-wrapper.o): Likewise.
(mi-cmd-break.o): Likewise.
(mi-cmd-catch.o): Likewise.
(mi-cmd-disas.o): Likewise.
(mi-cmd-env.o): Likewise.
(mi-cmd-file.o): Likewise.
(mi-cmd-info.o): Likewise.
(mi-cmds.o): Likewise.
(mi-cmd-stack.o): Likewise.
(mi-cmd-target.o): Likewise.
(mi-cmd-var.o): Likewise.
(mi-console.o): Likewise.
(mi-getopt.o): Likewise.
(mi-interp.o): Likewise.
(mi-main.o): Likewise.
(mi-out.o): Likewise.
(mi-parse.o): Likewise.
(mi-symbol-cmds.o): Likewise.
(mi-common.o): Likewise.
(signals.o): Likewise.
(common-utils.o): Likewise.
(gdb_vecs.o): Likewise.
(xml-utils.o): Likewise.
(ptid.o): Likewise.
(buffer.o): Likewise.
(filestuff.o): Likewise.
(format.o): Likewise.
(vec.o): Likewise.
(print-utils.o): Likewise.
(rsp-low.o): Likewise.
(errors.o): Likewise.
(common-debug.o): Likewise.
(cleanups.o): Likewise.
(common-exceptions.o
(posix-strerror.o): Likewise.
(mingw-strerror.o): Likewise.
(btrace-common.o): Likewise.
(fileio.o): Likewise.
(common-regcache.o): Likewise.
(signals-state-save-restore.o): Likewise.
(new-op.o): Likewise.
(waitstatus.o): Likewise.
(arm.o): Likewise.
(arm-linux.o): Likewise.
(arm-get-next-pcs.o): Likewise.
(x86-dregs.o): Likewise.
(linux-btrace.o): Likewise.
(linux-osdata.o): Likewise.
(linux-procfs.o): Likewise.
(linux-ptrace.o): Likewise.
(linux-waitpid.o): Likewise.
(mips-linux-watch.o): Likewise.
(ppc-linux.o): Likewise.
(linux-personality.o): Likewise.
(x86-linux.o): Likewise.
(x86-linux-dregs.o): Likewise.
(amd64-linux-siginfo.o): Likewise.
(linux-namespaces.o): Likewise.
(aarch64-linux-hw-point.o): Likewise.
(aarch64-linux.o): Likewise.
(aarch64-insn.o): Likewise.
(tui.o): Likewise.
(tui-command.o): Likewise.
(tui-data.o): Likewise.
(tui-disasm.o): Likewise.
(tui-file.o): Likewise.
(tui-hooks.o): Likewise.
(tui-interp.o): Likewise.
(tui-io.o): Likewise.
(tui-layout.o): Likewise.
(tui-out.o): Likewise.
(tui-regs.o): Likewise.
(tui-source.o): Likewise.
(tui-stack.o): Likewise.
(tui-win.o): Likewise.
(tui-windata.o): Likewise.
(tui-wingeneral.o): Likewise.
(tui-winsource.o): Likewise.
(guile.o): Likewise.
(scm-arch.o): Likewise.
(scm-auto-load.o): Likewise.
(scm-block.o): Likewise.
(scm-breakpoint.o): Likewise.
(scm-cmd.o): Likewise.
(scm-disasm.o): Likewise.
(scm-exception.o): Likewise.
(scm-frame.o): Likewise.
(scm-gsmob.o): Likewise.
(scm-iterator.o): Likewise.
(scm-lazy-string.o): Likewise.
(scm-math.o): Likewise.
(scm-objfile.o): Likewise.
(scm-param.o): Likewise.
(scm-ports.o): Likewise.
(scm-pretty-print.o): Likewise.
(scm-progspace.o): Likewise.
(scm-safe-call.o): Likewise.
(scm-string.o): Likewise.
(scm-symbol.o): Likewise.
(scm-symtab.o): Likewise.
(scm-type.o): Likewise.
(scm-utils.o): Likewise.
(scm-value.o): Likewise.
(python.o): Likewise.
(py-arch.o): Likewise.
(py-auto-load.o): Likewise.
(py-block.o): Likewise.
(py-bpevent.o): Likewise.
(py-breakpoint.o): Likewise.
(py-cmd.o): Likewise.
(py-continueevent.o): Likewise.
(py-xmethods.o): Likewise.
(py-event.o): Likewise.
(py-evtregistry.o): Likewise.
(py-evts.o): Likewise.
(py-exitedevent.o): Likewise.
(py-finishbreakpoint.o): Likewise.
(py-frame.o): Likewise.
(py-framefilter.o): Likewise.
(py-function.o): Likewise.
(py-gdb-readline.o): Likewise.
(py-inferior.o): Likewise.
(py-infevents.o): Likewise.
(py-infthread.o): Likewise.
(py-lazy-string.o): Likewise.
(py-linetable.o): Likewise.
(py-newobjfileevent.o): Likewise.
(py-objfile.o): Likewise.
(py-param.o): Likewise.
(py-prettyprint.o): Likewise.
(py-progspace.o): Likewise.
(py-signalevent.o): Likewise.
(py-stopevent.o): Likewise.
(py-symbol.o): Likewise.
(py-symtab.o): Likewise.
(py-threadevent.o): Likewise.
(py-type.o): Likewise.
(py-unwind.o): Likewise.
(py-utils.o): Likewise.
(py-value.o): Likewise.
(py-varobj.o): Likewise.
---
gdb/Makefile.in | 668 ++------------------------------------------------------
1 file changed, 22 insertions(+), 646 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 27727d0..a0fea7c 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1939,36 +1939,8 @@ stamp-xml: $(srcdir)/features/feature_to_c.sh Makefile $(XMLFILES)
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-cli-cmds.o: $(srcdir)/cli/cli-cmds.c
- $(COMPILE) $(srcdir)/cli/cli-cmds.c
- $(POSTCOMPILE)
-
-cli-decode.o: $(srcdir)/cli/cli-decode.c
- $(COMPILE) $(srcdir)/cli/cli-decode.c
- $(POSTCOMPILE)
-
-cli-dump.o: $(srcdir)/cli/cli-dump.c
- $(COMPILE) $(srcdir)/cli/cli-dump.c
- $(POSTCOMPILE)
-
-cli-interp.o: $(srcdir)/cli/cli-interp.c
- $(COMPILE) $(srcdir)/cli/cli-interp.c
- $(POSTCOMPILE)
-
-cli-logging.o: $(srcdir)/cli/cli-logging.c
- $(COMPILE) $(srcdir)/cli/cli-logging.c
- $(POSTCOMPILE)
-
-cli-script.o: $(srcdir)/cli/cli-script.c
- $(COMPILE) $(srcdir)/cli/cli-script.c
- $(POSTCOMPILE)
-
-cli-setshow.o: $(srcdir)/cli/cli-setshow.c
- $(COMPILE) $(srcdir)/cli/cli-setshow.c
- $(POSTCOMPILE)
-
-cli-utils.o: $(srcdir)/cli/cli-utils.c
- $(COMPILE) $(srcdir)/cli/cli-utils.c
+%.o: $(srcdir)/cli/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

# GCC Compile support dependencies
@@ -1976,35 +1948,10 @@ cli-utils.o: $(srcdir)/cli/cli-utils.c
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-compile.o: $(srcdir)/compile/compile.c
- $(COMPILE) $(srcdir)/compile/compile.c
- $(POSTCOMPILE)
-
-compile-c-types.o: $(srcdir)/compile/compile-c-types.c
- $(COMPILE) $(srcdir)/compile/compile-c-types.c
- $(POSTCOMPILE)
-
-compile-c-symbols.o: $(srcdir)/compile/compile-c-symbols.c
- $(COMPILE) $(srcdir)/compile/compile-c-symbols.c
- $(POSTCOMPILE)
-
-compile-object-load.o: $(srcdir)/compile/compile-object-load.c
- $(COMPILE) $(srcdir)/compile/compile-object-load.c
- $(POSTCOMPILE)
-
-compile-object-run.o: $(srcdir)/compile/compile-object-run.c
- $(COMPILE) $(srcdir)/compile/compile-object-run.c
- $(POSTCOMPILE)
-
-compile-loc2c.o: $(srcdir)/compile/compile-loc2c.c
- $(COMPILE) $(srcdir)/compile/compile-loc2c.c
- $(POSTCOMPILE)
-
-compile-c-support.o: $(srcdir)/compile/compile-c-support.c
- $(COMPILE) $(srcdir)/compile/compile-c-support.c
+%.o: $(srcdir)/compile/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

-
#
# GDBTK sub-directory
#
@@ -2074,230 +2021,40 @@ all_gdbtk_cflags = $(IDE_CFLAGS) $(ITCL_CFLAGS) \
-DGDBTK_LIBRARY=\"$(GDBTK_LIBRARY)\" \
-DSRC_DIR=\"$(GDBTK_SRC_DIR)\"

-gdbtk.o: $(srcdir)/gdbtk/generic/gdbtk.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk.c
- $(POSTCOMPILE)
-
-gdbtk-bp.o: $(srcdir)/gdbtk/generic/gdbtk-bp.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-bp.c
- $(POSTCOMPILE)
-
-gdbtk-cmds.o: $(srcdir)/gdbtk/generic/gdbtk-cmds.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-cmds.c
- $(POSTCOMPILE)
-
-gdbtk-hooks.o: $(srcdir)/gdbtk/generic/gdbtk-hooks.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-hooks.c
- $(POSTCOMPILE)
-
-gdbtk-interp.o: $(srcdir)/gdbtk/generic/gdbtk-interp.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-interp.c
- $(POSTCOMPILE)
-
-gdbtk-main.o: $(srcdir)/gdbtk/generic/gdbtk-main.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-main.c
- $(POSTCOMPILE)
-
-gdbtk-register.o: $(srcdir)/gdbtk/generic/gdbtk-register.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-register.c
+%.o: $(srcdir)/gdbtk/generic/%.c
+ $(COMPILE) $(all_gdbtk_cflags) %<
$(POSTCOMPILE)

-gdbtk-stack.o: $(srcdir)/gdbtk/generic/gdbtk-stack.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-stack.c
- $(POSTCOMPILE)
-
-gdbtk-varobj.o: $(srcdir)/gdbtk/generic/gdbtk-varobj.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-varobj.c
- $(POSTCOMPILE)
-
-gdbtk-wrapper.o: $(srcdir)/gdbtk/generic/gdbtk-wrapper.c
- $(COMPILE) $(all_gdbtk_cflags) $(srcdir)/gdbtk/generic/gdbtk-wrapper.c
- $(POSTCOMPILE)
-
-
#
# gdb/mi/ dependencies
#
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-mi-cmd-break.o: $(srcdir)/mi/mi-cmd-break.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-break.c
- $(POSTCOMPILE)
-
-mi-cmd-catch.o: $(srcdir)/mi/mi-cmd-catch.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-catch.c
- $(POSTCOMPILE)
-
-mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-disas.c
- $(POSTCOMPILE)
-
-mi-cmd-env.o: $(srcdir)/mi/mi-cmd-env.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-env.c
- $(POSTCOMPILE)
-
-mi-cmd-file.o: $(srcdir)/mi/mi-cmd-file.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-file.c
- $(POSTCOMPILE)
-
-mi-cmd-info.o: $(srcdir)/mi/mi-cmd-info.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-info.c
- $(POSTCOMPILE)
-
-mi-cmds.o: $(srcdir)/mi/mi-cmds.c
- $(COMPILE) $(srcdir)/mi/mi-cmds.c
- $(POSTCOMPILE)
-
-mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-stack.c
- $(POSTCOMPILE)
-
-mi-cmd-target.o: $(srcdir)/mi/mi-cmd-target.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-target.c
- $(POSTCOMPILE)
-
-mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c
- $(COMPILE) $(srcdir)/mi/mi-cmd-var.c
- $(POSTCOMPILE)
-
-mi-console.o: $(srcdir)/mi/mi-console.c
- $(COMPILE) $(srcdir)/mi/mi-console.c
- $(POSTCOMPILE)
-
-mi-getopt.o: $(srcdir)/mi/mi-getopt.c
- $(COMPILE) $(srcdir)/mi/mi-getopt.c
- $(POSTCOMPILE)
-
-mi-interp.o: $(srcdir)/mi/mi-interp.c
- $(COMPILE) $(srcdir)/mi/mi-interp.c
- $(POSTCOMPILE)
-
-mi-main.o: $(srcdir)/mi/mi-main.c
- $(COMPILE) $(srcdir)/mi/mi-main.c
- $(POSTCOMPILE)
-
-mi-out.o: $(srcdir)/mi/mi-out.c
- $(COMPILE) $(srcdir)/mi/mi-out.c
- $(POSTCOMPILE)
-
-mi-parse.o: $(srcdir)/mi/mi-parse.c
- $(COMPILE) $(srcdir)/mi/mi-parse.c
- $(POSTCOMPILE)
-
-mi-symbol-cmds.o: $(srcdir)/mi/mi-symbol-cmds.c
- $(COMPILE) $(srcdir)/mi/mi-symbol-cmds.c
- $(POSTCOMPILE)
-
-mi-common.o: $(srcdir)/mi/mi-common.c
- $(COMPILE) $(srcdir)/mi/mi-common.c
- $(POSTCOMPILE)
+%.o: $(srcdir)/mi/%.c
+ $(COMPILE) $<

# gdb/common/ dependencies
#
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-signals.o: $(srcdir)/common/signals.c
- $(COMPILE) $(srcdir)/common/signals.c
- $(POSTCOMPILE)
-
-common-utils.o: ${srcdir}/common/common-utils.c
- $(COMPILE) $(srcdir)/common/common-utils.c
- $(POSTCOMPILE)
-
-gdb_vecs.o: ${srcdir}/common/gdb_vecs.c
- $(COMPILE) $(srcdir)/common/gdb_vecs.c
- $(POSTCOMPILE)
-
-xml-utils.o: ${srcdir}/common/xml-utils.c
- $(COMPILE) $(srcdir)/common/xml-utils.c
- $(POSTCOMPILE)
-
-ptid.o: ${srcdir}/common/ptid.c
- $(COMPILE) $(srcdir)/common/ptid.c
- $(POSTCOMPILE)
-
-buffer.o: ${srcdir}/common/buffer.c
- $(COMPILE) $(srcdir)/common/buffer.c
- $(POSTCOMPILE)
-
-filestuff.o: $(srcdir)/common/filestuff.c
- $(COMPILE) $(srcdir)/common/filestuff.c
- $(POSTCOMPILE)
-
-format.o: ${srcdir}/common/format.c
- $(COMPILE) $(srcdir)/common/format.c
+%.o: ${srcdir}/common/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

common-agent.o: $(srcdir)/common/agent.c
$(COMPILE) $(srcdir)/common/agent.c
$(POSTCOMPILE)

-vec.o: ${srcdir}/common/vec.c
- $(COMPILE) $(srcdir)/common/vec.c
- $(POSTCOMPILE)
-
-print-utils.o: ${srcdir}/common/print-utils.c
- $(COMPILE) $(srcdir)/common/print-utils.c
- $(POSTCOMPILE)
-
-rsp-low.o: ${srcdir}/common/rsp-low.c
- $(COMPILE) $(srcdir)/common/rsp-low.c
- $(POSTCOMPILE)
-
-errors.o: ${srcdir}/common/errors.c
- $(COMPILE) $(srcdir)/common/errors.c
- $(POSTCOMPILE)
-
-common-debug.o: ${srcdir}/common/common-debug.c
- $(COMPILE) $(srcdir)/common/common-debug.c
- $(POSTCOMPILE)
-
-cleanups.o: ${srcdir}/common/cleanups.c
- $(COMPILE) $(srcdir)/common/cleanups.c
- $(POSTCOMPILE)
-
-common-exceptions.o: ${srcdir}/common/common-exceptions.c
- $(COMPILE) $(srcdir)/common/common-exceptions.c
- $(POSTCOMPILE)
-
-posix-strerror.o: ${srcdir}/common/posix-strerror.c
- $(COMPILE) $(srcdir)/common/posix-strerror.c
- $(POSTCOMPILE)
-
-mingw-strerror.o: ${srcdir}/common/mingw-strerror.c
- $(COMPILE) $(srcdir)/common/mingw-strerror.c
- $(POSTCOMPILE)
-
-btrace-common.o: ${srcdir}/common/btrace-common.c
- $(COMPILE) $(srcdir)/common/btrace-common.c
- $(POSTCOMPILE)
-
-fileio.o: ${srcdir}/common/fileio.c
- $(COMPILE) $(srcdir)/common/fileio.c
- $(POSTCOMPILE)
-
-common-regcache.o: ${srcdir}/common/common-regcache.c
- $(COMPILE) $(srcdir)/common/common-regcache.c
- $(POSTCOMPILE)
-
-signals-state-save-restore.o: $(srcdir)/common/signals-state-save-restore.c
- $(COMPILE) $(srcdir)/common/signals-state-save-restore.c
- $(POSTCOMPILE)
-
-new-op.o: ${srcdir}/common/new-op.c
- $(COMPILE) $(srcdir)/common/new-op.c
- $(POSTCOMPILE)
-
#
# gdb/target/ dependencies
#
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-waitstatus.o: ${srcdir}/target/waitstatus.c
- $(COMPILE) $(srcdir)/target/waitstatus.c
+%.o: ${srcdir}/target/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

#
@@ -2306,16 +2063,8 @@ waitstatus.o: ${srcdir}/target/waitstatus.c
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-arm.o: ${srcdir}/arch/arm.c
- $(COMPILE) $(srcdir)/arch/arm.c
- $(POSTCOMPILE)
-
-arm-linux.o: ${srcdir}/arch/arm-linux.c
- $(COMPILE) $(srcdir)/arch/arm-linux.c
- $(POSTCOMPILE)
-
-arm-get-next-pcs.o: ${srcdir}/arch/arm-get-next-pcs.c
- $(COMPILE) $(srcdir)/arch/arm-get-next-pcs.c
+%.o: ${srcdir}/arch/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

# gdb/nat/ dependencies
@@ -2323,73 +2072,8 @@ arm-get-next-pcs.o: ${srcdir}/arch/arm-get-next-pcs.c
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-x86-dregs.o: ${srcdir}/nat/x86-dregs.c
- $(COMPILE) $(srcdir)/nat/x86-dregs.c
- $(POSTCOMPILE)
-
-linux-btrace.o: ${srcdir}/nat/linux-btrace.c
- $(COMPILE) $(srcdir)/nat/linux-btrace.c
- $(POSTCOMPILE)
-
-linux-osdata.o: ${srcdir}/nat/linux-osdata.c
- $(COMPILE) $(srcdir)/nat/linux-osdata.c
- $(POSTCOMPILE)
-
-linux-procfs.o: $(srcdir)/nat/linux-procfs.c
- $(COMPILE) $(srcdir)/nat/linux-procfs.c
- $(POSTCOMPILE)
-
-linux-ptrace.o: $(srcdir)/nat/linux-ptrace.c
- $(COMPILE) $(srcdir)/nat/linux-ptrace.c
- $(POSTCOMPILE)
-
-linux-waitpid.o: ${srcdir}/nat/linux-waitpid.c
- $(COMPILE) $(srcdir)/nat/linux-waitpid.c
- $(POSTCOMPILE)
-
-mips-linux-watch.o: ${srcdir}/nat/mips-linux-watch.c
- $(COMPILE) $(srcdir)/nat/mips-linux-watch.c
- $(POSTCOMPILE)
-
-ppc-linux.o: ${srcdir}/nat/ppc-linux.c
- $(COMPILE) $(srcdir)/nat/ppc-linux.c
- $(POSTCOMPILE)
-
-linux-personality.o: ${srcdir}/nat/linux-personality.c
- $(COMPILE) $(srcdir)/nat/linux-personality.c
- $(POSTCOMPILE)
-
-x86-linux.o: ${srcdir}/nat/x86-linux.c
- $(COMPILE) $(srcdir)/nat/x86-linux.c
- $(POSTCOMPILE)
-
-x86-linux-dregs.o: ${srcdir}/nat/x86-linux-dregs.c
- $(COMPILE) $(srcdir)/nat/x86-linux-dregs.c
- $(POSTCOMPILE)
-
-amd64-linux-siginfo.o: ${srcdir}/nat/amd64-linux-siginfo.c
- $(COMPILE) $(srcdir)/nat/amd64-linux-siginfo.c
- $(POSTCOMPILE)
-
-linux-namespaces.o: ${srcdir}/nat/linux-namespaces.c
- $(COMPILE) $(srcdir)/nat/linux-namespaces.c
- $(POSTCOMPILE)
-
-aarch64-linux-hw-point.o: ${srcdir}/nat/aarch64-linux-hw-point.c
- $(COMPILE) $(srcdir)/nat/aarch64-linux-hw-point.c
- $(POSTCOMPILE)
-
-aarch64-linux.o: ${srcdir}/nat/aarch64-linux.c
- $(COMPILE) $(srcdir)/nat/aarch64-linux.c
- $(POSTCOMPILE)
-
-# gdb/arch/ dependencies
-#
-# Need to explicitly specify the compile rule as make will do nothing
-# or try to compile the object file into the sub-directory.
-
-aarch64-insn.o: ${srcdir}/arch/aarch64-insn.c
- $(COMPILE) $(srcdir)/arch/aarch64-insn.c
+%.o: ${srcdir}/nat/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

#
@@ -2398,72 +2082,8 @@ aarch64-insn.o: ${srcdir}/arch/aarch64-insn.c
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-tui.o: $(srcdir)/tui/tui.c
- $(COMPILE) $(srcdir)/tui/tui.c
- $(POSTCOMPILE)
-
-tui-command.o: $(srcdir)/tui/tui-command.c
- $(COMPILE) $(srcdir)/tui/tui-command.c
- $(POSTCOMPILE)
-
-tui-data.o: $(srcdir)/tui/tui-data.c
- $(COMPILE) $(srcdir)/tui/tui-data.c
- $(POSTCOMPILE)
-
-tui-disasm.o: $(srcdir)/tui/tui-disasm.c
- $(COMPILE) $(srcdir)/tui/tui-disasm.c
- $(POSTCOMPILE)
-
-tui-file.o: $(srcdir)/tui/tui-file.c
- $(COMPILE) $(srcdir)/tui/tui-file.c
- $(POSTCOMPILE)
-
-tui-hooks.o: $(srcdir)/tui/tui-hooks.c
- $(COMPILE) $(srcdir)/tui/tui-hooks.c
- $(POSTCOMPILE)
-
-tui-interp.o: $(srcdir)/tui/tui-interp.c
- $(COMPILE) $(srcdir)/tui/tui-interp.c
- $(POSTCOMPILE)
-
-tui-io.o: $(srcdir)/tui/tui-io.c
- $(COMPILE) $(srcdir)/tui/tui-io.c
- $(POSTCOMPILE)
-
-tui-layout.o: $(srcdir)/tui/tui-layout.c
- $(COMPILE) $(srcdir)/tui/tui-layout.c
- $(POSTCOMPILE)
-
-tui-out.o: $(srcdir)/tui/tui-out.c
- $(COMPILE) $(srcdir)/tui/tui-out.c
- $(POSTCOMPILE)
-
-tui-regs.o: $(srcdir)/tui/tui-regs.c
- $(COMPILE) $(srcdir)/tui/tui-regs.c
- $(POSTCOMPILE)
-
-tui-source.o: $(srcdir)/tui/tui-source.c
- $(COMPILE) $(srcdir)/tui/tui-source.c
- $(POSTCOMPILE)
-
-tui-stack.o: $(srcdir)/tui/tui-stack.c
- $(COMPILE) $(srcdir)/tui/tui-stack.c
- $(POSTCOMPILE)
-
-tui-win.o: $(srcdir)/tui/tui-win.c
- $(COMPILE) $(srcdir)/tui/tui-win.c
- $(POSTCOMPILE)
-
-tui-windata.o: $(srcdir)/tui/tui-windata.c
- $(COMPILE) $(srcdir)/tui/tui-windata.c
- $(POSTCOMPILE)
-
-tui-wingeneral.o: $(srcdir)/tui/tui-wingeneral.c
- $(COMPILE) $(srcdir)/tui/tui-wingeneral.c
- $(POSTCOMPILE)
-
-tui-winsource.o: $(srcdir)/tui/tui-winsource.c
- $(COMPILE) $(srcdir)/tui/tui-winsource.c
+%.o: $(srcdir)/tui/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

# gdb/guile dependencies
@@ -2471,104 +2091,8 @@ tui-winsource.o: $(srcdir)/tui/tui-winsource.c
# Need to explicitly specify the compile rule as make will do nothing
# or try to compile the object file into the sub-directory.

-guile.o: $(srcdir)/guile/guile.c
- $(COMPILE) $(srcdir)/guile/guile.c
- $(POSTCOMPILE)
-
-scm-arch.o: $(srcdir)/guile/scm-arch.c
- $(COMPILE) $(srcdir)/guile/scm-arch.c
- $(POSTCOMPILE)
-
-scm-auto-load.o: $(srcdir)/guile/scm-auto-load.c
- $(COMPILE) $(srcdir)/guile/scm-auto-load.c
- $(POSTCOMPILE)
-
-scm-block.o: $(srcdir)/guile/scm-block.c
- $(COMPILE) $(srcdir)/guile/scm-block.c
- $(POSTCOMPILE)
-
-scm-breakpoint.o: $(srcdir)/guile/scm-breakpoint.c
- $(COMPILE) $(srcdir)/guile/scm-breakpoint.c
- $(POSTCOMPILE)
-
-scm-cmd.o: $(srcdir)/guile/scm-cmd.c
- $(COMPILE) $(srcdir)/guile/scm-cmd.c
- $(POSTCOMPILE)
-
-scm-disasm.o: $(srcdir)/guile/scm-disasm.c
- $(COMPILE) $(srcdir)/guile/scm-disasm.c
- $(POSTCOMPILE)
-
-scm-exception.o: $(srcdir)/guile/scm-exception.c
- $(COMPILE) $(srcdir)/guile/scm-exception.c
- $(POSTCOMPILE)
-
-scm-frame.o: $(srcdir)/guile/scm-frame.c
- $(COMPILE) $(srcdir)/guile/scm-frame.c
- $(POSTCOMPILE)
-
-scm-gsmob.o: $(srcdir)/guile/scm-gsmob.c
- $(COMPILE) $(srcdir)/guile/scm-gsmob.c
- $(POSTCOMPILE)
-
-scm-iterator.o: $(srcdir)/guile/scm-iterator.c
- $(COMPILE) $(srcdir)/guile/scm-iterator.c
- $(POSTCOMPILE)
-
-scm-lazy-string.o: $(srcdir)/guile/scm-lazy-string.c
- $(COMPILE) $(srcdir)/guile/scm-lazy-string.c
- $(POSTCOMPILE)
-
-scm-math.o: $(srcdir)/guile/scm-math.c
- $(COMPILE) $(srcdir)/guile/scm-math.c
- $(POSTCOMPILE)
-
-scm-objfile.o: $(srcdir)/guile/scm-objfile.c
- $(COMPILE) $(srcdir)/guile/scm-objfile.c
- $(POSTCOMPILE)
-
-scm-param.o: $(srcdir)/guile/scm-param.c
- $(COMPILE) $(srcdir)/guile/scm-param.c
- $(POSTCOMPILE)
-
-scm-ports.o: $(srcdir)/guile/scm-ports.c
- $(COMPILE) $(srcdir)/guile/scm-ports.c
- $(POSTCOMPILE)
-
-scm-pretty-print.o: $(srcdir)/guile/scm-pretty-print.c
- $(COMPILE) $(srcdir)/guile/scm-pretty-print.c
- $(POSTCOMPILE)
-
-scm-progspace.o: $(srcdir)/guile/scm-progspace.c
- $(COMPILE) $(srcdir)/guile/scm-progspace.c
- $(POSTCOMPILE)
-
-scm-safe-call.o: $(srcdir)/guile/scm-safe-call.c
- $(COMPILE) $(srcdir)/guile/scm-safe-call.c
- $(POSTCOMPILE)
-
-scm-string.o: $(srcdir)/guile/scm-string.c
- $(COMPILE) $(srcdir)/guile/scm-string.c
- $(POSTCOMPILE)
-
-scm-symbol.o: $(srcdir)/guile/scm-symbol.c
- $(COMPILE) $(srcdir)/guile/scm-symbol.c
- $(POSTCOMPILE)
-
-scm-symtab.o: $(srcdir)/guile/scm-symtab.c
- $(COMPILE) $(srcdir)/guile/scm-symtab.c
- $(POSTCOMPILE)
-
-scm-type.o: $(srcdir)/guile/scm-type.c
- $(COMPILE) $(srcdir)/guile/scm-type.c
- $(POSTCOMPILE)
-
-scm-utils.o: $(srcdir)/guile/scm-utils.c
- $(COMPILE) $(srcdir)/guile/scm-utils.c
- $(POSTCOMPILE)
-
-scm-value.o: $(srcdir)/guile/scm-value.c
- $(COMPILE) $(srcdir)/guile/scm-value.c
+%.o: $(srcdir)/guile/%.c
+ $(COMPILE) $<
$(POSTCOMPILE)

# gdb/python/ dependencies
@@ -2579,156 +2103,8 @@ scm-value.o: $(srcdir)/guile/scm-value.c
# Flags needed to compile Python code
PYTHON_CFLAGS=@PYTHON_CFLAGS@

-python.o: $(srcdir)/python/python.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python.c
- $(POSTCOMPILE)
-
-py-arch.o: $(srcdir)/python/py-arch.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-arch.c
- $(POSTCOMPILE)
-
-py-auto-load.o: $(srcdir)/python/py-auto-load.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-auto-load.c
- $(POSTCOMPILE)
-
-py-block.o: $(srcdir)/python/py-block.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-block.c
- $(POSTCOMPILE)
-
-py-bpevent.o: $(srcdir)/python/py-bpevent.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-bpevent.c
- $(POSTCOMPILE)
-
-py-breakpoint.o: $(srcdir)/python/py-breakpoint.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-breakpoint.c
- $(POSTCOMPILE)
-
-py-cmd.o: $(srcdir)/python/py-cmd.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-cmd.c
- $(POSTCOMPILE)
-
-py-continueevent.o: $(srcdir)/python/py-continueevent.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-continueevent.c
- $(POSTCOMPILE)
-
-py-xmethods.o: $(srcdir)/python/py-xmethods.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-xmethods.c
- $(POSTCOMPILE)
-
-py-event.o: $(srcdir)/python/py-event.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-event.c
- $(POSTCOMPILE)
-
-py-evtregistry.o: $(srcdir)/python/py-evtregistry.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-evtregistry.c
- $(POSTCOMPILE)
-
-py-evts.o: $(srcdir)/python/py-evts.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-evts.c
- $(POSTCOMPILE)
-
-py-exitedevent.o: $(srcdir)/python/py-exitedevent.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-exitedevent.c
- $(POSTCOMPILE)
-
-py-finishbreakpoint.o: $(srcdir)/python/py-finishbreakpoint.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-finishbreakpoint.c
- $(POSTCOMPILE)
-
-py-frame.o: $(srcdir)/python/py-frame.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-frame.c
- $(POSTCOMPILE)
-
-py-framefilter.o: $(srcdir)/python/py-framefilter.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-framefilter.c
- $(POSTCOMPILE)
-
-py-function.o: $(srcdir)/python/py-function.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c
- $(POSTCOMPILE)
-
-py-gdb-readline.o: $(srcdir)/python/py-gdb-readline.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-gdb-readline.c
- $(POSTCOMPILE)
-
-py-inferior.o: $(srcdir)/python/py-inferior.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-inferior.c
- $(POSTCOMPILE)
-
-py-infevents.o: $(srcdir)/python/py-infevents.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-infevents.c
- $(POSTCOMPILE)
-
-py-infthread.o: $(srcdir)/python/py-infthread.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-infthread.c
- $(POSTCOMPILE)
-
-py-lazy-string.o: $(srcdir)/python/py-lazy-string.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-lazy-string.c
- $(POSTCOMPILE)
-
-py-linetable.o: $(srcdir)/python/py-linetable.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-linetable.c
- $(POSTCOMPILE)
-
-py-newobjfileevent.o: $(srcdir)/python/py-newobjfileevent.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-newobjfileevent.c
- $(POSTCOMPILE)
-
-py-objfile.o: $(srcdir)/python/py-objfile.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-objfile.c
- $(POSTCOMPILE)
-
-py-param.o: $(srcdir)/python/py-param.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-param.c
- $(POSTCOMPILE)
-
-py-prettyprint.o: $(srcdir)/python/py-prettyprint.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-prettyprint.c
- $(POSTCOMPILE)
-
-py-progspace.o: $(srcdir)/python/py-progspace.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-progspace.c
- $(POSTCOMPILE)
-
-py-signalevent.o: $(srcdir)/python/py-signalevent.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-signalevent.c
- $(POSTCOMPILE)
-
-py-stopevent.o: $(srcdir)/python/py-stopevent.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-stopevent.c
- $(POSTCOMPILE)
-
-py-symbol.o: $(srcdir)/python/py-symbol.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-symbol.c
- $(POSTCOMPILE)
-
-py-symtab.o: $(srcdir)/python/py-symtab.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-symtab.c
- $(POSTCOMPILE)
-
-py-threadevent.o: $(srcdir)/python/py-threadevent.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-threadevent.c
- $(POSTCOMPILE)
-
-py-type.o: $(srcdir)/python/py-type.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-type.c
- $(POSTCOMPILE)
-
-py-unwind.o: $(srcdir)/python/py-unwind.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-unwind.c
- $(POSTCOMPILE)
-
-py-utils.o: $(srcdir)/python/py-utils.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-utils.c
- $(POSTCOMPILE)
-
-py-value.o: $(srcdir)/python/py-value.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-value.c
- $(POSTCOMPILE)
-
-py-varobj.o: $(srcdir)/python/py-varobj.c
- $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-varobj.c
+%.o: $(srcdir)/python/%.c
+ $(COMPILE) $(PYTHON_CFLAGS) $<
$(POSTCOMPILE)

#
--
2.10.0