From patchwork Sat Nov 5 08:27:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 59986 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D09F73858285 for ; Sat, 5 Nov 2022 08:28:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D09F73858285 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667636887; bh=evcENcots4OrzinlAtXSp8qGt/jtt0w3+2EiThastP8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ZcAYWQ764Wxerr8MduCaSgqhVt3i1QMq9xcXrP0chVAN/eRuqeCX2JLNn7ZRKFQ5G c2wV/XgbyBMEA7JfnGLCtGOcv6247O1voBuV9XjtkKH+fW3xV2gWy7XCiSufduNMrr claYE0W2J5mNg+Wv0I3ptDRLsTFdTklaXXf7TtwI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 168393858C83 for ; Sat, 5 Nov 2022 08:27:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 168393858C83 Received: by smtp.gentoo.org (Postfix, from userid 559) id A549834128E; Sat, 5 Nov 2022 08:27:29 +0000 (UTC) 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 Message-Id: <20221105082727.32094-1-vapier@gentoo.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Mike Frysinger via Gdb-patches From: Mike Frysinger Reply-To: Mike Frysinger Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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)