forked from daniel-santos/mcp2210-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (50 loc) · 1.87 KB
/
Makefile
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Makefile for mcp2210
#
# Derived from the good-ole LDD3 Makefile
#
ccflags-y += -Wall -Werror -Wunused-macros
# To build modules outside of the kernel tree, we run "make"
# in the kernel source tree; the Makefile these then includes this
# Makefile once again.
# This conditional selects whether we are being included from the
# kernel Makefile or not.
ifeq ($(KERNELRELEASE),)
# Assume the source tree is where the running kernel was built
# You should set KERNELDIR in the environment if it's elsewhere
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
# The current directory is passed to sub-makes as argument
PWD := $(shell pwd)
all: modules user
user:
$(MAKE) -C user
# Temporary measure for building out-of-tree
out-of-tree-autoconf.h:
cp -n out-of-tree-autoconf.h.template out-of-tree-autoconf.h
modules: out-of-tree-autoconf.h
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
rm -rf *.o *.gcno *~ core .depend .*.cmd *.ko *.mod.c *.dwo .*.dwo \
mcp2210.s .tmp_versions modules.order Module.symvers
$(MAKE) -C user clean
mcp2210.s: modules
$(CROSS_COMPILE)objdump -dSr --prefix-addresses --line-numbers \
mcp2210.ko > mcp2210.s
.PHONY: modules modules_install user clean
else
# called from kernel build system: just declare what our modules are
# When building out-of-tree, we need a way to get our config macros
KBUILD_CPPFLAGS += -include $(PWD)/out-of-tree-autoconf.h
# Many kernels < v3.0 will produce loads of spam with
# -Wunused-but-set-variable set
ifeq ($(VERSION),2)
ccflags-y += -Wno-unused-but-set-variable
endif
CONFIG_MCP2210 ?= m
mcp2210-objs := mcp2210-core.o mcp2210-ioctl.o mcp2210-ctl.o \
mcp2210-spi.o mcp2210-eeprom.o mcp2210-lib.o \
mcp2210-gpio.o mcp2210-irq.o
obj-$(CONFIG_MCP2210) += mcp2210.o
endif