1 2 STATIC_LIB ?= y 3 4 DEBUG ?= y 5 HOST_PLATFORM ?= wipp 6 WILINK_ROOT = ../.. 7 CUDK_ROOT = $(WILINK_ROOT)/CUDK 8 TI_OS_LIB_DIR=$(CUDK_ROOT)/output 9 ifeq ($(STATIC_LIB),y) 10 TI_OS_LIB = tiOsLib.a 11 else 12 TI_OS_LIB = tiOsLib.so 13 endif 14 15 ifeq ($(DEBUG),y) 16 DEBUGFLAGS = -O2 -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 COMMON = $(WILINK_ROOT)/stad 23 24 #ARMFLAGS = -fno-common -pipe -msoft-float -mabi=apcs-gnu 25 ARMFLAGS = -fno-common -pipe -g -fno-builtin -Wall 26 27 INCLUDES = \ 28 -I $(CUDK_ROOT)/os/common/inc \ 29 -I $(WILINK_ROOT)/platforms/os/common/inc \ 30 -I $(WILINK_ROOT)/platforms/os/linux/inc \ 31 -I $(WILINK_ROOT)/stad/Export_Inc \ 32 -I $(WILINK_ROOT)/stad/src/Sta_Management \ 33 -I $(WILINK_ROOT)/stad/src/Connection_Managment \ 34 -I $(WILINK_ROOT)/stad/src/Application \ 35 -I $(WILINK_ROOT)/utils \ 36 -I $(WILINK_ROOT)/Txn \ 37 -I $(WILINK_ROOT)/TWD/TWDriver \ 38 -I $(WILINK_ROOT)/TWD/FirmwareApi \ 39 -I $(WILINK_ROOT)/TWD/FW_Transfer/Export_Inc \ 40 -I $(WILINK_ROOT)/TWD/TwIf \ 41 -I $(CUDK_ROOT)/os/linux/inc \ 42 -I $(KERNEL_DIR)/include 43 44 OUTPUT_DIR ?= $(CUDK_ROOT)/output 45 46 TARGET = $(OUTPUT_DIR)/tiwlan_loader 47 SRCS := \ 48 tiwlan_loader.c 49 50 OBJS = $(SRCS:.c=.o) 51 52 DEPS = $(SRCS:%.c=%.d) 53 54 CFLAGS = -Wall -Wstrict-prototypes $(DEBUGFLAGS) $(INCLUDES) -D__LINUX__ $(DK_DEFINES) 55 CFLAGS += -D__BYTE_ORDER_LITTLE_ENDIAN 56 CFLAGS += -DDRV_NAME='"tiwlan"' 57 58 ifneq "$(CROSS_COMPILE)" "" #compile for ARM 59 CFLAGS += $(ARMFLAGS) 60 # strip symbols 61 ifneq "$(DEBUG)" "y" 62 LDFLAGS = -s 63 endif 64 65 endif # CROSS_COMPILE != "" 66 67 .PHONY: all 68 69 all: $(TARGET) 70 71 $(TARGET): $(OBJS) 72 $(CROSS_COMPILE)gcc --static $(OBJS) $(TI_OS_LIB_DIR)/$(TI_OS_LIB) -L $(CUDK_ROOT)/output $(LDFLAGS) -lpthread -lc -o $@ 73 $(CROSS_COMPILE)strip -s $(TARGET) 74 75 ifeq ("$(findstring $(MAKECMDGOALS), clean cleanall)", "") 76 -include .depend 77 endif 78 79 %.o: %.cpp 80 echo $@ 81 $(CROSS_COMPILE)gcc $(CFLAGS) -c $^ -o $@ 82 83 %.o: %.c 84 @echo $@ 85 @$(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@ 86 87 %.i: %.c 88 $(CROSS_COMPILE)gcc $(CFLAGS) -E -c $< > $@ 89 90 %.d: %.c 91 @echo $@ 92 @$(CROSS_COMPILE)gcc $< -MT$(^:%.c=%.o) -M $(CFLAGS) > $@ 93 94 %.d: %.cpp 95 echo $@ 96 $(CROSS_COMPILE)gcc $< -MT$(^:%.cpp=%.o) -M $(CFLAGS) > $@ 97 98 .depend: $(DEPS) 99 rm -f $@ 100 for aa in $^; do cat $$aa >> $@; done 101 102 .PHONY: clean 103 clean: 104 -rm -f $(TARGET) .depend $(OBJS) $(DEPS) $(SRCS:.c=.i) *.ko .*.cmd .*.flags *.mod.c *~ *.~* 105 106