sim: common: start dedicated local.mk
authorMike Frysinger <vapier@gentoo.org>
Fri, 14 May 2021 08:39:39 +0000 (04:39 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 5 Jun 2021 14:09:27 +0000 (10:09 -0400)
This provides a space to generate things that we only need to build
once per-arch.  Some day that will be all of common/, but for now,
we move the version.c management in.

sim/ChangeLog
sim/Makefile.am
sim/Makefile.in
sim/common/ChangeLog
sim/common/Make-common.in
sim/common/local.mk [new file with mode: 0644]
sim/igen/ChangeLog
sim/igen/local.mk

index d74d773f0d295f2b10898b4a27c8e023864599ff..dbc3e1c3a79727277c8701e7de236b25aecc267e 100644 (file)
@@ -1,3 +1,10 @@
+2021-06-05  Mike Frysinger  <vapier@gentoo.org>
+
+       * Makefile.am: Include common/local.mk.
+       (SIM_ALL_RECURSIVE_DEPS): Define.
+       (all-recursive): New rule.
+       * Makefile.in: Regenerated.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
        * Makefile.am (pkginclude_HEADERS): Define.
index 80a6d310bd59722fb8a0f0aa015243f3c9f5135f..79274beabd8d06ddc546310ee2bcfcc68154fd39 100644 (file)
@@ -40,6 +40,10 @@ AM_CPPFLAGS = -I$(srcroot)/include
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
 
+# Deps to add to the all-recursive target.  These are built before descending
+# into any subdirs.
+SIM_ALL_RECURSIVE_DEPS =
+
 # Generate nltvals.def for newlib/libgloss using devo and build tree.
 # This file is shipped with distributions so we build in the source dir.
 # Use `make nltvals' to rebuild.
@@ -55,7 +59,10 @@ pkginclude_HEADERS = \
        $(srcroot)/include/sim/callback.h \
        $(srcroot)/include/sim/sim.h
 
+include common/local.mk
 if SIM_ENABLE_IGEN
 include igen/local.mk
 endif
 include testsuite/local.mk
+
+all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
index cdbd0ac1dd444cfeae8c9f9caa03e91294af834f..1ff0b0c28ccb11ee0842f4f568a0878b58441df6 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+#
+# Copyright (C) 1997-2021 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Parts of the common/ sim code that have been unified.
+# Most still lives in common/Make-common.in.
+
 # The IGEN simulator generator for GDB, the GNU Debugger.
 #
 # Copyright 2002-2021 Free Software Foundation, Inc.
@@ -161,9 +180,13 @@ target_triplet = @target@
 check_PROGRAMS = $(am__EXEEXT_3)
 EXTRA_PROGRAMS = $(am__EXEEXT_2) testsuite/common/bits-gen$(EXEEXT) \
        testsuite/common/fpu-tst$(EXEEXT)
-@SIM_ENABLE_IGEN_TRUE@am__append_1 = igen/libigen.a
-@SIM_ENABLE_IGEN_TRUE@am__append_2 = $(igen_IGEN_TOOLS)
+
+# This makes sure igen is available before building the arch-subdirs which
+# need to run the igen tool.
+@SIM_ENABLE_IGEN_TRUE@am__append_1 = igen/igen$(EXEEXT)
+@SIM_ENABLE_IGEN_TRUE@am__append_2 = igen/libigen.a
 @SIM_ENABLE_IGEN_TRUE@am__append_3 = $(igen_IGEN_TOOLS)
+@SIM_ENABLE_IGEN_TRUE@am__append_4 = $(igen_IGEN_TOOLS)
 TESTS = testsuite/common/bits32m0$(EXEEXT) \
        testsuite/common/bits32m31$(EXEEXT) \
        testsuite/common/bits64m0$(EXEEXT) \
@@ -191,9 +214,13 @@ AM_V_AR = $(am__v_AR_@AM_V@)
 am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
 am__v_AR_0 = @echo "  AR      " $@;
 am__v_AR_1 = 
+common_libcommon_a_AR = $(AR) $(ARFLAGS)
+common_libcommon_a_LIBADD =
+am__dirstamp = $(am__leading_dot)dirstamp
+am_common_libcommon_a_OBJECTS = common/version.$(OBJEXT)
+common_libcommon_a_OBJECTS = $(am_common_libcommon_a_OBJECTS)
 igen_libigen_a_AR = $(AR) $(ARFLAGS)
 igen_libigen_a_LIBADD =
-am__dirstamp = $(am__leading_dot)dirstamp
 @SIM_ENABLE_IGEN_TRUE@am_igen_libigen_a_OBJECTS =  \
 @SIM_ENABLE_IGEN_TRUE@ igen/table.$(OBJEXT) igen/lf.$(OBJEXT) \
 @SIM_ENABLE_IGEN_TRUE@ igen/misc.$(OBJEXT) \
@@ -304,14 +331,14 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(igen_libigen_a_SOURCES) $(igen_filter_SOURCES) \
-       $(igen_gen_SOURCES) $(igen_igen_SOURCES) \
-       $(igen_ld_cache_SOURCES) $(igen_ld_decode_SOURCES) \
-       $(igen_ld_insn_SOURCES) $(igen_table_SOURCES) \
-       testsuite/common/alu-tst.c testsuite/common/bits-gen.c \
-       testsuite/common/bits32m0.c testsuite/common/bits32m31.c \
-       testsuite/common/bits64m0.c testsuite/common/bits64m63.c \
-       testsuite/common/fpu-tst.c
+SOURCES = $(common_libcommon_a_SOURCES) $(igen_libigen_a_SOURCES) \
+       $(igen_filter_SOURCES) $(igen_gen_SOURCES) \
+       $(igen_igen_SOURCES) $(igen_ld_cache_SOURCES) \
+       $(igen_ld_decode_SOURCES) $(igen_ld_insn_SOURCES) \
+       $(igen_table_SOURCES) testsuite/common/alu-tst.c \
+       testsuite/common/bits-gen.c testsuite/common/bits32m0.c \
+       testsuite/common/bits32m31.c testsuite/common/bits64m0.c \
+       testsuite/common/bits64m63.c testsuite/common/fpu-tst.c
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
        ctags-recursive dvi-recursive html-recursive info-recursive \
        install-data-recursive install-dvi-recursive \
@@ -678,20 +705,33 @@ ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
 srcroot = $(srcdir)/..
 SUBDIRS = @subdirs@
 AM_MAKEFLAGS = SIM_PRIMARY_TARGET=$(SIM_PRIMARY_TARGET)
-noinst_LIBRARIES = $(am__append_1)
+
+# NB: libcommon.a isn't used directly by ports.  We need a target for common
+# objects to be a part of, and ports use the individual objects directly.
+noinst_LIBRARIES = common/libcommon.a $(am__append_2)
 CLEANFILES = testsuite/common/bits-gen testsuite/common/bits32m0.c \
        testsuite/common/bits32m31.c testsuite/common/bits64m0.c \
        testsuite/common/bits64m63.c
 DISTCLEANFILES = 
-MOSTLYCLEANFILES = core $(am__append_3) site-srcdir.exp testrun.log \
+MOSTLYCLEANFILES = core $(am__append_4) site-srcdir.exp testrun.log \
        testrun.sum
-AM_CPPFLAGS = -I$(srcroot)/include
+AM_CPPFLAGS = -I$(srcroot)/include -I$(srcdir)/common
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
+
+# Deps to add to the all-recursive target.  These are built before descending
+# into any subdirs.
+
+# This makes sure common parts are available before building the arch-subdirs
+# which will refer to these.
+SIM_ALL_RECURSIVE_DEPS = common/libcommon.a $(am__append_1)
 pkginclude_HEADERS = \
        $(srcroot)/include/sim/callback.h \
        $(srcroot)/include/sim/sim.h
 
+common_libcommon_a_SOURCES = \
+       common/version.c
+
 @SIM_ENABLE_IGEN_TRUE@igen_libigen_a_SOURCES = \
 @SIM_ENABLE_IGEN_TRUE@ igen/table.c \
 @SIM_ENABLE_IGEN_TRUE@ igen/lf.c \
@@ -747,7 +787,7 @@ all: all-recursive
 .SUFFIXES: .c .log .o .obj .test .test$(EXEEXT) .trs
 am--refresh: Makefile
        @:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/igen/local.mk $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/common/local.mk $(am__configure_deps)
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/common/local.mk $(srcdir)/igen/local.mk $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/common/local.mk $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -769,7 +809,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
            echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
            cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
        esac;
-$(srcdir)/igen/local.mk $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/common/local.mk $(am__empty):
+$(srcdir)/common/local.mk $(srcdir)/igen/local.mk $(srcdir)/testsuite/local.mk $(srcdir)/testsuite/common/local.mk $(am__empty):
 
 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
        $(SHELL) ./config.status --recheck
@@ -782,6 +822,19 @@ $(am__aclocal_m4_deps):
 
 clean-noinstLIBRARIES:
        -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+common/$(am__dirstamp):
+       @$(MKDIR_P) common
+       @: > common/$(am__dirstamp)
+common/$(DEPDIR)/$(am__dirstamp):
+       @$(MKDIR_P) common/$(DEPDIR)
+       @: > common/$(DEPDIR)/$(am__dirstamp)
+common/version.$(OBJEXT): common/$(am__dirstamp) \
+       common/$(DEPDIR)/$(am__dirstamp)
+
+common/libcommon.a: $(common_libcommon_a_OBJECTS) $(common_libcommon_a_DEPENDENCIES) $(EXTRA_common_libcommon_a_DEPENDENCIES) common/$(am__dirstamp)
+       $(AM_V_at)-rm -f common/libcommon.a
+       $(AM_V_AR)$(common_libcommon_a_AR) common/libcommon.a $(common_libcommon_a_OBJECTS) $(common_libcommon_a_LIBADD)
+       $(AM_V_at)$(RANLIB) common/libcommon.a
 igen/$(am__dirstamp):
        @$(MKDIR_P) igen
        @: > igen/$(am__dirstamp)
@@ -882,12 +935,14 @@ testsuite/common/fpu-tst.$(OBJEXT): testsuite/common/$(am__dirstamp) \
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
+       -rm -f common/*.$(OBJEXT)
        -rm -f igen/*.$(OBJEXT)
        -rm -f testsuite/common/*.$(OBJEXT)
 
 distclean-compile:
        -rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@common/$(DEPDIR)/version.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@igen/$(DEPDIR)/filter.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@igen/$(DEPDIR)/filter_host.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@igen/$(DEPDIR)/gen-engine.Po@am__quote@
@@ -1319,6 +1374,8 @@ clean-generic:
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
        -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+       -rm -f common/$(DEPDIR)/$(am__dirstamp)
+       -rm -f common/$(am__dirstamp)
        -rm -f igen/$(DEPDIR)/$(am__dirstamp)
        -rm -f igen/$(am__dirstamp)
        -rm -f testsuite/common/$(DEPDIR)/$(am__dirstamp)
@@ -1335,7 +1392,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-noinstLIBRARIES \
 
 distclean: distclean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-       -rm -rf igen/$(DEPDIR) testsuite/common/$(DEPDIR)
+       -rm -rf common/$(DEPDIR) igen/$(DEPDIR) testsuite/common/$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-DEJAGNU distclean-compile \
        distclean-generic distclean-tags
@@ -1383,7 +1440,7 @@ installcheck-am:
 maintainer-clean: maintainer-clean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
        -rm -rf $(top_srcdir)/autom4te.cache
-       -rm -rf igen/$(DEPDIR) testsuite/common/$(DEPDIR)
+       -rm -rf common/$(DEPDIR) igen/$(DEPDIR) testsuite/common/$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -1434,9 +1491,10 @@ nltvals:
        $(abs_srcdir)/common/gennltvals.py --cpp "$(CPP)" --output nltvals.def --srcroot $(srcroot)
        $(SHELL) $(srcroot)/move-if-change nltvals.def $(abs_srcdir)/common/nltvals.def
 
-# This makes sure igen is available before building the arch-subdirs which
-# need to run the igen tool.
-@SIM_ENABLE_IGEN_TRUE@all-recursive: igen/igen$(EXEEXT)
+common/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/common/create-version.sh
+       $(SHELL) $(srcdir)/common/create-version.sh $(srcroot)/gdb $@.tmp
+       $(SHELL) $(srcroot)/move-if-change $@.tmp $@
+       touch $@
 
 # Alias for developers.
 @SIM_ENABLE_IGEN_TRUE@igen: igen/igen$(EXEEXT)
@@ -1515,6 +1573,8 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen testsuite/common/bits-ts
        cat $(srcdir)/testsuite/common/bits-tst.c >> $@.tmp
        mv $@.tmp $@
 
+all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
index 4ce0c4c22f9b16fe4717456c4030c3ef0a264253..ac348747803393173a675f8266c805af9aa7a6cc 100644 (file)
@@ -1,3 +1,11 @@
+2021-06-05  Mike Frysinger  <vapier@gentoo.org>
+
+       * Make-common.in (COMMON_OBJS): Define.
+       (LIB_OBJS): Replace version.o with $(COMMON_OBJS).
+       (version.c): Delete target.
+       (generated_files): Delete version.c.
+       * local.mk: New file.
+
 2021-05-29  Mike Frysinger  <vapier@gentoo.org>
 
        * Make-common.in (EXTRA_LIBS): Add $(LIBGNU_EXTRA_LIBS).
index 160e9121a6d3f9af9e5192c1109cc3eba6996843..b17b2e0f45306309edcf2ce155151b1ed1023a5d 100644 (file)
@@ -255,8 +255,9 @@ LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB)
 EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
        $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
 
-LIB_OBJS = callback.o modules.o syscall.o targ-map.o version.o \
-       $(SIM_OBJS)
+COMMON_OBJS = ../common/version.o
+
+LIB_OBJS = callback.o modules.o syscall.o targ-map.o $(COMMON_OBJS) $(SIM_OBJS)
 
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS)
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
@@ -297,11 +298,6 @@ stamp-tvals: gentmap
        $(SHELL) $(srcroot)/move-if-change tmp-tmap.c targ-map.c
        touch stamp-tvals
 
-version.c: Makefile $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcroot)/sim/common/create-version.sh
-       $(SHELL) $(srcroot)/sim/common/create-version.sh $(srcroot)/gdb $@.tmp
-       $(SHELL) $(srcroot)/move-if-change $@.tmp $@
-       touch $@
-
 #
 # Rules for building sim-* components.  Triggered by listing the corresponding
 # .o file in the list of simulator targets.
@@ -429,8 +425,7 @@ generated_files = \
        hw-config.h \
        modules.c \
        targ-map.c \
-       targ-vals.h \
-       version.c
+       targ-vals.h
 
 # Ensure that generated files are created early.  Use order-only
 # dependencies if available.  They require GNU make 3.80 or newer,
diff --git a/sim/common/local.mk b/sim/common/local.mk
new file mode 100644 (file)
index 0000000..357be75
--- /dev/null
@@ -0,0 +1,37 @@
+## See sim/Makefile.am.
+#
+# Copyright (C) 1997-2021 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Parts of the common/ sim code that have been unified.
+# Most still lives in common/Make-common.in.
+
+AM_CPPFLAGS += -I$(srcdir)/%D%
+
+# This makes sure common parts are available before building the arch-subdirs
+# which will refer to these.
+SIM_ALL_RECURSIVE_DEPS += \
+       %D%/libcommon.a
+
+# NB: libcommon.a isn't used directly by ports.  We need a target for common
+# objects to be a part of, and ports use the individual objects directly.
+noinst_LIBRARIES += %D%/libcommon.a
+%C%_libcommon_a_SOURCES = \
+       %D%/version.c
+
+%D%/version.c: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcdir)/%D%/create-version.sh
+       $(SHELL) $(srcdir)/%D%/create-version.sh $(srcroot)/gdb $@.tmp
+       $(SHELL) $(srcroot)/move-if-change $@.tmp $@
+       touch $@
index aebd25173dae8e47739a1b2985980a9e3eedbaa5..7ef9e1deb25b509b615e2beddadedf43a43d8f71 100644 (file)
@@ -1,3 +1,8 @@
+2021-06-05  Mike Frysinger  <vapier@gentoo.org>
+
+       * local.mk (all-recursive): Delete rule.
+       (SIM_ALL_RECURSIVE_DEPS): Append.
+
 2021-05-04  Mike Frysinger  <vapier@gentoo.org>
 
        * local.mk (igen/libigen.a): New target.
index f2245727a2709a5694a94590f01e1aa1d35e9f8b..a7e278661b7b7e6b3c396371d18efe7ce6a97fe7 100644 (file)
@@ -21,7 +21,7 @@
 
 # This makes sure igen is available before building the arch-subdirs which
 # need to run the igen tool.
-all-recursive: igen/igen$(EXEEXT)
+SIM_ALL_RECURSIVE_DEPS += igen/igen$(EXEEXT)
 
 # Alias for developers.
 igen: %D%/igen$(EXEEXT)
This page took 0.032969 seconds and 4 git commands to generate.