I have a simple project that includes one driver and one client program to test the driver. I have two directories under linux/drivers/myproject, mydriver/, and myclient/, respectively. Each has a Makefile. The Makefile for the driver functions just fine, and produces the driver in the same directory as the makefile. The syntax here is as follows: #DRIVER MAKEFILE # If KERNELRELEASE is defined, we've been invoked from the # kernel build system and can use its language. ifneq ($(KERNELRELEASE),) obj-m := mydriver.o # Otherwise we were called directly from the command # line; invoke the kernel build system. else KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) default: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules endif When this is invoked with: make -C ~/linux-cortexm-1.12.0/linux/ M=`pwd` It produces what I want, a mydriver.ko file in the same directory. But when I try to build the client in it's own directory (from myclient.c alone), I get a client executable two directories up, in ./linux . Here is that Makefile: # If KERNELRELEASE is defined, we've been invoked from the # kernel build system and can use its language. ifneq ($(KERNELRELEASE),) host-progs := myclient build-targets := $(host-prog) # Otherwise we were called directly from the command # line; invoke the kernel build system. else KERNELDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) default: $(MAKE) -C $(KERNELDIR) M=$(PWD) myclient endif I am puzzled about what KBuild is doing, and why it is doing it. Eric -- cc:NSA _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies