1##
2## Flags
3##
4export FIRMWARE_DYNAMIC_LOAD ?= y
5
6##
7##
8## File lists and locations
9##
10##
11
12#
13# DK_ROOT must be set prior to including common.inc
14#
15DK_ROOT := .
16ifeq ($(M),)
17    M = drivers/net/wireless/tiwlan1251
18endif
19DK_ROOT_INC = $(M)
20
21#
22# Includes common definitions and source file list
23#
24ifneq ($(KERNELRELEASE),)
25    include $(M)/common.inc
26    include $(M)/drv_sources.inc
27    include $(M)/os_sources.inc
28else
29ifeq ($(KERNEL_DIR),)
30    KERNEL_DIR = .
31endif
32    include common.inc
33    include drv_sources.inc
34    include os_sources.inc
35endif
36
37#
38# OS include paths required for compilation.
39# 
40OS_INCS = $(DK_ROOT)/pform/linux/inc $(DK_ROOT)/pform/common/inc
41OS_INCS += $(DK_ROOT)/common/src/core/EvHandler
42
43#
44# Location and filename of the driver .lib file created by this makefile.
45#
46OUTPUT_DIR = $(DK_ROOT)
47OUTPUT_FILE = $(OUTPUT_DIR)/libestadrv.a
48
49OS_SRCS = \
50    $(DK_ROOT)/pform/common/src/osCmd.c \
51    $(DK_ROOT)/pform/common/src/osUtil.c \
52    $(DK_ROOT)/pform/common/src/osClsfr.c \
53    $(DK_ROOT)/pform/common/src/osRgstry.c \
54    $(DK_ROOT)/pform/linux/src/esta_drv.c \
55    $(DK_ROOT)/pform/linux/src/chip_stat.c \
56    $(DK_ROOT)/pform/linux/src/mmc_tnetw1150_api.c \
57    $(DK_ROOT)/pform/linux/src/tnetw_sdio.c \
58    $(DK_ROOT)/pform/linux/src/osapi.c \
59    $(DK_ROOT)/pform/linux/src/osmemapi.c \
60    $(DK_ROOT)/pform/linux/src/env_tst.c \
61    $(DK_ROOT)/pform/linux/src/ioctl_list.c \
62    $(DK_ROOT)/pform/linux/src/ioctl_utils.c \
63    $(DK_ROOT)/pform/linux/src/osRgstry_parser.c \
64    $(DK_ROOT)/pform/linux/src/ipc_k.c \
65    $(DK_ROOT)/pform/linux/src/proc_stat.c
66    
67ifeq ($(DRIVER_PROFILING),y)
68    OS_SRCS += $(DK_ROOT)/pform/linux/src/tiwlan_profile.c
69endif
70
71ifeq ($(STACK_PROFILING_ON),y)
72    OS_SRCS += $(DK_ROOT)/pform/linux/src/stack_profile.c
73    EXTRA_CFLAGS += -D STACK_PROFILE
74endif
75
76ifeq ($(NO_ARCH_STRCMP),y)
77    OS_SRCS += $(DK_ROOT)/pform/linux/src/string.c
78endif
79    
80OS_OBJS = $(patsubst %.c, %.o, $(OS_SRCS))
81
82#
83# Remove debug info
84#
85EXTRA_LDFLAGS += --strip-debug
86
87##
88##
89## Build process
90##
91##
92
93ifneq ($(KERNELRELEASE),)
94
95
96	##
97	##
98	## This is the kernel build phase - set the appropriate arguments
99	##
100	##
101
102	#
103	# Adds the current directory as a prefix to all include directories.
104	#
105	EXTRA_CFLAGS += $(addprefix -I$(DK_ROOT_INC)/, $(DK_INCS) $(OS_INCS))
106
107	#
108	# Intermediate object name - this should be converted to the appropriate library file
109	# after the kernel makefile finishes its work.
110	#
111	obj-m += wlan.o
112	
113	#
114	# List of object files the kernel makefile needs to compile.
115	#
116	wlan-objs := $(DK_OBJS) $(OS_OBJS)
117
118	
119else	# ifneq ($(KERNELRELEASE),)
120
121	#
122	# Adds the current directory as a prefix to all include directories.
123	#
124	EXTRA_CFLAGS += $(addprefix -I$(M)/, $(DK_INCS) $(OS_INCS))
125
126
127##
128##
129## This is the regular build phase - act according to the make actions
130##
131##
132
133#
134# The location of the kernel makefile
135#
136KERNEL_DIR ?= /vobs/wlan_linux2.6/kernel-2.6/
137
138
139#
140# Build the driver lib file
141#
142.PHONY: all
143all: .depend $(OUTPUT_FILE)
144
145
146#
147# Prints variables
148#
149.PHONY: help
150help:
151	@echo Default Compilation:	BOARD=$(WIFI_BOARD) PLATFORM=$(PLATFORM) DEBUG=$(DEBUG) INTR=$(INTR) WSPI=$(WSPI) EXC=$(EXC) EXTRA CFLAGS: $(EXTRA_CFLAGS)
152
153
154#
155# Recursively cleans the driver files.
156#
157.PHONY: clean
158clean:
159	$(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) clean
160	@rm -f *.o *.a *~ *.~* core .depend dep $(DK_OBJS) $(OS_OBJS) $(DEPS)
161
162
163#
164# Causes the library file to get rebuilt.
165#
166.depend:
167	rm -f $(OUTPUT_FILE)
168
169
170#
171# Recursively builds the library file.
172#
173$(OUTPUT_FILE):
174	$(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules
175	@$(CROSS_COMPILE)$(AR) rcs $@ $(DK_OBJS) $(OS_OBJS)
176	$(CROSS_COMPILE)strip --strip-unneeded wlan.ko
177
178endif	# ifneq ($(KERNELRELEASE),)
179