From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/3] sim: build: move install steps to the top-level
Date: Sat, 5 Nov 2022 15:27:25 +0700 [thread overview]
Message-ID: <20221105082727.32094-1-vapier@gentoo.org> (raw)
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 | 27 +++++++++
sim/Makefile.in | 113 ++++++++++++++++++++++++--------------
sim/README-HACKING | 2 -
sim/common/Make-common.in | 19 +------
sim/erc32/Makefile.in | 6 --
sim/erc32/local.mk | 6 ++
sim/ppc/Makefile.in | 15 +----
7 files changed, 107 insertions(+), 81 deletions(-)
diff --git a/sim/Makefile.am b/sim/Makefile.am
index 7ea013ac1965..523d8f8dec96 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -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
diff --git a/sim/README-HACKING b/sim/README-HACKING
index 38915bf3bb94..eddd7d51b305 100644
--- a/sim/README-HACKING
+++ b/sim/README-HACKING
@@ -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 =
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 18dcd36a72bb..bd50f052dae9 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -115,8 +115,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 +320,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:
diff --git a/sim/erc32/Makefile.in b/sim/erc32/Makefile.in
index 7dd5102bccbf..eef81d9dcd6e 100644
--- a/sim/erc32/Makefile.in
+++ b/sim/erc32/Makefile.in
@@ -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
diff --git a/sim/erc32/local.mk b/sim/erc32/local.mk
index cf88a71f86ab..3b858a671d80 100644
--- a/sim/erc32/local.mk
+++ b/sim/erc32/local.mk
@@ -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)
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 72dc479d1912..4fe4fd9597c0 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -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)
--
2.38.1
next reply other threads:[~2022-11-05 8:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 8:27 Mike Frysinger [this message]
2022-11-05 8:27 ` [PATCH 2/3] sim: build: add uninstall support Mike Frysinger
2022-11-05 8:27 ` [PATCH 3/3] sim: run: move linking into top-level Mike Frysinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221105082727.32094-1-vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).