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 38E0D39DBFFE for ; Thu, 6 Jun 2024 17:50:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38E0D39DBFFE 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 38E0D39DBFFE Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717696214; cv=none; b=A3ARQ61jcZHc+URqdjVQbjKH3GuC2jtp4tKcSKd1HaPgzG23fiGrQb3y7xbwtHwMU3UxBv1PnAhGfWiI3xMsejuI8VpcTuKRSBHhcI8RbUcMR5wdMB/Mb9KwAuNFsTEVDvAV05QKxYQAiyTEf52D8EdG6zpvkxj3dSt36Jm/a9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717696214; c=relaxed/simple; bh=VGP9Zo2bQpzo5gcP7d/UKU9aYt90ck6/a4gCWyQwHIQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=VkSImMqXBoG17M8+9irao7oUU+ydbvrNyYZi7I8c9bGC75LxRL1er3RxqyMpZx+/XjGvvQymGk5u18vuYbJUoMRapNSGqxYVgXnT/Ub0VuCxS60asYWDX9msMDIGb4m5PiFqdmxq9XwPj9utJRgO0n06NqOijUYwkiwHwt7r8cc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717696211; 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: in-reply-to:in-reply-to:references:references; bh=3Jw6mWJ0Jz18QtHIKjGg4HiE3RpoBNxSR/Xq4y0pVDg=; b=McAgiFdnW0vqtWKPdZ92kY7/Nzu13T5sEk3WY0ag+AiKOqc3/Rcz11UicMz+PagxtRdkjQ XwRSTtqFe/ZIDj6STKjHRAWMYKaHKYMUb6V/m3k8VFd8ABWVqgZrg52Pa4rYbIV9W8aYvM pYdNNU8zhG6cQ8Nsm4jlvbt5vSrASFM= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-Vc1-sGC4NtunIDs9DeGBtg-1; Thu, 06 Jun 2024 13:50:10 -0400 X-MC-Unique: Vc1-sGC4NtunIDs9DeGBtg-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2eaa74bfc18so9572661fa.2 for ; Thu, 06 Jun 2024 10:50:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717696209; x=1718301009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3Jw6mWJ0Jz18QtHIKjGg4HiE3RpoBNxSR/Xq4y0pVDg=; b=CENWhoyK6D+MqeGcKGNQsth7WuHN0xslQ0zNqN3WlbqcPoHSgqiHOJzWFsrn7RUZ0m Ri+5OfzvGjWwFgzqz2AOusL28IEkCG+sSmN1O1qg214NDWgtD+IDDNLQtwlQCmL6SC1t Dn/cX98DC72mg/ry0HPFGBw6reBN86XfA7r5VFB4sf3pThcTj5jsm6vk3LfCrkMG7u4f nlEZQKbWAauyaWX3xcb+tGWsowycmCQBasZDWB6kDAlkpwbeJC14ACBvTwjLnO9r4HKD kDJFbkBlsTlavF4/OGZoj4dkAgSxt5K5BtYxkYdB6ydW5E8B4hxr116+uOcevbNcL9VV tlMA== X-Gm-Message-State: AOJu0YzbuUehCcrFeK6tNsm/0zNdIwSArvgClyMZYNMc24RW9p7apHBK FRcqEJrWu0+u7c3nb0iikIzdL7EhcHoQ2nvvTH4hu00+nNWW49G5O22TdkeUN2Qyrld1ClZW/Vd L9st6qqdY+6QAd6wWOztiMmj+J7z4nPJJum2KywvyKmWZuIfPXkYCYzJTlAKeF3FnQuRyeKr5Xv cUG/YrZhKcm8vG/tssmtLjEJ8yN+kjTZziJJbbxRwD87w= X-Received: by 2002:a2e:3506:0:b0:2e9:5ad5:2bb6 with SMTP id 38308e7fff4ca-2eadce82d7dmr2356721fa.47.1717696208740; Thu, 06 Jun 2024 10:50:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlKJcXEl3uwrx6m3H5OmLNCO2V6uKtHhrcxCEufc9llOkTLuQV8DuPEuUVQtMT6YoQAyZyDg== X-Received: by 2002:a2e:3506:0:b0:2e9:5ad5:2bb6 with SMTP id 38308e7fff4ca-2eadce82d7dmr2356571fa.47.1717696208103; Thu, 06 Jun 2024 10:50:08 -0700 (PDT) Received: from localhost (92.40.184.206.threembb.co.uk. [92.40.184.206]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aae25ecbbsm1399135a12.96.2024.06.06.10.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 10:50:06 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 3/6] gdb/doc: allow for version.subst in the source tree Date: Thu, 6 Jun 2024 18:49:55 +0100 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.9 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_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: In a git checkout of the source code we don't have a version.subst file in the gdb/doc directory. When building the GDB docs the version.subst file is generated on demand (we have a recipe for that). However, in a release tar file we do include a copy of the version.subst file in the source tree, as a result the version.subst recipe will not be run. If, in a release build, we force the running of any recipe that depends on version.subst then we run into a problem. For example, slightly confusingly, if we 'touch gdb/doc/version.subst' within the unpacked source tree of a release, then 'make -C gdb/doc GDBvn.texi' in the build tree, we'll see: 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. Handily version.subst is always the first dependency in every recipe that uses that file. As such we can replace references to version.subst with $<, make will expand this to the location where the dependency was found. In the case of the man page generation, the reference to version.subst is hidden inside POD2MAN. It seemed a little confusing adding a use of $< within POD2MAN, so I've moved the use into the recipe, which I think is clearer. I've also added comments for the two rules that I've modified to explain our use of $<. After this change it is possible to rebuild the man pages even when version.subst is located in the source tree. --- gdb/doc/Makefile.in | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in index 70d65d58ed0..eb800bf3848 100644 --- a/gdb/doc/Makefile.in +++ b/gdb/doc/Makefile.in @@ -178,8 +178,8 @@ MANCONF = -Dman TEXI2POD = perl $(srcdir)/../../etc/texi2pod.pl \ $(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS) -POD2MAN = pod2man --center="GNU Development Tools" \ - --release="gdb-`sed q version.subst`" + +POD2MAN = pod2man --center="GNU Development Tools" # List of man pages generated from gdb.texi MAN1S = gdb.1 gdbserver.1 gcore.1 gdb-add-index.1 @@ -435,9 +435,14 @@ refcard.pdf : refcard.tex $(REFEDITS) $(SILENCE) rm -f sedref.log sedref.tex tmp.sed # File to record current GDB version number. +# +# It is important that version.subst be the first dependency so that +# $< can be used in the recipe, this allows us to find version.subst +# in either the source tree or the build tree as this file is +# included, pre-built, as part of a relase. GDBvn.texi : version.subst $(ECHO_GEN) - $(SILENCE) echo "@set GDBVN `sed q version.subst`" > ./GDBvn.new + $(SILENCE) echo "@set GDBVN `sed q $<`" > ./GDBvn.new $(SILENCE) if [ -n "$(PKGVERSION)" ]; then \ echo "@set VERSION_PACKAGE $(PKGVERSION)" >> ./GDBvn.new; \ fi @@ -652,11 +657,16 @@ annotate/index.html: $(ANNOTATE_DOC_FILES) # pages, then the .pod files must become a dependency, this will # trigger an attempt to rebuild these files while building and # installing a release of GDB, which is something we don't want. +# +# It is important that version.subst be the first dependency so that +# $< can be used in the recipe, this allows us to find version.subst +# in either the source tree or the build tree as this file is +# included, pre-built, as part of a relase. $(MAN1S) $(MAN5S) : version.subst $(GDB_DOC_FILES) $(ECHO_TEXI2POD) $(TEXI2POD) $(MANCONF) -D$(basename $@) \ < $(srcdir)/gdb.texinfo > $(basename $@).pod $(ECHO_TEXI2MAN) ($(POD2MAN) --section=$(subst .,,$(suffix $@)) \ - $(basename $@).pod | \ + --release="gdb-`sed q $<`" $(basename $@).pod | \ sed -e '/^.if n .na/d' > $@.T$$$$ && \ mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1) $(SILENCE) rm -f $(basename $@).pod -- 2.25.4