- 论坛徽章:
- 0
|
写个Makefile啊!
-----------------------------
2 # To build modules outside of the kernel tree, we run "make"
3 # in the kernel source tree; the Makefile these then includes this
4 # Makefile once again.
5 # This conditional selects whether we are being included from the
6 # kernel Makefile or not.
7 ifeq ($(KERNELRELEASE),)
8
9 # Assume the source tree is where the running kernel was built
10 # You should set KERNELDIR in the environment if it's elsewhere
11 KERNELDIR ?= /lib/modules/$(shell uname -r)/build
12 # The current directory is passed to sub-makes as argument
13 PWD := $(shell pwd)
14
15 modules:
16 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
17
18 modules_install:
19 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
20
21 clean:
22 rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
23
24 .PHONY: modules modules_install clean
25
26 else
27 # called from kernel build system: just declare what our modules are
28 obj-m := helloworld.o
29
30 endif
------------------------------------------------------ |
|