Rename spi_tty into spi_parport
[pub/spi-gpio-pp.git] / Makefile
1 #
2 # Makefile for the Linux WWAN device drivers.
3 #
4 # NOTE: This make file can serve as both an external Makefile (launched
5 # directly by the user), or as the sub-dir Makefile used by the kernel
6 # build system.
7
8 # If CONFIG_SPI_PARPORT isn't set, we'll assume the user has never configured
9 # their kernel to include this module and set up some defaults.
10 #
11 # NOTE: If you have previously added the SPI_TTY project to your kernel
12 # and configured it for inclusion, these settings will be
13 # overridden by your kernel configuration.
14 ifndef CONFIG_SPI_PARPORT
15 EXTERNAL_BUILD=y
16 CONFIG_SPI_PARPORT=m
17 CONFIG_SPI_PARPORT_DEBUG=n
18 endif
19
20
21 ifeq ($(CONFIG_SPI_PARPORT_DEBUG),y)
22 EXTRA_CFLAGS += -g -Wa,-adhlms=$@.lst
23 endif
24
25 ifdef KBUILD_EXTMOD
26 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)
27 endif
28
29
30 list-m :=
31 list-$(CONFIG_SPI_PARPORT) += spi_parport
32 obj-$(CONFIG_SPI_PARPORT) += spi_parport.o
33
34 #
35 # Begin dual Makefile mode here. First we provide support for when we
36 # are being invoked by the kernel build system
37 #
38 ifneq ($(KERNELRELEASE),)
39
40 EXTRA_CFLAGS += -DCONFIG_PM
41
42 ifeq ($(EXTERNAL_BUILD),y)
43 ifeq ($(CONFIG_SPI_PARPORT_DEBUG),y)
44 EXTRA_CFLAGS += -DCONFIG_SPI_PARPORT_DEBUG
45 endif
46 endif
47
48 else
49 # Here we begin the portion that is executed if the user invoked this Makefile
50 # directly.
51
52 # KSRC should be set to the path to your sources
53 KVER := $(shell uname -r)
54 KSRC := /lib/modules/$(KVER)/build
55 INSTALLDIR:=/lib/modules/$(KVER)/kernel/drivers/net/wwan/
56
57 # KSRC_OUTPUT should be overridden if you are using a 2.6 kernel that
58 # has it's output sent elsewhere via KBUILD_OUTPUT= or O=
59 KSRC_OUTPUT := $(KSRC)
60
61 PWD=$(shell pwd)
62
63 VERFILE := $(KSRC_OUTPUT)/include/linux/version.h
64 KERNELRELEASE := $(shell \
65 if [ -r $(VERFILE) ]; then \
66 (cat $(VERFILE); echo UTS_RELEASE) | \
67 $(CC) -I$(KSRC_OUTPUT) $(CFLAGS) -E - | \
68 tail -n 1 | \
69 xargs echo; \
70 else \
71 uname -r; \
72 fi)
73
74 MODPATH := $(DESTDIR)/lib/modules/$(KERNELRELEASE)
75
76 all: modules
77
78 clean:
79 $(RM) -f *.mod.* *.mod *.o *.ko .*.o.cmd .*.ko.cmd *.flags .lst *.lst Module*.symvers
80 $(RM) -rf $(PWD)/tmp
81 $(RM) -rf .tmp_versions
82 $(RM) -f modules.order
83 $(RM) -f Module.markers
84
85 distclean: clean
86 rm -f tags TAGS
87
88 TMP=$(PWD)/tmp
89 MODVERDIR=$(TMP)/.tmp_versions
90
91 modules:
92 mkdir -p $(MODVERDIR)
93 ifdef ($(KSRC_OUTPUT)/.tmp_versions)
94 -cp $(KSRC_OUTPUT)/.tmp_versions/*.mod $(MODVERDIR)
95 endif
96 ifeq ($(KSRC),$(KSRC_OUTPUT)) # We're not outputting elsewhere
97 ifdef ($(KSRC)/.tmp_versions)
98 -cp $(KSRC)/.tmp_versions/*.mod $(MODVERDIR)
99 endif
100 $(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR) modules
101 else # We've got a kernel with seperate output, copy the config, and use O=
102 mkdir -p $(TMP)
103 cp $(KSRC_OUTPUT)/.config $(TMP)
104 $(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR)) O=$(PWD)/tmp modules
105 endif
106
107 install: modules
108 modprobe -r spi_parport || true
109 install -d $(INSTALLDIR)
110 install -m 644 -c $(addsuffix .ko,$(list-m)) $(INSTALLDIR)
111 /sbin/depmod -a ${KVER}
112
113 uninstall:
114 rm -rf $(addprefix $(INSTALLDIR),$(addsuffix .ko,$(list-m)))
115 /sbin/depmod -a ${KVER}
116
117 endif # End of internal build
118
119 .PHONY: TAGS tags
120
121 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o
122 define all-sources
123 ( find . $(RCS_FIND_IGNORE) -name '*.[chS]' -print )
124 endef
125
126 TAGS:
127 $(all-sources) | etags -
128 tags:
129 $(RM) -f $@
130 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
131 $(all-sources) | xargs ctags $$CTAGSF -a
132