Aparently, on some setups, 'sudo make' will clear the $PWD variable on the first Makefile expansion. This leads to failures of "sudo make install" or other issues when trying to preserve the environment with sudo -E.
There are two solutions to this problem: 1) Use $$PWD instead of $(PWD) to render `$PWD` as the actual string to be used on the secondary Makefile expansion. This is used (albeit inconsistently) in the Linux kernel guide for external modules: kernel https://www.kernel.org/doc/Documentation/kbuild/modules.txt 2) A second solution is based on GNU make which sets CURDIR to the pathname of current working directory. This variable is never touched again by make. This solution is choosen for it is just as clear as the PWD one would have been had it worked in the first place. Signed-off-by: Cristian Stoica <cristian.sto...@nxp.com> --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9871a8e..cce94b8 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o obj-m += cryptodev.o -KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(PWD) +KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(CURDIR) ifneq ($(ARCH),) KERNEL_MAKE_OPTS += ARCH=$(ARCH) endif @@ -32,11 +32,11 @@ version.h: Makefile install: modules_install modules_install: - $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install + $(MAKE) $(KERNEL_MAKE_OPTS) modules_install install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h clean: - $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean + $(MAKE) $(KERNEL_MAKE_OPTS) clean rm -f $(hostprogs) *~ CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests clean -- 2.7.3 _______________________________________________ Cryptodev-linux-devel mailing list Cryptodev-linux-devel@gna.org https://mail.gna.org/listinfo/cryptodev-linux-devel