리눅스 커널모듈 프로그래밍시에 make -C [커널소스] 를 넣어주는 이유는 무었인가요?

trymp의 이미지

리눅스 커널 모듈을 프로그래밍 할때 Makefile 에 빌드 관련된 것을 기술하잖아요

make -C [커널소스경로] M=[현재경로] module 할때

-C 옵션으로 커널소스 경로를 넣어주는 이유는 무었인가요?

알려주시면 감사하겠습니다.

익명 사용자의 이미지

make -C [경로] 는 cd [경로] && make 와 같습니다.

$ man make
-C dir, --directory=dir
Change to directory dir before reading the makefiles or doing
anything else. If multiple -C options are specified, each is in‐
terpreted relative to the previous one: -C / -C etc is equivalent
to -C /etc. This is typically used with recursive invocations of
make.