From 56c16b9ba0167d99b575bce302e8a6148bf712ba Mon Sep 17 00:00:00 2001 From: Integral Date: Mon, 11 Nov 2024 13:57:31 +0800 Subject: [PATCH] Replace make with $(MAKE) in Makefile According to GNU Make Manual, Recursive make commands should always use the variable MAKE, not the explicit command name "make". --- lkmpg.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lkmpg.tex b/lkmpg.tex index 7320d0f..019f23f 100644 --- a/lkmpg.tex +++ b/lkmpg.tex @@ -258,10 +258,10 @@ obj-m += hello-1.o PWD := $(CURDIR) all: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean \end{code} In \verb|Makefile|, \verb|$(CURDIR)| can set to the absolute pathname of the current working directory(after all \verb|-C| options are processed, if any). @@ -461,10 +461,10 @@ obj-m += hello-2.o PWD := $(CURDIR) all: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean \end{code} Now have a look at \src{drivers/char/Makefile} for a real world example. @@ -604,10 +604,10 @@ startstop-objs := start.o stop.o PWD := $(CURDIR) all: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: - make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean \end{code} This is the complete makefile for all the examples we have seen so far.