Home | History | Annotate | Download | only in CLI
      1 
      2 STATIC_LIB ?= y
      3 
      4 DEBUG ?= y
      5 FIRMWARE_DYNAMIC_LOAD ?= y
      6 BUILD_SUPPL ?= n
      7 
      8 EXC ?= n
      9 SG  ?= n
     10 GWSI_SA ?= n
     11 DRIVER_PROFILING ?= n
     12 
     13 STA_DK_ROOT = ../..
     14 
     15 ifeq ($(DEBUG),y)
     16   DEBUGFLAGS = -O0 -g -DDEBUG -DTI_DBG -fno-builtin   # "-O" is needed to expand inlines
     17 #  DEBUGFLAGS+= -DDEBUG_MESSAGES
     18 else
     19   DEBUGFLAGS = -O2
     20 endif
     21 
     22 DEBUGFLAGS+= -DHOST_COMPILE
     23 
     24 DK_ROOT = $(STA_DK_ROOT)
     25 COMMON  = $(DK_ROOT)/common
     26 COMSRC  = $(COMMON)/src
     27 TESTSRC = $(DK_ROOT)/Test
     28 CUDK_ROOT ?= $(DK_ROOT)/CUDK
     29 IPC_SRC = $(CUDK_ROOT)/IPC/Linux
     30 
     31 OUTPUT_DIR ?= $(STA_DK_ROOT)/CUDK/CLI
     32 
     33 DK_INCS = -I $(CUDK_ROOT)/CLI/drv_inc \
     34 	-I $(CUDK_ROOT)/CLI/pform_inc
     35 
     36 ifeq ($(EXC),y)
     37         DK_INCS += \
     38 	-I $(CUDK_ROOT)/CLI \
     39 	-I $(CUDK_ROOT)/Inc/EXC \
     40 	-I $(CUDK_ROOT)/CLI/EXC
     41 endif
     42 ifeq ($(SG), y)
     43 #   	DK_INCS += -I $(COMSRC)/core/NetworkCtrl/BThWlanCombo
     44 endif
     45 
     46 DK_DEFINES = \
     47 	-D __BYTE_ORDER_LITTLE_ENDIAN \
     48 	-D INCLUDE_DEFRAGMENTATION \
     49 	-D CONFIGURE_BSS_TYPE_STA \
     50 	-D TNETW1130=1 \
     51 	-D DOT11_A_G=1 \
     52 	-D ELP_NO_PDA_SCREEN_VIBRATE
     53 ifeq ($(EXC), y)
     54 	DK_DEFINES += -D EXC_MODULE_INCLUDED
     55 endif    
     56 ifeq ($(SG), y)
     57    	DK_DEFINES += -D BTH_COEXISTENCE
     58 endif
     59 
     60 ifeq ($(DRIVER_PROFILING),y)
     61    DK_DEFINES += -D DRIVER_PROFILING
     62 endif
     63 
     64 TARGET := $(OUTPUT_DIR)/wlan_cu
     65 SRCS  := ticon.c console.c cu_cmd.c eth_utils.c wipp_ctrl.c dbg_module.c ipc.c g_tester.c  
     66 ifeq ($(EXC), y)
     67     SRCS += EXC/cu_cmd_exc.c
     68 endif
     69 OBJS = $(SRCS:.c=.o)
     70 
     71 DEPS = $(SRCS:%.c=%.d)
     72 
     73 # export CROSS_COMPILE ?= arm_v4t_le-
     74 export CROSS_COMPILE ?= arm-linux-
     75 
     76 #ARMFLAGS  = -Wstrict-prototypes -Wno-trigraphs -Os -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe
     77 #ARMFLAGS += -mapcs -mno-sched-prolog -mapcs-32 -D__LINUX_ARM_ARCH__=4 -march=armv4
     78 #ARMFLAGS += -mtune=arm9tdmi -mshort-load-bytes -msoft-float  -iwithprefix include
     79 
     80 ARMFLAGS  = -fno-common -pipe
     81 
     82 TI_UTIL_ADAPTER_LIB_DIR=$(CUDK_ROOT)/UtilityAdapter
     83 TI_UTIL_ADAPTER_LIB = tiOsLib
     84 
     85 #Supplicant image building
     86 SUPP_ROOT = $(STA_DK_ROOT)/CUDK/Supplicant
     87 TI_SUPP_LIB_DIR = $(SUPP_ROOT)/odyssey
     88 
     89 ifeq ($(BUILD_SUPPL), y)
     90   SUPPL_TARGET = $(OUTPUT_DIR)/wlan_suppl
     91 endif
     92 
     93 INCLUDES = $(DK_INCS) -I $(STA_DK_ROOT)/CUDK/CLI/pform_inc \
     94 			-I $(STA_DK_ROOT)/CUDK/Inc
     95 
     96 ifeq ($(GWSI_SA), n)
     97 ifeq ($(BUILD_SUPPL), y)
     98 	INCLUDES +=	-I $(SUPP_ROOT)/odyssey/odSupp/linux/inc
     99 endif
    100 endif
    101 
    102 CFLAGS = -Wall -Wstrict-prototypes $(DEBUGFLAGS) $(INCLUDES) -D__LINUX__ $(DK_DEFINES)
    103 CFLAGS += -DDRV_NAME='"tiwlan"'
    104 
    105 ifeq ($(FIRMWARE_DYNAMIC_LOAD), y)
    106     CFLAGS += -DFIRMWARE_DYNAMIC_LOAD
    107 endif
    108 
    109 ifneq "$(CROSS_COMPILE)" ""		#compile for ARM
    110 	CFLAGS += $(ARMFLAGS)
    111         # strip symbols
    112 ifneq "$(DEBUG)" "y"
    113     LDFLAGS = -s
    114 endif
    115 
    116 endif    # CROSS_COMPILE != ""
    117 
    118 .PHONY: all $(TI_UTIL_ADAPTER_LIB) $(SUPPL_TARGET)
    119 
    120 all: $(TARGET) $(SUPPL_TARGET)
    121 
    122 $(TI_UTIL_ADAPTER_LIB):
    123 	$(MAKE) -e -C $(TI_UTIL_ADAPTER_LIB_DIR) DEBUG=$(DEBUG) EXC=$(EXC) STATIC_LIB=$(STATIC_LIB) CROSS_COMPILE=$(CROSS_COMPILE) SG=$(SG) DRIVER_PROFILING=$(DRIVER_PROFILING)
    124 
    125 ifeq ($(BUILD_SUPPL), y)
    126 
    127 $(SUPPL_TARGET):
    128 	$(MAKE) -e -C $(TI_SUPP_LIB_DIR) DEBUG=$(DEBUG) EXC=$(EXC) CROSS_COMPILE=$(CROSS_COMPILE) STATIC_LIB=$(STATIC_LIB)
    129 ifeq ($(DEBUG), y)
    130 	cp -a $(SUPPL_TARGET) $(SUPPL_TARGET)_debug
    131 	$(CROSS_COMPILE)strip -s $(SUPPL_TARGET)
    132 endif    #DEBUG
    133 
    134 endif
    135 
    136 $(TARGET): $(OBJS) $(TI_UTIL_ADAPTER_LIB)
    137 #	echo MAKECMDGOALS: $(MAKECMDGOALS) : $(findstring $(MAKECMDGOALS), "clean cleanall")
    138 	$(CROSS_COMPILE)gcc $(OBJS) -L $(CUDK_ROOT)/Output -l $(TI_UTIL_ADAPTER_LIB) $(LDFLAGS) -lpthread -lc -lstdc++ -o $@
    139 ifeq ($(DEBUG), y)
    140 	cp -a $(TARGET) $(TARGET)_debug
    141 	$(CROSS_COMPILE)strip -s $(TARGET)
    142 endif    #DEBUG
    143 
    144 ifeq ("$(findstring $(MAKECMDGOALS), clean cleanall)", "")
    145 -include .depend
    146 endif
    147 
    148 %.o: %.cpp
    149 	@echo $@
    150 	@$(CROSS_COMPILE)gcc $(CFLAGS) -c $^ -o $@
    151 
    152 %.o: %.c
    153 	@echo $@
    154 	@$(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@
    155 
    156 %.i: %.c
    157 	@$(CROSS_COMPILE)gcc $(CFLAGS) -E -c $< > $@
    158 
    159 %.d: %.c
    160 	@echo $@
    161 	@$(CROSS_COMPILE)gcc $< -MT$(^:%.c=%.o) -M $(CFLAGS) > $@
    162 
    163 %.d: %.cpp
    164 	@echo $@
    165 	@$(CROSS_COMPILE)gcc $< -MT$(^:%.cpp=%.o) -M $(CFLAGS) > $@
    166 
    167 .depend: $(DEPS)
    168 	rm -f $@
    169 	for aa in $^; do cat $$aa >> $@; done
    170 
    171 .PHONY: clean
    172 clean:
    173 	@rm -f .depend $(OBJS) $(DEPS) $(SRCS:.c=.i) *.ko .*.cmd .*.flags *.mod.c *~ *.~*
    174 
    175 cleanall: clean
    176 	$(MAKE) -e -C $(TI_UTIL_ADAPTER_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) clean
    177 ifeq ($(GWSI_SA), n)
    178 ifeq ($(BUILD_SUPPL), y)
    179 	$(MAKE) -e -C $(TI_SUPP_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) clean
    180 endif
    181 	@rm -f $(SUPPL_OBJS) $(SUPPL_OBJS:.c=.d) $(OUTPUT_DIR)/wlan_suppl $(SUPPL_TARGET)
    182 endif
    183 	@rm -rf $(TARGET) $(OUTPUT_DIR)/../debug
    184 
    185 TAGS: $(SRCS)
    186 	{ find $(COMMON) -name '*.h' -print ; \
    187 	  find . -name '*.h' -print ; } | etags -
    188 	  etags -a $(SRCS)
    189 
    190 
    191 
    192 
    193