我有源代码:
#include <linux/module.h>
#include <linux/kernel.h>
int init_module(void)
{
printk(KERN_INFO "Hello world %i\n", BUILD_NUMBER);
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
以及一个 makefile:
obj-m += hello-1.o
BUILD_NUMBER := 42
# How to pass BUILD_NUMBER to hello-1.c ???
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
现在我该如何将BUILD_NUMBER参数从makefile传递到源代码中?