[RFA,08/13] Move python object files to python subdirectory

Message ID 20171121221023.23992-9-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Nov. 21, 2017, 10:10 p.m. UTC
  Move the object files corresponding to python/*.c to the python
subdirectory in the build tree.

Because special CFLAGS are passed just to Python compilations, this
patch also required the addition of a pattern rule to update
INTERNAL_CFLAGS for here.

ChangeLog
2017-11-21  Tom Tromey  <tom@tromey.com>

	* Makefile.in (SUBDIR_PYTHON_OBS): Redefine.
	(CONFIG_SRC_SUBDIR): Add python.
	(%.o): Remove python rule.
	(python/%.o): New rule.
	* configure: Rebuild.
	* configure.ac (CONFIG_OBS): Refer to python/python.o
---
 gdb/ChangeLog    |  9 +++++++++
 gdb/Makefile.in  | 55 ++++++-------------------------------------------------
 gdb/configure    |  2 +-
 gdb/configure.ac |  2 +-
 4 files changed, 17 insertions(+), 51 deletions(-)
  

Patch

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index aab3a38588..93d819e11d 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -359,50 +359,6 @@  SUBDIR_GUILE_CFLAGS =
 #
 # python sub directory definitons
 #
-SUBDIR_PYTHON_OBS = \
-	py-arch.o \
-	py-auto-load.o \
-	py-block.o \
-	py-bpevent.o \
-	py-breakpoint.o \
-	py-cmd.o \
-	py-continueevent.o \
-	py-event.o \
-	py-evtregistry.o \
-	py-evts.o \
-	py-exitedevent.o \
-	py-finishbreakpoint.o \
-	py-frame.o \
-	py-framefilter.o \
-	py-function.o \
-	py-gdb-readline.o \
-	py-inferior.o \
-	py-infevents.o \
-	py-infthread.o \
-	py-instruction.o \
-	py-lazy-string.o \
-	py-linetable.o \
-	py-newobjfileevent.o \
-	py-objfile.o \
-	py-param.o \
-	py-prettyprint.o \
-	py-progspace.o \
-	py-record.o \
-	py-record-btrace.o \
-	py-record-full.o \
-	py-signalevent.o \
-	py-stopevent.o \
-	py-symbol.o \
-	py-symtab.o \
-	py-threadevent.o \
-	py-type.o \
-	py-unwind.o \
-	py-utils.o \
-	py-value.o \
-	py-varobj.o \
-	py-xmethods.o \
-	python.o
-
 SUBDIR_PYTHON_SRCS = \
 	python/py-arch.c \
 	python/py-auto-load.c \
@@ -447,6 +403,8 @@  SUBDIR_PYTHON_SRCS = \
 	python/py-xmethods.c \
 	python/python.c
 
+SUBDIR_PYTHON_OBS = $(patsubst %.c,%.o,$(SUBDIR_PYTHON_SRCS))
+
 SUBDIR_PYTHON_DEPS =
 SUBDIR_PYTHON_LDFLAGS =
 SUBDIR_PYTHON_CFLAGS =
@@ -556,7 +514,7 @@  CONFIG_INSTALL = @CONFIG_INSTALL@
 CONFIG_UNINSTALL = @CONFIG_UNINSTALL@
 HAVE_NATIVE_GCORE_TARGET = @HAVE_NATIVE_GCORE_TARGET@
 
-CONFIG_SRC_SUBDIR = arch cli mi compile tui unittests guile
+CONFIG_SRC_SUBDIR = arch cli mi compile tui unittests guile python
 CONFIG_DEP_SUBDIR = $(addsuffix /$(DEPDIR),$(CONFIG_SRC_SUBDIR))
 
 # -I. for config files.
@@ -1844,6 +1802,9 @@  all: gdb$(EXEEXT) $(CONFIG_ALL)
 $(CONFIG_DEP_SUBDIR):
 	$(SHELL) $(srcdir)/../mkinstalldirs $@
 
+# Python files need special flags.
+python/%.o: INTERNAL_CFLAGS += $(PYTHON_CFLAGS)
+
 # Rules for compiling .c files in the various source subdirectories.
 %.o: ${srcdir}/common/%.c
 	$(COMPILE) $<
@@ -1857,10 +1818,6 @@  $(CONFIG_DEP_SUBDIR):
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: $(srcdir)/python/%.c
-	$(COMPILE) $(PYTHON_CFLAGS) $<
-	$(POSTCOMPILE)
-
 %.o: ${srcdir}/target/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
diff --git a/gdb/configure b/gdb/configure
index e5a5b7c34f..2c24ed4034 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -10219,7 +10219,7 @@  $as_echo "${python_has_threads}" >&6; }
 else
   # Even if Python support is not compiled in, we need to have this file
   # included so that the "python" command, et.al., still exists.
-  CONFIG_OBS="$CONFIG_OBS python.o"
+  CONFIG_OBS="$CONFIG_OBS python/python.o"
   CONFIG_SRCS="$CONFIG_SRCS python/python.c"
 fi
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index b9d456bc7c..3799278cdf 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1005,7 +1005,7 @@  if test "${have_libpython}" != no; then
 else
   # Even if Python support is not compiled in, we need to have this file
   # included so that the "python" command, et.al., still exists.
-  CONFIG_OBS="$CONFIG_OBS python.o"
+  CONFIG_OBS="$CONFIG_OBS python/python.o"
   CONFIG_SRCS="$CONFIG_SRCS python/python.c"
 fi