Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace $PWD with shell pwd #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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