summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 4b897dbe8dedca01f44c95a5de13e13dc62c605d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# causes weird file size, smaller than stripped?
ifeq ($(DEBUG),)
  ccflags-y += -g
endif

# Makfile assignments:
#  := value at right is expanded and assigned at declaration time
#   = value at right is expanded only when it is used, hence it is a reference
#  ?= value at right is assigned only if the variable doesn't have a value
#
#

# objects that are part of hello module (hello.o)
hello-y += main.o debug.o

# .ko module to be created
obj-m := hello.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build

# '-C' changes the dir
# '-M' causes the the kernel's toplevel Makefile to move back into this dir
#      before trying to build 'modules' target
all:
	make -C $(KERNELDIR) KCPPFLAGS="-I$(CURDIR)" M=$(PWD) modules

clean:
	make -C $(KERNELDIR) M=$(PWD) clean