blob: 791f916a91090db0e286c472efe5099f02c83eea [file] [log] [blame]
###################################################
export PC_LINT_CHECK = no
export PC-LINT = wine $(ROOT_DIR)/build/pclint/LINT-NT.EXE -u -b +fdi -zero $(ROOT_DIR)/build/pclint/std.lnt
############### °üº¬È«¾ÖÎļþ #######################
include $(COMMON_MK)
################ Ä¿±êÎļþ ##########################
TARGET1=wifi_test
TARGET2=wifi_manager
############### FLAGS ¶¨Òå ###########################
ifeq ($(CONFIG_WIFI_MODULE),realtek)
CFLAGS += -D__REALTEK_8192_CHIP__
tools_dir += realtek_tools/auth realtek_tools/mini_upnp realtek_tools/utility
tools_dir += realtek_tools/wsc realtek_tools/wireless_tools.25
else ifeq ($(CONFIG_WIFI_MODULE),rda5995)
CFLAGS += -D__RDA_5995_CHIP__
tools_dir += rda_tools
else ifeq ($(CONFIG_WIFI_MODULE),esp8089)
CFLAGS += -D__ESP_8089_CHIP__
tools_dir += esp_tools/eagle_test esp_tools/fcctest
endif
$(warning CONFIG_WIFI_FUNCTION=$(CONFIG_WIFI_FUNCTION))
ifeq ($(findstring sta,$(CONFIG_WIFI_FUNCTION)), sta)
WLAN_STA_FUNC=yes
endif
ifeq ($(findstring ap,$(CONFIG_WIFI_FUNCTION)), ap)
WLAN_AP_FUNC=yes
endif
CFLAGS += -I. -I./inc
CFLAGS += -I$(zte_app_path)/include
LDLIBS += -lpthread
LDLIBS += -lnvram_sc -L$(zte_lib_path)/libnvram
LDLIBS += -lsoft_timer_sc -L$(zte_lib_path)/libsoft_timer
LDLIBS += -lsoftap -L$(zte_lib_path)/libsoftap
CFLAGS += -I$(zte_lib_path)/include
CFLAGS += -I$(zte_lib_path)/libsoft_timer -I$(zte_lib_path)/libnvram -I$(zte_lib_path)/libsoftap
CFLAGS += -D__QRCODE_WIFI__
CFLAGS += -g -Werror=implicit-function-declaration
ifeq ($(WLAN_STA_FUNC),yes)
CFLAGS += -D__STA_FUNC__
CFLAGS += -I$(zte_app_path)/wpa_supplicant-2.6/src/common
LDLIBS += -lwpa_client -L$(zte_app_path)/wpa_supplicant-2.6/wpa_supplicant
endif
ifeq ($(WLAN_AP_FUNC),yes)
CFLAGS += -D__AP_FUNC__
CFLAGS += -I$(zte_app_path)/hostapd-2.6/src/common
LDLIBS += -lwpa_client -L$(zte_app_path)/hostapd-2.6/hostapd
endif
BAKUP=backup
# replace -O with -g in order to debug
OBJS = src/wlan_main.o src/wifi_socket.o src/wlan_rtc_sleep.o src/wifi_drv_ko.o \
src/wifi_sta_ctrl.o src/wifi_util.o src/wlan_config_ssid.o src/wlan_netlink.o src/Vector.o
ifeq ($(CONFIG_WIFI_MODULE),realtek)
OBJS += src/wifi_hal.o
ifeq ($(WLAN_STA_FUNC),yes)
OBJS += src/wlan-station.o
endif
LDLIBS += -lwlan_interface
LDLIBS += -L$(zte_lib_path)/libwlan_interface
else ifeq ($(CONFIG_WIFI_MODULE),rda5995)
ifeq ($(WLAN_STA_FUNC),yes)
OBJS += src/wlan_sta_manager.o src/wlan_sm.o
endif
ifeq ($(WLAN_AP_FUNC),yes)
OBJS += src/wifi_ap_ctrl.o
LDLIBS += -lwlan_interface
LDLIBS += -L$(zte_lib_path)/libwlan_interface
endif
else ifeq ($(CONFIG_WIFI_MODULE),esp8089)
ifeq ($(WLAN_STA_FUNC),yes)
OBJS += src/wlan_sta_manager.o src/wlan_sm.o
endif
ifeq ($(WLAN_AP_FUNC),yes)
OBJS += src/wifi_ap_ctrl.o
LDLIBS += -lwlan_interface
LDLIBS += -L$(zte_lib_path)/libwlan_interface
endif
endif
OBJS_TEST = wifi_test.o src/wifi_util.o
.PHONY: clean
all: $(TARGET2)
ifneq ($(tools_dir), )
for i in $(tools_dir) ; do $(MAKE) -C $$i || exit $?; done
endif
ifeq ($(PC_LINT_CHECK), yes)
$(shell echo "$(filter -D% -I%, $(CFLAGS))" | tr " " "\n" > $(ROOT_DIR)/build/pclint/mywork.lnt )
$(PC-LINT) $(patsubst %.o, %.c, $(OBJS)) > ./wlan.lnt
endif
clean:
rm -f $(OBJS) $(TARGET1) $(TARGET2) *.gdb *.o *.elf
-find . -name \*.o -exec rm -rf {} \;
ifneq ($(tools_dir), )
for i in $(tools_dir) ; do $(MAKE) -C $$i clean || exit $?; done
endif
$(TARGET1) : $(OBJS_TEST)
echo $(CUR_USED_OS) $(CFLAGS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_TEST) -Wl,--start-group $(LDLIBS) -Wl,--end-group
$(TARGET2) : $(OBJS)
echo $(CUR_USED_OS) $(CFLAGS) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -Wl,--start-group $(LDLIBS) -Wl,--end-group
romfs: $(BAKUP)
ifneq ($(tools_dir), )
for i in $(tools_dir) ; do $(MAKE) -C $$i romfs || exit $?; done
endif
$(ROMFSINST) $(TARGET2) /bin/$(TARGET2)
# $(ROMFSINST) $(TARGET1) /bin/$(TARGET1)
backup:
# cp $(TARGET1) $(TARGET1).elf
cp $(TARGET2) $(TARGET2).elf