MNAME = hello BDIR = /home/devel/work/build-linux ifeq ($(KERNELRELEASE),) # called from shell .PHONY: default clean default: make -C $(BDIR) M=$(shell pwd) modules clean: rm -rf $(MNAME).mod.* $(MNAME).*o .$(MNAME)* .tmp* Module.symvers modules.order else # called from kernel Makefile obj-m := $(MNAME).o endif