From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111759 invoked by alias); 24 Dec 2018 21:10:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 111693 invoked by uid 89); 24 Dec 2018 21:10:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*RU:192.185.45.38, Hx-spam-relays-external:192.185.45.38 X-HELO: gateway21.websitewelcome.com Received: from gateway21.websitewelcome.com (HELO gateway21.websitewelcome.com) (192.185.45.38) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Dec 2018 21:10:29 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 3A5A9400D2355 for ; Mon, 24 Dec 2018 15:09:30 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id bXTeg7wQB90onbXTegf2WN; Mon, 24 Dec 2018 15:09:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ETxB6J7AxCCgLzFR9KF4D0N5ngF8a7kWxBACI8SlGwU=; b=jRxygXE+RajS/xn5gYausJKZSq YKXboj6ktJfdZzXgX9N2QiReHp7IVETOdGrFrW3RrVZQ2ZEj1IQIG+2dm+05mNgfyPS1E3SdD5+u0 NO94wt5qZT4Jp5+sTCO94stPO; Received: from 75-166-72-210.hlrn.qwest.net ([75.166.72.210]:38044 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gbXTe-002qYm-0b; Mon, 24 Dec 2018 15:09:30 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/3] Make init.c depend on source files Date: Mon, 24 Dec 2018 21:10:00 -0000 Message-Id: <20181224210927.16741-3-tom@tromey.com> In-Reply-To: <20181224210927.16741-1-tom@tromey.com> References: <20181224210927.16741-1-tom@tromey.com> X-SW-Source: 2018-12/txt/msg00312.txt.bz2 I noticed that init.c depends on the object files that go into gdb. Because init.c actually only requires the contents of the corresponding source files, this unnecessarily serializes the step that builds init.c. This patch changes gdb's Makefile to make init.c depend on the source files. This also simplifies the rule to build init.c. gdb/ChangeLog 2018-12-24 Tom Tromey * Makefile.in (INIT_FILES): Redefine. (stamp-init): Remove sed, tr invocations. Use for loop. Don't set LANG or LC_ALL. --- gdb/ChangeLog | 6 ++++++ gdb/Makefile.in | 35 +++++++++++------------------------ 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 38d00b0632..e4d4a3449d 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1831,37 +1831,24 @@ test-cp-name-parser$(EXEEXT): test-cp-name-parser.o $(LIBIBERTY) # # Note that the set of files with init functions might change, or the names # of the functions might change, so this files needs to depend on all the -# object files that will be linked into gdb. +# source files that will be linked into gdb. However, due to the way +# this Makefile has generally been written, we do this indirectly, by +# computing the list of source files from the list of object files. -# FIXME: There is a problem with this approach - init.c may force -# unnecessary files to be linked in. +INIT_FILES = \ + $(patsubst %.o,%.c, \ + $(patsubst %-exp.o,%-exp.y, \ + $(filter-out $(NATDEPFILES) init.o version.o %_S.o %_U.o,\ + $(COMMON_OBS)))) -# NOTE: cagney/2003-03-18: The sed pattern ``s|^\([^ /]...'' is -# anchored on the first column and excludes the ``/'' character so -# that it doesn't add the $(srcdir) prefix to any file that already -# has an absolute path. It turns out that $(DEC)'s True64 make -# automatically adds the $(srcdir) prefixes when it encounters files -# in sub-directories such as cli/ and mi/. - -INIT_FILES = $(COMMON_OBS) init.c: stamp-init; @true stamp-init: $(INIT_FILES) @$(ECHO_INIT_C) echo "Making init.c" @rm -f init.c-tmp init.l-tmp @touch init.c-tmp - @-LANG=C ; export LANG ; \ - LC_ALL=C ; export LC_ALL ; \ - echo $(INIT_FILES) | \ - tr ' ' '\012' | \ - sed \ - -e '/^init.[co]$$/d' \ - -e '/version.[co]$$/d' \ - -e '/^[a-z0-9A-Z_]*_[SU].[co]$$/d' \ - -e 's/-exp\.o$$/-exp.y/' \ - -e 's/\.o$$/.c/' \ - -e 's|^\([^ /][^ ]*\)|$(srcdir)/\1|g' | \ - while read f; do \ - sed -n -e 's/^_initialize_\([a-z_0-9A-Z]*\).*/\1/p' $$f 2>/dev/null; \ + @-for f in $(INIT_FILES); do \ + sed -n -e 's/^_initialize_\([a-z_0-9A-Z]*\).*/\1/p' \ + $(srcdir)/$$f 2>/dev/null; \ done > init.l-tmp @echo '/* Do not modify this file. */' >>init.c-tmp @echo '/* It is created automatically by the Makefile. */'>>init.c-tmp -- 2.17.2