1 STATIC_LIB ?= y 2 DEBUG ?= y 3 BUILD_SUPPL ?= y 4 WPA_ENTERPRISE ?= y 5 XCC ?= n 6 #enable/disable wireless simple config (WPS) support 7 CONFIG_EAP_WSC ?= n 8 9 WILINK_ROOT = ../.. 10 CUDK_ROOT ?= $(WILINK_ROOT)/CUDK 11 CU_ROOT = $(CUDK_ROOT)/configurationutility 12 OUTPUT_DIR ?= $(CUDK_ROOT)/output 13 TI_OS_LIB_DIR=$(CUDK_ROOT)/output 14 ifeq ($(STATIC_LIB),y) 15 TI_OS_LIB = tiOsLib.a 16 else 17 TI_OS_LIB = tiOsLib.so 18 endif 19 20 ifeq ($(DEBUG),y) 21 DEBUGFLAGS = -O2 -g -DDEBUG -DTI_DBG -fno-builtin 22 else 23 DEBUGFLAGS = -O2 24 endif 25 26 DEBUGFLAGS+= -DHOST_COMPILE -DANDROID 27 28 ifeq ($(XCC), y) 29 DK_DEFINES = -D XCC_MODULE_INCLUDED 30 endif 31 ifeq ($(WPA_ENTERPRISE), y) 32 DK_DEFINES += -D WPA_ENTERPRISE 33 endif 34 35 TARGET := $(OUTPUT_DIR)/wlan_cu 36 SRCS := \ 37 src/console.c \ 38 src/cu_common.c \ 39 src/cu_cmd.c \ 40 src/ticon.c \ 41 src/wpa_core.c 42 43 ifeq ($(XCC), y) 44 SRCS += \ 45 XCC/cu_XCC.c 46 endif 47 48 49 OBJS = $(SRCS:.c=.o) 50 51 DEPS = $(SRCS:%.c=%.d) 52 53 ARMFLAGS = -fno-common -pipe 54 55 #Supplicant image building 56 ifeq ($(BUILD_SUPPL), y) 57 DK_DEFINES += -D WPA_SUPPLICANT -D CONFIG_CTRL_IFACE -D CONFIG_CTRL_IFACE_UNIX 58 -include $(CU_ROOT)/$(TI_SUPP_LIB_DIR)/.config 59 ifeq ($(CONFIG_EAP_WSC), y) 60 DK_DEFINES += -DCONFIG_EAP_WSC 61 endif 62 endif 63 64 INCLUDES = \ 65 -I inc \ 66 -I $(CUDK_ROOT)/os/linux/inc \ 67 -I $(CUDK_ROOT)/os/common/inc \ 68 -I $(WILINK_ROOT)/stad/Export_Inc \ 69 -I $(WILINK_ROOT)/stad/src/Sta_Management \ 70 -I $(WILINK_ROOT)/stad/src/Application \ 71 -I $(WILINK_ROOT)/utils \ 72 -I $(WILINK_ROOT)/Txn \ 73 -I $(WILINK_ROOT)/TWD/TWDriver \ 74 -I $(WILINK_ROOT)/TWD/FirmwareApi \ 75 -I $(WILINK_ROOT)/TWD/TwIf \ 76 -I $(WILINK_ROOT)/platforms/os/linux/inc \ 77 -I $(WILINK_ROOT)/platforms/os/common/inc \ 78 -I $(KERNEL_DIR)/include \ 79 -I $(WILINK_ROOT)/TWD/FW_Transfer/Export_Inc \ 80 -I $(CUDK_ROOT)/$(TI_SUPP_LIB_DIR) 81 82 ifeq ($(XCC), y) 83 INCLUDES += \ 84 -I XCC \ 85 -I $(WILINK_ROOT)/stad/Export_Inc/XCC \ 86 -I $(WILINK_ROOT)/utils/XCC \ 87 -I $(CUDK_ROOT)/devicescape-dsa-XCC-wps-2.0.1-008 \ 88 -I $(CUDK_ROOT)/devicescape-dsa-XCC-wps-2.0.1-008/openssl-0.9.8e/include 89 endif 90 91 CFLAGS = $(OPT) -Wall -Wstrict-prototypes $(DEBUGFLAGS) $(INCLUDES) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN 92 CFLAGS += -DDRV_NAME='"tiwlan"' 93 94 ifneq "$(CROSS_COMPILE)" "" #compile for ARM 95 CFLAGS += $(ARMFLAGS) 96 # strip symbols 97 ifneq "$(DEBUG)" "y" 98 LDFLAGS = -s 99 endif 100 101 endif # CROSS_COMPILE != "" 102 103 .PHONY: all 104 105 all: $(TARGET) 106 107 $(TARGET): $(OBJS) 108 $(CROSS_COMPILE)gcc --static $(OBJS) $(TI_OS_LIB_DIR)/$(TI_OS_LIB) -L $(CU_ROOT)/Output $(LDFLAGS) -lpthread -lc -o $@ 109 ifeq ($(DEBUG), y) 110 cp -a $(TARGET) $(TARGET)_debug 111 $(CROSS_COMPILE)strip -s $(TARGET) 112 endif #DEBUG 113 114 ifeq ("$(findstring $(MAKECMDGOALS), clean cleanall)", "") 115 -include .depend 116 endif 117 118 %.o: %.cpp 119 @echo $@ 120 @$(CROSS_COMPILE)gcc $(CFLAGS) -c $^ -o $@ 121 122 %.o: %.c 123 @echo $@ 124 @$(CROSS_COMPILE)gcc -s $(CFLAGS) -c $< -o $@ 125 126 %.i: %.c 127 @$(CROSS_COMPILE)gcc $(CFLAGS) -E -c $< > $@ 128 129 %.d: %.c 130 @echo $@ 131 @$(CROSS_COMPILE)gcc $< -MT$(^:%.c=%.o) -M $(CFLAGS) > $@ 132 133 %.d: %.cpp 134 @echo $@ 135 @$(CROSS_COMPILE)gcc $< -MT$(^:%.cpp=%.o) -M $(CFLAGS) > $@ 136 137 .depend: $(DEPS) 138 rm -f $@ 139 for aa in $^; do cat $$aa >> $@; done 140 141 .PHONY: clean 142 clean: 143 @echo cleaning configuration utility... 144 rm -f .depend $(OBJS) $(DEPS) $(SRCS:.c=.i) *.ko .*.cmd .*.flags *.mod.c *~ *.~* $(OUTPUT_DIR)/wlan_cu $(OUTPUT_DIR)/wlan_cu_debug 145 146 cleanall: clean 147 148 149