1 STATIC_LIB ?= y 2 DEBUG ?= y 3 BUILD_SUPPL ?= y 4 SUPPL ?= ANDROID 5 WPA_ENTERPRISE ?= y 6 ETH_SUPPORT ?= n 7 8 ifeq ($(DEBUG),y) 9 DEBUGFLAGS = -O2 -g -DDEBUG -DTI_DBG -fno-builtin 10 else 11 DEBUGFLAGS = -O2 12 endif 13 14 WILINK_ROOT = ../../../.. 15 CUDK_ROOT = $(WILINK_ROOT)/CUDK 16 LIB_NAME = tiOsLib 17 OUTPUT_DIR ?= $(CUDK_ROOT)/output 18 19 DK_DEFINES = 20 ifeq ($(WPA_ENTERPRISE), y) 21 DK_DEFINES += -D WPA_ENTERPRISE 22 endif 23 24 ifeq ($(BUILD_SUPPL), y) 25 DK_DEFINES += -D WPA_SUPPLICANT -D CONFIG_CTRL_IFACE -D CONFIG_CTRL_IFACE_UNIX 26 -include $(CUDK_ROOT)/$(TI_SUPP_LIB_DIR)/.config 27 ifeq ($(CONFIG_EAP_WSC), y) 28 DK_DEFINES += -DCONFIG_EAP_WSC 29 endif 30 endif 31 32 ifeq ($(STATIC_LIB),y) 33 TARGET = $(OUTPUT_DIR)/$(LIB_NAME).a 34 else 35 TARGET = $(OUTPUT_DIR)/$(LIB_NAME).so 36 endif 37 38 ifeq ($(ETH_SUPPORT), y) 39 DK_DEFINES += -DETH_SUPPORT 40 endif 41 42 SRCS := \ 43 cu_wext.c \ 44 ipc_sta.c \ 45 ipc_event.c \ 46 ipc_wpa.c \ 47 os_trans.c \ 48 ParsEvent.c \ 49 osapi.c 50 ifeq ($(BUILD_SUPPL), y) 51 SRCS += \ 52 $(CUDK_ROOT)/$(TI_SUPP_LIB_DIR)/wpa_ctrl.c 53 endif 54 55 OBJS = $(SRCS:.c=.o) 56 57 DEPS = $(SRCS:%.c=%.d) 58 59 ARMFLAGS = -fno-common -pipe 60 61 INCLUDES = \ 62 -I ../inc \ 63 -I ../../common/inc \ 64 -I $(WILINK_ROOT)/stad/Export_Inc \ 65 -I $(WILINK_ROOT)/stad/src/Sta_Management \ 66 -I $(WILINK_ROOT)/stad/src/Application \ 67 -I $(WILINK_ROOT)/utils \ 68 -I $(WILINK_ROOT)/Txn \ 69 -I $(WILINK_ROOT)/TWD/TWDriver \ 70 -I $(WILINK_ROOT)/TWD/FirmwareApi \ 71 -I $(WILINK_ROOT)/TWD/FW_Transfer/Export_Inc \ 72 -I $(WILINK_ROOT)/TWD/TwIf \ 73 -I $(WILINK_ROOT)/platforms/os/linux/inc \ 74 -I $(WILINK_ROOT)/platforms/os/common/inc \ 75 -I $(WILINK_ROOT)/TWD/FirmwareApi \ 76 -I $(CUDK_ROOT)/$(TI_SUPP_LIB_DIR) \ 77 -I $(CUDK_ROOT)/configurationutility/inc 78 79 CFLAGS = -Wall -Wstrict-prototypes $(DEBUGFLAGS) $(INCLUDES) -D__LINUX__ $(DK_DEFINES) -D__BYTE_ORDER_LITTLE_ENDIAN 80 81 ifneq "$(CROSS_COMPILE)" "" #compile for ARM 82 CFLAGS += $(ARMFLAGS) 83 # strip symbols 84 ifneq "$(DEBUG)" "y" 85 LDFLAGS = -s 86 endif 87 88 endif # CROSS_COMPILE != "" 89 90 .PHONY: all 91 92 all: $(TARGET) 93 94 $(OUTPUT_DIR)/$(LIB_NAME).a: $(OBJS) 95 rm -f $@ 96 $(CROSS_COMPILE)$(AR) -q $@ $^ 97 98 $(OUTPUT_DIR)/$(LIB_NAME).so: $(OBJS) 99 rm -f $@ 100 $(CROSS_COMPILE)gcc -shared $(CFLAGS) $(OBJS) -lc -o $@ 101 $(CROSS_COMPILE)strip $@ 102 103 ifeq ("$(findstring $(MAKECMDGOALS), clean cleanall)", "") 104 -include .depend 105 endif 106 107 %.o: %.cpp 108 @echo $@ 109 @$(CROSS_COMPILE)gcc $(CFLAGS) -c $^ -o $@ 110 111 %.o: %.c 112 @echo $@ 113 @$(CROSS_COMPILE)gcc -s $(CFLAGS) -c $< -o $@ 114 115 %.i: %.c 116 @$(CROSS_COMPILE)gcc $(CFLAGS) -E -c $< > $@ 117 118 %.d: %.c 119 @echo $@ 120 @$(CROSS_COMPILE)gcc $< -MT$(^:%.c=%.o) -M $(CFLAGS) > $@ 121 122 %.d: %.cpp 123 @echo $@ 124 @$(CROSS_COMPILE)gcc $< -MT$(^:%.cpp=%.o) -M $(CFLAGS) > $@ 125 126 .depend: $(DEPS) 127 rm -f $@ 128 for aa in $^; do cat $$aa >> $@; done 129 130 .PHONY: clean 131 clean: 132 @echo cleaning OS library... 133 rm -f .depend $(OBJS) $(DEPS) $(SRCS:.c=.i) *.ko .*.cmd .*.flags *.mod.c *~ *.~* $(TARGET) 134 135 cleanall: clean 136 137