From patchwork Thu Mar 30 12:15:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 67120 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 85A423858421 for ; Thu, 30 Mar 2023 12:16:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85A423858421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680178581; bh=3ey6KZEelV1mnDUD3XapetPVmMXtilUk0nsbeNlPn0Y=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=D2ub/6CtFgygCBA6MxkKWFYeaXBMfvrBAjdVAbkj+LBdsROsncMz77k6cEb9j3QJI ubLb8gNdqVs+J+r+pZvQ+5xN1J9WAONp3H5IuDduh9daIOmpfSjPKITvWQBiATc5GL GHT8imzjEsMTVno1mpzCRTz+Doie6b2YVbsEsxl0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 483913858CDA for ; Thu, 30 Mar 2023 12:15:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 483913858CDA Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-56-xI66-v0ZMdOcl7KJcoBT8w-1; Thu, 30 Mar 2023 08:15:47 -0400 X-MC-Unique: xI66-v0ZMdOcl7KJcoBT8w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6732D884EC1; Thu, 30 Mar 2023 12:15:47 +0000 (UTC) Received: from localhost (unknown [10.33.36.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 223FC1121330; Thu, 30 Mar 2023 12:15:47 +0000 (UTC) To: gcc-patches@gcc.gnu.org Cc: Jason Merrill , Alexandre Oliva , Segher Boessenkool Subject: [PATCH] c++tools: Fix Makefile to properly clean and rebuild [PR101834] Date: Thu, 30 Mar 2023 13:15:46 +0100 Message-Id: <20230330121546.1454231-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested with various combinations of 'make clean all' etc. OK for trunk? And backport to gcc-12 and gcc-11 after some soak time on trunk? -- >8 -- The c++tools makefile doesn't remove progressively more files in each of mostlyclean, clean, and distclean. Instead, each removes a different set of files (and some files are not removed by any target). Use prerequisites so that everything is removed. Also, building in the $objdir/c++tools directory doesn't work, because the INSTALL variable is never set. It works when building from the top-level because INSTALL is set in the environment when recursively invoking make for sub-directories. c++tools/ChangeLog: PR bootstrap/101834 * Makefile.in (INSTALL): Set variable. (mostlyclean): Mark as a phony target. (clean): Add mostlyclean as a prerequisite. (distclean): Add clean as a prerequisite and remove more files. (maintainer-clean): Add distclean as a prerequisite. --- c++tools/Makefile.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/c++tools/Makefile.in b/c++tools/Makefile.in index 56cba090135..77bda3d56dc 100644 --- a/c++tools/Makefile.in +++ b/c++tools/Makefile.in @@ -22,6 +22,7 @@ libexecdir := @libexecdir@ target_noncanonical := @target_noncanonical@ gcc_version := $(shell @get_gcc_base_ver@ $(srcdir)/../gcc/BASE-VER) libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version) +INSTALL := @INSTALL@ INSTALL_PROGRAM := @INSTALL_PROGRAM@ INSTALL_STRIP_PROGRAM := $(srcdir)/../install-sh -c -s AUTOCONF := @AUTOCONF@ @@ -41,13 +42,14 @@ all:: mostlyclean:: rm -f $(MAPPER.O) -clean:: +clean:: mostlyclean rm -f g++-mapper-server$(exeext) -distclean:: - rm -f config.log config.status config.h +distclean:: clean + rm -f config.log config.status config.h config.cache Makefile + rm -f $(MAPPER.O:%.o=%.d) -maintainer-clean:: +maintainer-clean:: distclean install:: @@ -132,6 +134,6 @@ config.h: config.status config.h.in config.status: $(srcdir)/configure $(srcdir)/config.h.in if test -x $@; then ./$@ -recheck; else $< @configure_args@; fi -.PHONY: all check clean distclean maintainer-clean +.PHONY: all check mostlyclean clean distclean maintainer-clean -include $(MAPPER.O:.o=.d)