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.129.124]) by sourceware.org (Postfix) with ESMTPS id 0397139AD0EC for ; Thu, 6 Jun 2024 17:52:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0397139AD0EC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0397139AD0EC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717696349; cv=none; b=S5gHNSZsK924k24kCdV2DtshbJRcBm5MvGv8/Cz61QA2tK06fQ3xqcb2wyeymOCzAt915tHT4UYwAsQ02iUuHwmxhaUiITxLkVnxZyw1JQk6kP48PeOmn33za4ecMyhf7ooNHSj+VGFuzTknidqbSlBrOk9FycLku37radXHvRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717696349; c=relaxed/simple; bh=8Ihj9j5lHBe9sCJxrkDbz7SLjLqJ/G5FzzAkDgxaW6c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=P+VREZTx2nlHsnECIKU/LbentQPpyDha6+iqqga7ySHTcEiUdjco/yhsYVEdP2Utr+8yuqILdMZIFiEXXbokp6gn1hlCgeWrm38oQtQxLj6fNM11ydwyGqvMc1x3ZS1D1FEXluO/OYUrn+L01b6t+NhPAwig2iQ3qigDKXT8f9s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717696346; 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: in-reply-to:in-reply-to:references:references; bh=OsDUeI5bl2Rn94vE+g73SazmRT/3tQGPwbjiPr1HGqM=; b=NXTYHWjUJpOS0ghmzUIZhCWM0ty4mwz4EHE/cOIQOGcxGSaT8/wH6BlwRik9ArDyosMh7V mzF16/OYyabx4vRUz6VFITNLuwcT/3pA9LpcuVtLDMGjV/jrZ95pL2FSCPBQKX+hODHW2G Pjy8J3/ejLghfTwRbunwiaQEZFekPxk= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-QYGmNJ4zNTCfm2UXA8_0Lw-1; Thu, 06 Jun 2024 13:52:25 -0400 X-MC-Unique: QYGmNJ4zNTCfm2UXA8_0Lw-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-35e5b42c85fso831564f8f.0 for ; Thu, 06 Jun 2024 10:52:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717696344; x=1718301144; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OsDUeI5bl2Rn94vE+g73SazmRT/3tQGPwbjiPr1HGqM=; b=BHSyQA5hmWUZz2yLMTIlirmu2p/5BuCahxD59IMBofLzI7OIU1E69U0WGNkrWIOiX+ 8A+igjmj+lwQKJOTox4+K9YVKQQX+n5acY6STw62U8gOC6s4jEE20Y+4Nn7oMAU/+tVE BQ1vh31ePIyja7Y8pF5F2L/GPFsEV7icssZmLeJZuMKs1hbBWO4MHdfP1T6lbQnt8X/J kkvXgfHqDmne0epcrPHS46mhcb23ZfNTRfjAH6M7K5ZDb+rsS5e3mR7Tj7SSN4S8lA5E UlJIbbCW0k9GVZdeTXRen99ZBgwcuaBzEy/9U59jAUtUmcs/vMhQiLJF4OM6QCFllFLM 9Z/Q== X-Gm-Message-State: AOJu0YyT8irhwGU+vHCSW/v3ExTST+eXls6mYScUsIQGn9Rr84RY4liK GzLhaOPJttKSNJ3pR5rQ6rZU/d86Nb218DWQFXND3Y13TsBAWKO+67vmdhD8qddrf0kSeg6/C9A XUqirW5rAaClzAP+DDSgP9WfJL8U4r/s5hEmp6rRQjn6OsK8Aib4yF9Kg2iYcMUGtem8= X-Received: by 2002:a5d:6307:0:b0:357:d26a:4f2a with SMTP id ffacd0b85a97d-35efed66a89mr249376f8f.33.1717696343830; Thu, 06 Jun 2024 10:52:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHh0r512I6h6gg51N6WX0hr4DLIe5HJ/ESP/zfv0aOtk7PnCpVAfD2+M+BoDYraB8XHp8Ay8Q== X-Received: by 2002:a5d:6307:0:b0:357:d26a:4f2a with SMTP id ffacd0b85a97d-35efed66a89mr249364f8f.33.1717696343393; Thu, 06 Jun 2024 10:52:23 -0700 (PDT) Received: from localhost (92.40.184.206.threembb.co.uk. [92.40.184.206]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35ef5d66cf6sm2166401f8f.49.2024.06.06.10.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:52:23 -0700 (PDT) From: Andrew Burgess To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [PATCHv2 2/5] gdb/doc: allow for version.subst in the source tree In-Reply-To: <86msnygu2y.fsf@gnu.org> References: <7d24d630fb96976deb225f1098df2b32e72643bd.1717142725.git.aburgess@redhat.com> <86sexyp8my.fsf@gnu.org> <87cyoyxg0e.fsf@redhat.com> <86msnygu2y.fsf@gnu.org> Date: Thu, 06 Jun 2024 18:52:22 +0100 Message-ID: <87cyouarhl.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Eli Zaretskii writes: >> From: Andrew Burgess >> Cc: gdb-patches@sourceware.org >> Date: Mon, 03 Jun 2024 15:22:41 +0100 >> >> Eli Zaretskii writes: >> >> >> make: Entering directory '/tmp/build/build/gdb/doc' >> >> GEN GDBvn.texi >> >> sed: can't read version.subst: No such file or directory >> >> make: Leaving directory '/tmp/build/build/gdb/doc' >> >> >> >> The problem is that every reference to version.subst in GDB's Makefile >> >> assumes that the version.subst file will always be in the build >> >> directory. >> >> >> >> In this commit I replace direct references to version.subst with a >> >> small shell snippet which returns the path to the version.subst file >> >> to use. If there is a version.subst file in the build directory then >> >> that file is selected, otherwise we return the path to a version.subst >> >> file in the source directory. >> > >> > Why isn't VPATH or vpath enough to solve this nuisance? >> >> If anything VPATH is the _cause_ of this nuisance! With the VPATH set >> as it is, make will check both the build directory and the source >> directory. So when we have a rule like: >> >> some_target : version.subst >> some_command version.subst >> >> make is going to look for the version.subst dependency in both >> locations, however, where 'some_command' looks is entirely up to >> 'some_command'. In our case for example, the 'sed' command doesn't (to >> my knowledge) have a search path command line option, so a command like: >> >> sed q version.subst >> >> is only going to search in the build directory. > > My reading of the node "Recipes/Search" in the GNU Make manual is that > if you use automatic variables, such as $^, in the recipe, Make will > expand the variable into the full file name including the directory in > which it found the file via VPATH search. Can't we use that feature > here? IOW, instead of > > some_target : version.subst > some_command version.subst > > you should use something like > > some_target : version.subst > some_command $< Thanks. I was completely unaware that $< (and friends) worked like this... but I guess it makes sense when you think about it. This is indeed a better way to solve the problem I had. While working on this change I ended up adding a whole extra patch to the series, so I've followed up with a V3 series. Thanks for your patience. Andrew