我有源代码:
#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 传递到源代码?