From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680178553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3ey6KZEelV1mnDUD3XapetPVmMXtilUk0nsbeNlPn0Y=; b=KBz3gfs78dRFZ3gMJ08vO1N+VFyBZfRNJ773c2BI5n4WVLeauFQ2HLOLAV4R9RFMPZeFPU dz3VPy2pVZmOMGKYySZ4PVt2s+h5qYXT7UPmghthU1RXJAhRZ1MYRAbVRg83fBns6dVL1g U5qn3FGq1KDedkWfR14Pe9rPtXU4Pks= 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) From: Jonathan Wakely 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 Content-Type: text/plain Content-Transfer-Encoding: 8bit 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 List-Id: 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) -- 2.39.2