Merge branch 'fix/pcm-hwptr' into for-linus
[linux/fpc-iii.git] / drivers / staging / vt6655 / Makefile.x86
blob69082f09ba7326d0254d4faa2f7a1f5b33026924
2 # Build options:
3 # PRIV_OBJ := 1 for object version
6 IO_MAP := 0
7 HOSTAP := 1
8 PRIV_OBJ := 1
10 KSP := /lib/modules/$(shell uname -r)/build \
11 /usr/src/linux-$(shell uname -r) \
12 /usr/src/linux-$(shell uname -r | sed 's/-.*//') \
13 /usr/src/kernel-headers-$(shell uname -r) \
14 /usr/src/kernel-source-$(shell uname -r) \
15 /usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
16 /usr/src/linux
18 test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
19 KSP := $(foreach dir, $(KSP), $(test_dir))
21 KSRC := $(firstword $(KSP))
23 ifeq (,$(KSRC))
24 $(error Linux kernel source not found)
25 endif
27 # check kernel version
28 KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')
29 KERVER2=$(shell uname -r | cut -d. -f2)
31 ifeq ($(KVER), 2.6)
32 # 2.6 kernel
33 TARGET = viawget.ko
35 else
36 TARGET = viawget.o
38 endif
40 INSTDIR := $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1)
41 ifeq (,$(INSTDIR))
42 ifeq (,$(KERVER2))
43 ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel))
44 INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
45 else
46 INSTDIR := /lib/modules/$(shell uname -r)/net
47 endif
48 else
49 ifneq ($(KERVER2),2)
50 INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
51 else
52 INSTDIR := /lib/modules/$(shell uname -r)/net
53 endif
54 endif
55 endif
58 SRC = device_main.c card.c mac.c baseband.c wctl.c 80211mgr.c \
59 wcmd.c wmgr.c bssdb.c wpa2.c rxtx.c dpc.c power.c datarate.c \
60 srom.c mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c \
61 tkip.c michael.c wroute.c rf.c iwctl.c wpactl.c aes_ccmp.c
63 ifeq ($(IO_MAP), 1)
64 CFLAGS += -DIO_MAP
65 endif
67 ifeq ($(HOSTAP), 1)
68 CFLAGS += -DHOSTAP
69 endif
71 ifeq ($(PRIV_OBJ), 1)
72 CFLAGS += -DPRIVATE_OBJ
73 endif
75 CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/../solomon
78 # build rule
79 ifeq ($(KVER), 2.6)
80 # 2.6 kernel
82 ifndef KERNEL_CONF
83 KERNEL_CONF= $(KSRC)/.config
84 endif
86 include ${KERNEL_CONF}
88 obj-m += viawget.o
90 viawget-objs := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
91 wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
92 mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
93 michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o
95 .c.o:
96 $(CC) $(CFLAGS) -o $@ $<
98 default:
99 make -C $(KSRC) SUBDIRS=$(shell pwd) modules
101 else
103 # 2.2/2.4 kernel
104 OBJS := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
105 wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
106 mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
107 michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o
109 VERSION_FILE := $(KSRC)/include/linux/version.h
110 CONFIG_FILE := $(KSRC)/include/linux/config.h
113 ifeq (,$(wildcard $(VERSION_FILE)))
114 $(error Linux kernel source not configured - missing version.h)
115 endif
117 ifeq (,$(wildcard $(CONFIG_FILE)))
118 $(error Linux kernel source not configured - missing config.h)
119 endif
121 ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
122 CC := kgcc gcc cc
123 else
124 CC := gcc cc
125 endif
127 test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))
128 CC := $(foreach cc, $(CC), $(test_cc))
129 CC := $(firstword $(CC))
131 CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe
132 CFLAGS += -I$(KSRC)/include -Wstrict-prototypes -fomit-frame-pointer
133 CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
134 echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")
136 .SILENT: $(TARGET) clean
139 # look for SMP in config.h
140 SMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \
141 grep CONFIG_SMP | awk '{ print $$3 }')
143 ifneq ($(SMP),1)
144 SMP := 0
145 endif
148 ifeq ($(SMP), 1)
149 CFLAGS += -D__SMP__
150 endif
153 ifeq ($(PRIV_OBJ), 1)
154 CFLAGS += -DPRIVATE_OBJ
155 TARGET = x86g_up.o
157 ifeq ($(SMP), 1)
158 TARGET = x86g_smp.o
159 endif
161 endif
164 # check x86_64
165 SUBARCH := $(shell uname -m)
166 ifeq ($(SUBARCH),x86_64)
167 CFLAGS += -mcmodel=kernel -mno-red-zone
168 endif
171 $(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
172 $(LD) -r $^ -o $@
173 echo; echo
174 echo "**************************************************"
175 echo "Build options:"
176 echo " VERSION $(KVER)"
177 echo -n " SMP "
178 if [ "$(SMP)" = "1" ]; \
179 then echo "Enabled"; else echo "Disabled"; fi
183 endif # ifeq ($(KVER),2.6)
186 ifeq ($(KVER), 2.6)
187 install: default
188 else
189 install: clean $(TARGET)
190 endif
191 mkdir -p $(MOD_ROOT)$(INSTDIR)
192 install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR)
194 ifeq (,$(MOD_ROOT))
195 /sbin/depmod -a || true
196 else
197 /sbin/depmod -b $(MOD_ROOT) -a || true
198 endif
201 uninstall:
202 rm -f $(INSTDIR)/$(TARGET)
203 /sbin/depmod -a
205 clean:
206 rm -f $(TARGET) $(SRC:.c=.o) *~
207 rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o
209 -include .depend.mak