sim: build: move install steps to the top-level
authorMike Frysinger <vapier@gentoo.org>
Sat, 5 Nov 2022 07:35:00 +0000 (14:35 +0700)
committerMike Frysinger <vapier@gentoo.org>
Sat, 5 Nov 2022 09:26:08 +0000 (16:26 +0700)
We still have to maintain custom install rules due to how we rename
arch-specific files with an arch prefix in their name, but we can at
least unify the logic in the common dir.

sim/Makefile.am
sim/Makefile.in
sim/README-HACKING
sim/arch-subdir.mk.in
sim/common/Make-common.in
sim/erc32/Makefile.in
sim/erc32/local.mk
sim/ppc/Makefile.in

index 7ea013ac1965e8d34542eb65bc11b77ca1b993b4..523d8f8dec96f82b60a1ef7eff2a43ea3905cf6b 100644 (file)
@@ -59,6 +59,10 @@ 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 =
+## Deps to add to the install-data-local target.
+SIM_INSTALL_DATA_LOCAL_DEPS =
+## Deps to add to the install-exec-local target.
+SIM_INSTALL_EXEC_LOCAL_DEPS =
 
 # Generate target constants for newlib/libgloss from its source tree.
 # This file is shipped with distributions so we build in the source dir.
@@ -138,3 +142,26 @@ include v850/local.mk
 endif
 
 all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
+
+install-data-local: installdirs $(SIM_INSTALL_DATA_LOCAL_DEPS)
+       $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(libdir)
+       lib=`echo sim | sed '$(program_transform_name)'`; \
+       for d in $(SUBDIRS); do \
+               if [ -e $$d/run$(EXEEXT) ]; then \
+                       n="$$lib"; \
+                       [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
+                       n="lib$$n.a"; \
+                       $(INSTALL_DATA) $$d/libsim.a $(DESTDIR)$(libdir)/$$n || exit 1; \
+               fi; \
+       done
+
+install-exec-local: installdirs $(SIM_INSTALL_EXEC_LOCAL_DEPS)
+       $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
+       run=`echo run | sed '$(program_transform_name)'`; \
+       for d in $(SUBDIRS); do \
+               if [ -e $$d/run$(EXEEXT) ]; then \
+                       n="$$run"; \
+                       [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
+                       $(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
+               fi; \
+       done
index b9015b351e27f4df472ee0a1eee83a78af2aa4e2..7591aaa40b4a5373efe67b60c0c72a4e6141f32c 100644 (file)
@@ -135,34 +135,35 @@ TESTS = testsuite/common/bits32m0$(EXEEXT) \
 @SIM_ENABLE_ARCH_d10v_TRUE@am__append_14 = $(d10v_BUILD_OUTPUTS)
 @SIM_ENABLE_ARCH_d10v_TRUE@am__append_15 = d10v/gencode
 @SIM_ENABLE_ARCH_d10v_TRUE@am__append_16 = $(d10v_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_frv_TRUE@am__append_17 = $(frv_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_erc32_TRUE@am__append_17 = sim-%D-install-exec-local
 @SIM_ENABLE_ARCH_frv_TRUE@am__append_18 = $(frv_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_iq2000_TRUE@am__append_19 = $(iq2000_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_frv_TRUE@am__append_19 = $(frv_BUILD_OUTPUTS)
 @SIM_ENABLE_ARCH_iq2000_TRUE@am__append_20 = $(iq2000_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_lm32_TRUE@am__append_21 = $(lm32_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_iq2000_TRUE@am__append_21 = $(iq2000_BUILD_OUTPUTS)
 @SIM_ENABLE_ARCH_lm32_TRUE@am__append_22 = $(lm32_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_m32c_TRUE@am__append_23 = $(m32c_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_m32c_TRUE@am__append_24 = m32c/opc2c
-@SIM_ENABLE_ARCH_m32c_TRUE@am__append_25 = \
+@SIM_ENABLE_ARCH_lm32_TRUE@am__append_23 = $(lm32_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_m32c_TRUE@am__append_24 = $(m32c_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_m32c_TRUE@am__append_25 = m32c/opc2c
+@SIM_ENABLE_ARCH_m32c_TRUE@am__append_26 = \
 @SIM_ENABLE_ARCH_m32c_TRUE@    $(m32c_BUILD_OUTPUTS) \
 @SIM_ENABLE_ARCH_m32c_TRUE@    m32c/m32c.c.log \
 @SIM_ENABLE_ARCH_m32c_TRUE@    m32c/r8c.c.log
 
-@SIM_ENABLE_ARCH_m32r_TRUE@am__append_26 = $(m32r_BUILD_OUTPUTS)
 @SIM_ENABLE_ARCH_m32r_TRUE@am__append_27 = $(m32r_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_m68hc11_TRUE@am__append_28 = $(m68hc11_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_m68hc11_TRUE@am__append_29 = m68hc11/gencode
-@SIM_ENABLE_ARCH_m68hc11_TRUE@am__append_30 = $(m68hc11_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_mn10300_TRUE@am__append_31 = $(mn10300_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_m32r_TRUE@am__append_28 = $(m32r_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_m68hc11_TRUE@am__append_29 = $(m68hc11_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_m68hc11_TRUE@am__append_30 = m68hc11/gencode
+@SIM_ENABLE_ARCH_m68hc11_TRUE@am__append_31 = $(m68hc11_BUILD_OUTPUTS)
 @SIM_ENABLE_ARCH_mn10300_TRUE@am__append_32 = $(mn10300_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_moxie_TRUE@am__append_33 = moxie/$(am__dirstamp)
-@SIM_ENABLE_ARCH_or1k_TRUE@am__append_34 = $(or1k_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_mn10300_TRUE@am__append_33 = $(mn10300_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_moxie_TRUE@am__append_34 = moxie/$(am__dirstamp)
 @SIM_ENABLE_ARCH_or1k_TRUE@am__append_35 = $(or1k_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_sh_TRUE@am__append_36 = $(sh_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_sh_TRUE@am__append_37 = sh/gencode
-@SIM_ENABLE_ARCH_sh_TRUE@am__append_38 = $(sh_BUILD_OUTPUTS)
-@SIM_ENABLE_ARCH_v850_TRUE@am__append_39 = $(v850_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_or1k_TRUE@am__append_36 = $(or1k_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_sh_TRUE@am__append_37 = $(sh_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_sh_TRUE@am__append_38 = sh/gencode
+@SIM_ENABLE_ARCH_sh_TRUE@am__append_39 = $(sh_BUILD_OUTPUTS)
 @SIM_ENABLE_ARCH_v850_TRUE@am__append_40 = $(v850_BUILD_OUTPUTS)
+@SIM_ENABLE_ARCH_v850_TRUE@am__append_41 = $(v850_BUILD_OUTPUTS)
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
@@ -921,13 +922,13 @@ CLEANFILES = common/version.c common/version.c-stamp \
        testsuite/common/bits-gen testsuite/common/bits32m0.c \
        testsuite/common/bits32m31.c testsuite/common/bits64m0.c \
        testsuite/common/bits64m63.c
-DISTCLEANFILES = $(am__append_33)
+DISTCLEANFILES = $(am__append_34)
 MOSTLYCLEANFILES = core $(am__append_5) site-sim-config.exp \
        testrun.log testrun.sum $(am__append_7) $(am__append_10) \
-       $(am__append_13) $(am__append_16) $(am__append_18) \
-       $(am__append_20) $(am__append_22) $(am__append_25) \
-       $(am__append_27) $(am__append_30) $(am__append_32) \
-       $(am__append_35) $(am__append_38) $(am__append_40)
+       $(am__append_13) $(am__append_16) $(am__append_19) \
+       $(am__append_21) $(am__append_23) $(am__append_26) \
+       $(am__append_28) $(am__append_31) $(am__append_33) \
+       $(am__append_36) $(am__append_39) $(am__append_41)
 AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
 AM_CPPFLAGS = $(INCGNU) -I$(srcroot)/include -I../bfd -I.. \
        $(SIM_HW_CFLAGS) $(SIM_INLINE) -I$(srcdir)/common \
@@ -938,10 +939,12 @@ COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUIL
 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
 SIM_ALL_RECURSIVE_DEPS = common/libcommon.a $(am__append_2) \
        $(am__append_6) $(am__append_8) $(am__append_12) \
-       $(am__append_14) $(am__append_17) $(am__append_19) \
-       $(am__append_21) $(am__append_23) $(am__append_26) \
-       $(am__append_28) $(am__append_31) $(am__append_34) \
-       $(am__append_36) $(am__append_39)
+       $(am__append_14) $(am__append_18) $(am__append_20) \
+       $(am__append_22) $(am__append_24) $(am__append_27) \
+       $(am__append_29) $(am__append_32) $(am__append_35) \
+       $(am__append_37) $(am__append_40)
+SIM_INSTALL_DATA_LOCAL_DEPS = 
+SIM_INSTALL_EXEC_LOCAL_DEPS = $(am__append_17)
 common_libcommon_a_SOURCES = \
        common/callback.c \
        common/portability.c \
@@ -2214,7 +2217,7 @@ info: info-recursive
 
 info-am:
 
-install-data-am: install-armdocDATA install-dtbDATA \
+install-data-am: install-armdocDATA install-data-local install-dtbDATA \
        install-erc32docDATA install-frvdocDATA install-or1kdocDATA \
        install-pkgincludeHEADERS install-ppcdocDATA install-rxdocDATA
 
@@ -2222,7 +2225,7 @@ install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
-install-exec-am:
+install-exec-am: install-exec-local
 
 install-html: install-html-recursive
 
@@ -2279,20 +2282,21 @@ uninstall-am: uninstall-armdocDATA uninstall-dtbDATA \
        distclean-generic distclean-hdr distclean-libtool \
        distclean-tags dvi dvi-am html html-am info info-am install \
        install-am install-armdocDATA install-data install-data-am \
-       install-dtbDATA install-dvi install-dvi-am \
+       install-data-local install-dtbDATA install-dvi install-dvi-am \
        install-erc32docDATA install-exec install-exec-am \
-       install-frvdocDATA install-html install-html-am install-info \
-       install-info-am install-man install-or1kdocDATA install-pdf \
-       install-pdf-am install-pkgincludeHEADERS install-ppcdocDATA \
-       install-ps install-ps-am install-rxdocDATA install-strip \
-       installcheck installcheck-am installdirs installdirs-am \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-       pdf pdf-am ps ps-am recheck tags tags-am uninstall \
-       uninstall-am uninstall-armdocDATA uninstall-dtbDATA \
-       uninstall-erc32docDATA uninstall-frvdocDATA \
-       uninstall-or1kdocDATA uninstall-pkgincludeHEADERS \
-       uninstall-ppcdocDATA uninstall-rxdocDATA
+       install-exec-local install-frvdocDATA install-html \
+       install-html-am install-info install-info-am install-man \
+       install-or1kdocDATA install-pdf install-pdf-am \
+       install-pkgincludeHEADERS install-ppcdocDATA install-ps \
+       install-ps-am install-rxdocDATA install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       recheck tags tags-am uninstall uninstall-am \
+       uninstall-armdocDATA uninstall-dtbDATA uninstall-erc32docDATA \
+       uninstall-frvdocDATA uninstall-or1kdocDATA \
+       uninstall-pkgincludeHEADERS uninstall-ppcdocDATA \
+       uninstall-rxdocDATA
 
 .PRECIOUS: Makefile
 
@@ -2496,6 +2500,10 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 @SIM_ENABLE_ARCH_d10v_TRUE@d10v/table.c: d10v/gencode$(EXEEXT)
 @SIM_ENABLE_ARCH_d10v_TRUE@    $(AM_V_GEN)$< >$@
+@SIM_ENABLE_ARCH_erc32_TRUE@sim-%D-install-exec-local: installdirs
+@SIM_ENABLE_ARCH_erc32_TRUE@   $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
+@SIM_ENABLE_ARCH_erc32_TRUE@   n=`echo sis | sed '$(program_transform_name)'`; \
+@SIM_ENABLE_ARCH_erc32_TRUE@   $(INSTALL_PROGRAM) erc32/sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
 
 @SIM_ENABLE_ARCH_frv_TRUE@frv/mloop.c frv/eng.h: frv/stamp-mloop ; @true
 @SIM_ENABLE_ARCH_frv_TRUE@frv/stamp-mloop: $(srccom)/genmloop.sh frv/mloop.in
@@ -2718,6 +2726,29 @@ testsuite/common/bits64m63.c: testsuite/common/bits-gen$(EXEEXT) testsuite/commo
 
 all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
 
+install-data-local: installdirs $(SIM_INSTALL_DATA_LOCAL_DEPS)
+       $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(libdir)
+       lib=`echo sim | sed '$(program_transform_name)'`; \
+       for d in $(SUBDIRS); do \
+               if [ -e $$d/run$(EXEEXT) ]; then \
+                       n="$$lib"; \
+                       [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
+                       n="lib$$n.a"; \
+                       $(INSTALL_DATA) $$d/libsim.a $(DESTDIR)$(libdir)/$$n || exit 1; \
+               fi; \
+       done
+
+install-exec-local: installdirs $(SIM_INSTALL_EXEC_LOCAL_DEPS)
+       $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
+       run=`echo run | sed '$(program_transform_name)'`; \
+       for d in $(SUBDIRS); do \
+               if [ -e $$d/run$(EXEEXT) ]; then \
+                       n="$$run"; \
+                       [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
+                       $(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
+               fi; \
+       done
+
 # 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 38915bf3bb9446f09f183685babe0dc64ea9e817..eddd7d51b3050d010fdc5bdd4705687b10508476 100644 (file)
@@ -71,8 +71,6 @@ SIM_EXTRA_DEPS =
 SIM_EXTRA_CFLAGS =
 # List of extra libraries to link with.
 SIM_EXTRA_LIBS =
-# Dependency of `install' to install any extra files.
-SIM_EXTRA_INSTALL =
 # Dependency of `clean' to clean any extra files.
 SIM_EXTRA_CLEAN =
 
index cbe3fca88654de1a751e7a96479ec035a0a06611..251a9b684d936ef8fc1286063586f85200e1fc3c 100644 (file)
 
 AM_V = @AM_V@
 
-host_alias = @host_alias@
-target_alias = @target_alias@
-program_transform_name = @program_transform_name@
-
 EXEEXT = @EXEEXT@
 
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
 LN_S = @LN_S@
 
 CC = @CC@
index 18dcd36a72bba931fc364f7633ff5a5a1de09674..c424fe7054ba41a8ff8fb383718deb7c5468039c 100644 (file)
@@ -59,21 +59,6 @@ endif
 GNULIB_PARENT_DIR = ../..
 include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
 
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-
-libdir = @libdir@
-tooldir = $(libdir)/$(target_alias)
-
-datadir = @datadir@
-datarootdir = @datarootdir@
-mandir = @mandir@
-man1dir = $(mandir)/man1
-infodir = @infodir@
-includedir = @includedir@
-
 # This can be referenced by the gettext configuration code.
 top_builddir = ..
 
@@ -115,8 +100,6 @@ SIM_EXTRA_CFLAGS =
 SIM_EXTRA_LIBS =
 # List of main object files for `run'.
 SIM_RUN_OBJS = nrun.o
-# Dependency of `install' to install any extra files.
-SIM_EXTRA_INSTALL =
 # Dependency of `clean' to clean any extra files.
 SIM_EXTRA_CLEAN =
 # Likewise `distclean'
@@ -322,23 +305,8 @@ stamp-modules: Makefile $(SIM_OBJS:.o=.c)
 
 # Support targets.
 
-install: install-common $(SIM_EXTRA_INSTALL)
-
-install-common: installdirs
-       a=`basename "$$(pwd)"`; \
-       n=`echo run | sed '$(program_transform_name)'`; \
-       [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
-       $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-       n=`echo sim | sed '$(program_transform_name)'`; \
-       a=`basename "$$(pwd)"`; \
-       [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
-       n="lib$$n.a"; \
-       $(INSTALL_DATA) libsim.a $(DESTDIR)$(libdir)/$$n ; \
-       ( cd $(DESTDIR)$(libdir) ; $(RANLIB) $$n )
-
+install:
 installdirs:
-       $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir)
-       $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir)
 
 check:
 
index 7dd5102bccbf7b1bb0bbc31422427fc83b29cfed..eef81d9dcd6e4915a81198fad98733ec33f67785 100644 (file)
@@ -24,7 +24,6 @@ SIM_OBJS = exec.o erc32.o func.o help.o float.o interf.o
 SIM_RUN_OBJS = sis.o
 SIM_EXTRA_CFLAGS = $(READLINE_CFLAGS)
 SIM_EXTRA_LIBS = $(READLINE_LIB) $(TERMCAP_LIB)
-SIM_EXTRA_INSTALL = install-sis
 SIM_EXTRA_CLEAN = clean-sis
 
 # UARTS run at about 115200 baud (simulator time). Add -DFAST_UART to
@@ -39,10 +38,5 @@ sis$(EXEEXT): run$(EXEEXT)
        $(SILENCE) rm -f $@
        $(ECHO_GEN) ln $< $@ 2>/dev/null || $(LN_S) $< $@ 2>/dev/null || cp -p $< $@
 
-# Copy the files into directories where they will be run.
-install-sis: installdirs
-       n=`echo sis | sed '$(program_transform_name)'`; \
-       $(INSTALL_PROGRAM) sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-
 clean-sis:
        rm -f sis
index cf88a71f86ab82faff23c9bba19e64a02268dcae..3b858a671d801530b34a83a906fa362a0e7d3bdb 100644 (file)
@@ -17,3 +17,9 @@
 
 %C%docdir = $(docdir)/%C%
 %C%doc_DATA = %D%/README.erc32 %D%/README.gdb %D%/README.sis
+
+SIM_INSTALL_EXEC_LOCAL_DEPS += sim-%D-install-exec-local
+sim-%D-install-exec-local: installdirs
+       $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
+       n=`echo sis | sed '$(program_transform_name)'`; \
+       $(INSTALL_PROGRAM) %D%/sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
index 72dc479d1912fdd7040f9bff39c28f36dd945ebf..4fe4fd9597c0ac22b440c8cfdc8c742cf092d5f6 100644 (file)
@@ -843,18 +843,5 @@ pdf:
 clean-pdf:
 install-pdf:
 
-install: installdirs
-       a=`basename "$$(pwd)"`; \
-       n=`echo run | sed '$(program_transform_name)'`; \
-       [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
-       $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-
-install-strip: installdirs
-       a=`basename "$$(pwd)"`; \
-       n=`echo run | sed '$(program_transform_name)'`; \
-       [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
-       $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-       $(STRIP) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-
+install:
 installdirs:
-       $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir)