multiple lines of rm in makefile failing

138 views Asked by At

I'm using the following Makefile for a kernel module, but I cannot get the %Clean target to work. The pattern matching is working correctly, and it prints out all of the rm commands, but only the first item in the list gets deleted. Any ideas?

obj-m := thunderfs.o         

build:     
    $(MAKE) -C $(KERNELDIR) M=$(PWD) modules     

%.o: $.c    
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules     

.PHONY: %Clean    
%Clean:     
    rm -f modules.order     
    rm -f Modules.symvers     
    rm -f $*.ko     
    rm -f $*.mod.c     
    rm -f $*.mod.o     
    rm -f $*.o  

Here is the thunderfs.c file. Issue make build or just make.

#include <linux/module.h>     
#include <linux/init.h>     
#include <linux/kernel.h>     

int init_mod(void) // Required to insmod     
{    
    printk(KERN_INFO "Hello Cruel World\n");    
    return 0;    
}    

void clean_mod(void) // Required for rmmod     
{    
    printk(KERN_INFO "Goodbye Cruel World\n");    
}    

module_init(init_mod);    
module_exit(clean_mod);    

MODULE_AUTHOR("Matthew Carlis");    
MODULE_LICENSE("GPL");    
MODULE_DESCRIPTION("Starting fresh");    
0

There are 0 answers