diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-11-06 16:56:39 +0700 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2023-01-10 01:15:26 -0500 |
commit | 54e26255ca9e1e39b1c5d091809c3afe350c3d01 (patch) | |
tree | 8ed8a5c65faef02f9c630381f58fdcd8d70e7bb1 /sim/common | |
parent | 638a9300b519307d9c85f3cd658f35c4d354a80c (diff) | |
download | gdb-54e26255ca9e1e39b1c5d091809c3afe350c3d01.zip gdb-54e26255ca9e1e39b1c5d091809c3afe350c3d01.tar.gz gdb-54e26255ca9e1e39b1c5d091809c3afe350c3d01.tar.bz2 |
sim: modules.c: move generation to top-level
Now that all arches create libsim.a from the top-level, we have full
access to their inputs, and can move the actual generation from the
subdir up to the top-level. This avoids recursive makes and will
help simplify state passing between the two.
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/Make-common.in | 25 | ||||
-rw-r--r-- | sim/common/local.mk | 28 |
2 files changed, 25 insertions, 28 deletions
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index f9f6ed1..15242c6 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -159,28 +159,6 @@ test-hw-events: $(srccom)/hw-events.c libsim.a $(CC) $(ALL_CFLAGS) -DMAIN -o test-hw-events$(EXEEXT) \ $(srccom)/hw-events.c libsim.a $(EXTRA_LIBS) -# See sim_pre_argv_init and sim_module_install in sim-module.c for more details. -modules.c: stamp-modules ; @true -stamp-modules: Makefile - $(ECHO_STAMP) modules.c - $(SILENCE) LANG=C ; export LANG ; \ - LC_ALL=C ; export LC_ALL ; \ - sed -n -e '/^sim_install_/{s/^\(sim_install_[a-z_0-9A-Z]*\).*/\1/;p}' $^ $(GEN_MODULES_C_SRCS) | sort >$@.l-tmp - @set -e; (\ - echo '/* Do not modify this file. */'; \ - echo '/* It is created automatically by the Makefile. */'; \ - echo '#include "libiberty.h"'; \ - echo '#include "sim-module.h"'; \ - sed -e 's:\(.*\):extern MODULE_INIT_FN \1;:' $@.l-tmp; \ - echo 'MODULE_INSTALL_FN * const sim_modules_detected[] = {'; \ - sed -e 's:\(.*\): \1,:' $@.l-tmp; \ - echo '};'; \ - echo 'const int sim_modules_detected_len = ARRAY_SIZE (sim_modules_detected);'; \ - ) >$@.tmp - $(SILENCE) $(SHELL) $(srcroot)/move-if-change $@.tmp modules.c - $(SILENCE) rm -f $@.l-tmp $@.tmp - $(SILENCE) touch $@ - # Support targets. install: @@ -214,8 +192,7 @@ TAGS: force *.[ch] ../common/*.[ch] mostlyclean clean: $(SIM_EXTRA_CLEAN) - rm -f *.[oa] *~ core \ - modules.c stamp-modules + rm -f *.[oa] *~ core distclean maintainer-clean realclean: clean rm -f TAGS Makefile diff --git a/sim/common/local.mk b/sim/common/local.mk index 128b770..debb55d 100644 --- a/sim/common/local.mk +++ b/sim/common/local.mk @@ -135,10 +135,30 @@ SIM_ALL_RECURSIVE_DEPS += $(%C%_HW_CONFIG_H_TARGETS) am_arch_d = $(subst -,_,$(@D)) GEN_MODULES_C_SRCS = \ $(wildcard \ - $(patsubst %.o,$(abs_srcdir)/%.c,$($(am_arch_d)_libsim_a_OBJECTS) $($(am_arch_d)_libsim_a_LIBADD)) \ - $(filter-out %.o,$(patsubst $(@D)/%.o,$(abs_srcdir)/common/%.c,$($(am_arch_d)_libsim_a_LIBADD)))) -%/modules.c: - $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) GEN_MODULES_C_SRCS="$(GEN_MODULES_C_SRCS)" -C $(@D) $(@F) + $(patsubst %,$(srcdir)/%,$($(am_arch_d)_libsim_a_SOURCES)) \ + $(patsubst %.o,$(srcdir)/%.c,$($(am_arch_d)_libsim_a_OBJECTS) $($(am_arch_d)_libsim_a_LIBADD)) \ + $(filter-out %.o,$(patsubst $(@D)/%.o,$(srcdir)/common/%.c,$($(am_arch_d)_libsim_a_LIBADD)))) +%/modules.c: %/stamp-modules ; @true +%/stamp-modules: Makefile + $(AM_V_GEN)set -e; \ + LANG=C ; export LANG; \ + LC_ALL=C ; export LC_ALL; \ + sed -n -e '/^sim_install_/{s/^\(sim_install_[a-z_0-9A-Z]*\).*/\1/;p}' $(GEN_MODULES_C_SRCS) | sort >$@.l-tmp; \ + ( \ + echo '/* Do not modify this file. */'; \ + echo '/* It is created automatically by the Makefile. */'; \ + echo '#include "libiberty.h"'; \ + echo '#include "sim-module.h"'; \ + sed -e 's:\(.*\):extern MODULE_INIT_FN \1;:' $@.l-tmp; \ + echo 'MODULE_INSTALL_FN * const sim_modules_detected[] = {'; \ + sed -e 's:\(.*\): \1,:' $@.l-tmp; \ + echo '};'; \ + echo 'const int sim_modules_detected_len = ARRAY_SIZE (sim_modules_detected);'; \ + ) >$@.tmp; \ + $(SHELL) $(srcroot)/move-if-change $@.tmp $(@D)/modules.c; \ + rm -f $@.l-tmp; \ + touch $@ +.PRECIOUS: %/stamp-modules ## NB: The ppc port doesn't currently utilize the modules API, so skip it. %C%_GEN_MODULES_C_TARGETS = $(patsubst %,%/modules.c,$(filter-out ppc,$(SIM_ENABLED_ARCHES))) |