spi_parport with proper irq support
[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 ifndef CONFIG_GPIO_PARPORT
12 EXTERNAL_BUILD=y
13 CONFIG_GPIO_PARPORT=m
14 # CONFIG_GPIO_PARPORT_MUTEX is not set
15 # CONFIG_GPIO_PARPORT_EXCLUSIVE is not set
16 CONFIG_GPIO_PARPORT_NOCLAIME=y
17 endif
18
19 ifndef CONFIG_SPI_PARPORT
20 EXTERNAL_BUILD=y
21 CONFIG_SPI_PARPORT=m
22 # CONFIG_SPI_PARPORT_EXCLUSIVE is not set
23 endif
24
25
26 ifeq ($(CONFIG_SPI_HSO_DEBUG),y)
27 EXTRA_CFLAGS += -g -Wa,-adhlms=$@.lst
28 endif
29
30 ifdef KBUILD_EXTMOD
31 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)
32 endif
33
34
35 list-m :=
36 list-$(CONFIG_GPIO_PARPORT) += gpio_parport gpio_test
37 list-$(CONFIG_SPI_PARPORT) += spi_parport
38 obj-$(CONFIG_GPIO_PARPORT) += gpio_parport.o gpio_test.o
39 obj-$(CONFIG_SPI_PARPORT) += spi_parport.o
40
41 #
42 # Begin dual Makefile mode here. First we provide support for when we
43 # are being invoked by the kernel build system
44 #
45 ifneq ($(KERNELRELEASE),)
46
47 EXTRA_CFLAGS += -DCONFIG_PM
48
49 ifeq ($(EXTERNAL_BUILD),y)
50 ifeq ($(CONFIG_GPIO_PARPORT_MUTEX),y)
51 EXTRA_CFLAGS += -DCONFIG_GPIO_PARPORT_MUTEX
52 endif
53 ifeq ($(CONFIG_GPIO_PARPORT_EXCLUSIVE),y)
54 EXTRA_CFLAGS += -DCONFIG_GPIO_PARPORT_EXCLUSIVE
55 endif
56 ifeq ($(CONFIG_GPIO_PARPORT_NOCLAIME),y)
57 EXTRA_CFLAGS += -DCONFIG_GPIO_PARPORT_NOCLAIME
58 endif
59
60 ifeq ($(CONFIG_SPI_PARPORT_EXCLUSIVE),y)
61 EXTRA_CFLAGS += -DCONFIG_SPI_PARPORT_EXCLUSIVE
62 endif
63
64 ifeq ($(CONFIG_SPI_HSO_DEBUG),y)
65 EXTRA_CFLAGS += -DCONFIG_SPI_HSO_DEBUG
66 endif
67 endif
68
69 else
70 # Here we begin the portion that is executed if the user invoked this Makefile
71 # directly.
72
73 # KSRC should be set to the path to your sources
74 KVER := $(shell uname -r)
75 KSRC := /lib/modules/$(KVER)/build
76 INSTALLDIR:=/lib/modules/$(KVER)/kernel/drivers/net/wwan/
77
78 # KSRC_OUTPUT should be overridden if you are using a 2.6 kernel that
79 # has it's output sent elsewhere via KBUILD_OUTPUT= or O=
80 KSRC_OUTPUT := $(KSRC)
81
82 PWD=$(shell pwd)
83
84 VERFILE := $(KSRC_OUTPUT)/include/linux/version.h
85 KERNELRELEASE := $(shell \
86 if [ -r $(VERFILE) ]; then \
87 (cat $(VERFILE); echo UTS_RELEASE) | \
88 $(CC) -I$(KSRC_OUTPUT) $(CFLAGS) -E - | \
89 tail -n 1 | \
90 xargs echo; \
91 else \
92 uname -r; \
93 fi)
94
95 MODPATH := $(DESTDIR)/lib/modules/$(KERNELRELEASE)
96
97 all: modules
98
99 clean:
100 $(RM) -f *.mod.* *.mod *.o *.ko .*.o.cmd .*.ko.cmd *.flags .lst *.lst Module*.symvers
101 $(RM) -rf $(PWD)/tmp
102 $(RM) -rf .tmp_versions
103 $(RM) -f modules.order
104 $(RM) -f Module.markers
105
106 distclean: clean
107 rm -f tags TAGS
108
109 TMP=$(PWD)/tmp
110 MODVERDIR=$(TMP)/.tmp_versions
111
112 modules:
113 mkdir -p $(MODVERDIR)
114 ifdef ($(KSRC_OUTPUT)/.tmp_versions)
115 -cp $(KSRC_OUTPUT)/.tmp_versions/*.mod $(MODVERDIR)
116 endif
117 ifeq ($(KSRC),$(KSRC_OUTPUT)) # We're not outputting elsewhere
118 ifdef ($(KSRC)/.tmp_versions)
119 -cp $(KSRC)/.tmp_versions/*.mod $(MODVERDIR)
120 endif
121 $(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR) modules
122 else # We've got a kernel with seperate output, copy the config, and use O=
123 mkdir -p $(TMP)
124 cp $(KSRC_OUTPUT)/.config $(TMP)
125 $(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR)) O=$(PWD)/tmp modules
126 endif
127
128 test-gpio: modules
129 rmmod lp || true
130 rmmod ppdev || true
131 rmmod gpio_test || true
132 rmmod gpio_parport || true
133 insmod gpio_parport.ko
134 insmod gpio_test.ko gpi=254 irq=7
135
136 install: modules
137 for mod; $(list-m); do modprobe -r $mod || true; done
138 install -d $(INSTALLDIR)
139 install -m 644 -c $(addsuffix .ko,$(list-m)) $(INSTALLDIR)
140 /sbin/depmod -a ${KVER}
141
142 uninstall:
143 rm -rf $(addprefix $(INSTALLDIR),$(addsuffix .ko,$(list-m)))
144 /sbin/depmod -a ${KVER}
145
146 endif # End of internal build
147
148 .PHONY: TAGS tags
149
150 RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \) -prune -o
151 define all-sources
152 ( find . $(RCS_FIND_IGNORE) -name '*.[chS]' -print )
153 endef
154
155 TAGS:
156 $(all-sources) | etags -
157 tags:
158 $(RM) -f $@
159 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
160 $(all-sources) | xargs ctags $$CTAGSF -a
161