From: Mike Frysinger Date: Fri, 14 May 2021 08:39:39 +0000 (-0400) Subject: sim: common: start dedicated local.mk X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5bea0c32765c297541290a5e2bef6b24a86a069d;p=binutils-gdb.git sim: common: start dedicated local.mk 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. --- diff --git a/sim/ChangeLog b/sim/ChangeLog index d74d773f0d2..dbc3e1c3a79 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,10 @@ +2021-06-05 Mike Frysinger + + * Makefile.am: Include common/local.mk. + (SIM_ALL_RECURSIVE_DEPS): Define. + (all-recursive): New rule. + * Makefile.in: Regenerated. + 2021-05-16 Mike Frysinger * Makefile.am (pkginclude_HEADERS): Define. diff --git a/sim/Makefile.am b/sim/Makefile.am index 80a6d310bd5..79274beabd8 100644 --- a/sim/Makefile.am +++ b/sim/Makefile.am @@ -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) diff --git a/sim/Makefile.in b/sim/Makefile.in index cdbd0ac1dd4..1ff0b0c28cc 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -30,6 +30,25 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# +# 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 . + +# 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: diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 4ce0c4c22f9..ac348747803 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,11 @@ +2021-06-05 Mike Frysinger + + * 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 * Make-common.in (EXTRA_LIBS): Add $(LIBGNU_EXTRA_LIBS). diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index 160e9121a6d..b17b2e0f453 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -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 index 00000000000..357be755578 --- /dev/null +++ b/sim/common/local.mk @@ -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 . + +# 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 $@ diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog index aebd25173da..7ef9e1deb25 100644 --- a/sim/igen/ChangeLog +++ b/sim/igen/ChangeLog @@ -1,3 +1,8 @@ +2021-06-05 Mike Frysinger + + * local.mk (all-recursive): Delete rule. + (SIM_ALL_RECURSIVE_DEPS): Append. + 2021-05-04 Mike Frysinger * local.mk (igen/libigen.a): New target. diff --git a/sim/igen/local.mk b/sim/igen/local.mk index f2245727a27..a7e278661b7 100644 --- a/sim/igen/local.mk +++ b/sim/igen/local.mk @@ -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)