Message ID | 20210827103115.309774-1-drjones@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [kvm-unit-tests] Makefile: Don't trust PWD | expand |
On 27/08/2021 12.31, Andrew Jones wrote: > It's possible that PWD is already set to something which isn't > the full path of the current working directory. Let's make sure > it is. > > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Makefile b/Makefile > index f7b9f28c9319..a65f225b7d5c 100644 > --- a/Makefile > +++ b/Makefile > @@ -1,4 +1,5 @@ > SHELL := /usr/bin/env bash > +PWD := $(shell pwd) I think we should rather use $(CURDIR) in Makefiles instead, since this is the official way that GNU Make handles the current working directory. By the way, is this cscope thing also supposed to work in out-of-tree builds? Thomas
On Fri, Aug 27, 2021 at 12:36:05PM +0200, Thomas Huth wrote: > On 27/08/2021 12.31, Andrew Jones wrote: > > It's possible that PWD is already set to something which isn't > > the full path of the current working directory. Let's make sure > > it is. > > > > Signed-off-by: Andrew Jones <drjones@redhat.com> > > --- > > Makefile | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/Makefile b/Makefile > > index f7b9f28c9319..a65f225b7d5c 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1,4 +1,5 @@ > > SHELL := /usr/bin/env bash > > +PWD := $(shell pwd) > > I think we should rather use $(CURDIR) in Makefiles instead, since this is > the official way that GNU Make handles the current working directory. Agreed. I'll send a v2. > > By the way, is this cscope thing also supposed to work in out-of-tree builds? I personally don't care if it works from the out-of-tree build dir. I generally want to be able to use git commands while browsing code too, so I won't be running cscope anywhere but in a repo with a checked-out working tree. Thanks, drew
diff --git a/Makefile b/Makefile index f7b9f28c9319..a65f225b7d5c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ SHELL := /usr/bin/env bash +PWD := $(shell pwd) ifeq ($(wildcard config.mak),) $(error run ./configure first. See ./configure -h)
It's possible that PWD is already set to something which isn't the full path of the current working directory. Let's make sure it is. Signed-off-by: Andrew Jones <drjones@redhat.com> --- Makefile | 1 + 1 file changed, 1 insertion(+)