Skip to content

Conversation

@joerowell
Copy link

I recently tried to build KUTrace on a system and ran into a problem where $PWD was not defined inside the Makefile. This stops kutrace_mod from being built properly.

It turns out that when using sudo only certain parts of the environment are actually passed to the command, and $PWD is a variable that gets cut out. This is described in some detail here.

Since Github can't do diffs over tar files, I've summarised the differences below: I've replaced

make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

with

make -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules

@0mp
Copy link

0mp commented Jan 5, 2023

You may want to use $(CURDIR) instead to avoid shelling out to call pwd. CURDIR is GNU make's builtin variable storing the current working directory.

@zed
Copy link

zed commented Aug 14, 2024

Note: $(shell pwd), $(CURDIR), $$PWD may be different from $(PWD) e.g., if make -C dir form is used (the former points to dir while the latter points to its parent).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants