summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6655/Makefile.arm
blob: 3dd5431217879176f9a5c7ac5e2f077463964665 (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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#
#
# Build options:
#   PRIV_OBJ   := 1 for object version
#   BIG_ENDIAN := 1 for big-endian mode
#
#   arm-linux-tools chain are located at:
#     /usr/local/bin/arm-linux-gcc
#     /usr/local/bin/arm-linux-ld
#

IO_MAP := 0
HOSTAP := 1
PRIV_OBJ := 1
BIG_ENDIAN := 1

test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))

KSRC := $(firstword $(KSP))

#ifeq (,$(KSRC))
#  $(error Linux kernel source not found)
#endif

# check kernel version
KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')
KERVER2=$(shell uname -r | cut -d. -f2)

ifeq ($(KVER), 2.6)
# 2.6 kernel
TARGET = viawget.ko

else
TARGET = viawget.o

endif

INSTDIR	:= $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1)
ifeq (,$(INSTDIR))
	ifeq (,$(KERVER2))
		ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel))
			INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
		else
			INSTDIR := /lib/modules/$(shell uname -r)/net
		endif
	else
		ifneq ($(KERVER2),2)
			INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
		else
			INSTDIR := /lib/modules/$(shell uname -r)/net
		endif
	endif
endif


SRC = device_main.c card.c mac.c baseband.c wctl.c 80211mgr.c \
      wcmd.c wmgr.c bssdb.c rxtx.c dpc.c power.c datarate.c srom.c \
      mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c tkip.c \
      michael.c wroute.c rf.c iwctl.c wpactl.c wpa2.c aes_ccmp.c

ifeq ($(IO_MAP), 1)
  CFLAGS += -DIO_MAP
endif

ifeq ($(HOSTAP), 1)
  CFLAGS += -DHOSTAP
endif

ifeq ($(PRIV_OBJ), 1)
  CFLAGS += -DPRIVATE_OBJ
endif

ifeq ($(BIG_ENDIAN), 1)
  CFLAGS += -D__BIG_ENDIAN
  CFLAGS += -mbig-endian
  LDOPTS += -EB
else
  CFLAGS += -mlittle-endian
  LDOPTS += -EL
endif

CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/../solomon


# build rule
ifeq ($(KVER), 2.6)
# 2.6 kernel

ifndef KERNEL_CONF
KERNEL_CONF=	$(KSRC)/.config
endif

include ${KERNEL_CONF}

obj-m += viawget.o

viawget-objs :=	device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
	wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
	mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
	michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o

.c.o:
	$(CC) $(CFLAGS) -o $@ $<

default:
	make -C $(KSRC) SUBDIRS=$(shell pwd) modules

else

# 2.2/2.4 kernel
OBJS :=	device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
	wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
	mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
	michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o


CC := /usr/local/bin/arm-linux-gcc
LD := /usr/local/bin/arm-linux-ld

CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -D__NO_VERSION__ -O2 -pipe
#CFLAGS += -Wstrict-prototypes -fomit-frame-pointer
COPTS+= -march=armv4 -fno-strict-aliasing -fno-common
#COPTS+= -mapcs-32 -mtune=xscale  -mshort-load-bytes -msoft-float -mfp=2
#COPTS+= -mthumb  -mcpu=arm9 -ffunction-sections -fdata-sections


.SILENT: $(TARGET) clean



ifeq ($(PRIV_OBJ), 1)

ifeq ($(BIG_ENDIAN), 1)
  TARGET = arm_be_g.o
else
  TARGET = arm_le_g.o
endif

endif



$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
	$(LD) $(LDOPTS) -r $^ -o $@
	echo
	echo "***********************************"
	echo "Build options:"
	echo "   VERSION    $(KVER)"
	echo -n "   SMP             "
	if [ "$(SMP)" = "1" ]; \
		then echo "Enabled"; else echo "Disabled"; fi


endif # ifeq ($(KVER),2.6)


ifeq ($(KVER), 2.6)
install: default
else
install: clean $(TARGET)
endif
	mkdir -p $(MOD_ROOT)$(INSTDIR)
	install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR)

ifeq (,$(MOD_ROOT))
	/sbin/depmod -a || true
else
	/sbin/depmod -b $(MOD_ROOT) -a || true
endif


uninstall:
	rm -f $(INSTDIR)/$(TARGET)
	/sbin/depmod -a

clean:
	rm -f $(TARGET) $(SRC:.c=.o) *~
	rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o

-include .depend.mak