1#
2# Build options
3#
4# compiling the OAL as static lib
5STATIC_LIB ?= y
6# compiling in debug mode
7DEBUG ?= y
8# build the supplicant
9BUILD_SUPPL ?= y
10# type of supplicant to build
11# WPA = Point to TI's supplicant
12# ANDROID = Will point to Android's supplicant
13SUPPL?=ANDROID
14# enable WPA enterprise authorization modes
15WPA_ENTERPRISE ?= y
16# add XCC support
17XCC ?= n
18
19#
20# Directories and files
21#
22WILINK_ROOT = ..
23CUDK_ROOT ?= $(WILINK_ROOT)/CUDK
24CU_DIR = $(CUDK_ROOT)/configurationutility
25
26LOGGER_DIR = $(CUDK_ROOT)/logger/linux
27OUTPUT_DIR ?= $(CUDK_ROOT)/output
28TI_OS_LIB_DIR=$(CUDK_ROOT)/os/linux/src
29ifeq ($(STATIC_LIB),y)
30        TI_OS_LIB = tiOsLib.a
31else
32        TI_OS_LIB = tiOsLib.so
33endif
34WLAN_LOADER_DIR = $(CUDK_ROOT)/tiwlan_loader/
35
36
37#
38# Targets
39#
40CU_TARGET = $(OUTPUT_DIR)/wlan_cu
41OS_TARGET = $(OUTPUT_DIR)/$(TI_OS_LIB)
42LOADER_TARGET = $(OUTPUT_DIR)/tiwlan_loader
43ALL_TARGETS = $(OS_TARGET) $(LOADER_TARGET) $(CU_TARGET)
44#Supplicant directory, file and target
45
46ifeq ($(SUPPL),WPA)
47  SUPPL_TARGET = $(OUTPUT_DIR)/wpa_supplicant
48  TI_SUPP_LIB_DIR = $(CUDK_ROOT)/wpa_suppl
49  ifeq ($(BUILD_SUPPL),y)
50    ALL_TARGETS += $(SUPPL_TARGET)
51  endif
52endif
53
54ifeq ($(SUPPL),DEVICESCAPE)
55  SUPPL_TARGET = $(OUTPUT_DIR)/wpa_supplicant
56  TI_SUPP_LIB_DIR = $(CUDK_ROOT)/devicescape-dsa-XCC-wps-2.0.1-008
57  ifeq ($(BUILD_SUPPL),y)
58    ALL_TARGETS += $(SUPPL_TARGET)
59  endif
60endif
61
62ifeq ($(SUPPL),ANDROID)
63  TI_SUPP_LIB_DIR = $(CUDK_ROOT)/../../../../../external/wpa_supplicant
64endif
65
66.PHONY: all
67all: $(ALL_TARGETS)
68
69.PHONY: $(SUPPL_TARGET)
70$(SUPPL_TARGET):
71ifeq ($(SUPPL),DEVICESCAPE)
72	$(MAKE) -e -C $(TI_SUPP_LIB_DIR) DEBUG=$(DEBUG) XCC=$(XCC) CROSS_COMPILE=$(CROSS_COMPILE) STATIC_LIB=$(STATIC_LIB) TI_WLAN_DRIVER=y CONFIG_CTRL_IFACE=unix 
73else
74	$(MAKE) -e -C $(TI_SUPP_LIB_DIR) DEBUG=$(DEBUG) XCC=$(XCC) CROSS_COMPILE=$(CROSS_COMPILE) STATIC_LIB=$(STATIC_LIB) TI_WLAN_DRIVER=y CONFIG_CTRL_IFACE=unix CONFIG_EAP_WSC=y CONFIG_WPS=y
75
76endif
77	$(CROSS_COMPILE)strip -s $(TI_SUPP_LIB_DIR)/wpa_supplicant
78	cp -f $(TI_SUPP_LIB_DIR)/wpa_supplicant $(OUTPUT_DIR)
79
80.PHONY: $(OS_TARGET)
81$(OS_TARGET):
82	@echo ALL_TARGETS=$(ALL_TARGETS)
83	@echo SUPPL=$(SUPPL)
84	@echo BUILD_SUPPL=$(BUILD_SUPPL) 
85	$(MAKE) -C $(TI_OS_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) STATIC_LIB=$(STATIC_LIB) XCC=$(XCC) WPA_ENTERPRISE=$(WPA_ENTERPRISE) SUPPL=$(SUPPL) BUILD_SUPPL=$(BUILD_SUPPL) TI_SUPP_LIB_DIR=$(TI_SUPP_LIB_DIR)
86
87.PHONY: $(CU_TARGET)
88$(CU_TARGET):
89	$(MAKE) -C $(CU_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) STATIC_LIB=$(STATIC_LIB) XCC=$(XCC) WPA_ENTERPRISE=$(WPA_ENTERPRISE) SUPPL=$(SUPPL) BUILD_SUPPL=$(BUILD_SUPPL) TI_SUPP_LIB_DIR=$(TI_SUPP_LIB_DIR)
90
91.PHONY: $(LOADER_TARGET)
92$(LOADER_TARGET):
93	$(MAKE) -C $(WLAN_LOADER_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) STATIC_LIB=$(STATIC_LIB)
94
95.PHONY: clean
96clean:
97	$(MAKE) -C $(CU_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) XCC=$(XCC) clean
98	$(MAKE) -C $(TI_OS_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) XCC=$(XCC) clean
99	$(MAKE) -C $(WLAN_LOADER_DIR) CROSS_COMPILE=$(CROSS_COMPILE) clean
100ifeq ($(BUILD_SUPPL), y)
101	$(MAKE) -e -C $(TI_SUPP_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) clean
102endif
103ifeq ($(SUPPL), WPA)
104	rm -f $(OUTPUT_DIR)/wpa_supplicant
105	$(MAKE) -C $(TI_SUPP_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) XCC=$(XCC) clean
106endif
107
108
109ifeq ($(ETH_SUPPORT), y)
110	DK_DEFINES += -D ETH_SUPPORT
111endif 
112