lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | ################################################### |
| 2 | export PC_LINT_CHECK = no |
| 3 | export PC-LINT = wine $(ROOT_DIR)/build/pclint/LINT-NT.EXE -u -b +fdi -zero $(ROOT_DIR)/build/pclint/std.lnt |
| 4 | |
| 5 | ############### °üº¬È«¾ÖÎļþ ####################### |
| 6 | include $(COMMON_MK) |
| 7 | ################ Ä¿±êÎļþ ########################## |
| 8 | TARGET1=wifi_test |
| 9 | TARGET2=wifi_manager |
| 10 | ############### FLAGS ¶¨Òå ########################### |
| 11 | |
| 12 | ifeq ($(CONFIG_WIFI_MODULE),realtek) |
| 13 | CFLAGS += -D__REALTEK_8192_CHIP__ |
| 14 | tools_dir += realtek_tools/auth realtek_tools/mini_upnp realtek_tools/utility |
| 15 | tools_dir += realtek_tools/wsc realtek_tools/wireless_tools.25 |
| 16 | else ifeq ($(CONFIG_WIFI_MODULE),rda5995) |
| 17 | CFLAGS += -D__RDA_5995_CHIP__ |
| 18 | tools_dir += rda_tools |
| 19 | else ifeq ($(CONFIG_WIFI_MODULE),esp8089) |
| 20 | CFLAGS += -D__ESP_8089_CHIP__ |
| 21 | tools_dir += esp_tools/eagle_test esp_tools/fcctest |
| 22 | endif |
| 23 | |
| 24 | $(warning CONFIG_WIFI_FUNCTION=$(CONFIG_WIFI_FUNCTION)) |
| 25 | |
| 26 | ifeq ($(findstring sta,$(CONFIG_WIFI_FUNCTION)), sta) |
| 27 | WLAN_STA_FUNC=yes |
| 28 | endif |
| 29 | |
| 30 | ifeq ($(findstring ap,$(CONFIG_WIFI_FUNCTION)), ap) |
| 31 | WLAN_AP_FUNC=yes |
| 32 | endif |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | CFLAGS += -I. -I./inc |
| 38 | CFLAGS += -I$(zte_app_path)/include |
| 39 | |
| 40 | LDLIBS += -lpthread |
| 41 | LDLIBS += -lnvram_sc -L$(zte_lib_path)/libnvram |
| 42 | LDLIBS += -lsoft_timer_sc -L$(zte_lib_path)/libsoft_timer |
| 43 | LDLIBS += -lsoftap -L$(zte_lib_path)/libsoftap |
| 44 | |
| 45 | CFLAGS += -I$(zte_lib_path)/include |
| 46 | CFLAGS += -I$(zte_lib_path)/libsoft_timer -I$(zte_lib_path)/libnvram -I$(zte_lib_path)/libsoftap |
| 47 | CFLAGS += -D__QRCODE_WIFI__ |
| 48 | CFLAGS += -g -Werror=implicit-function-declaration |
| 49 | |
| 50 | ifeq ($(WLAN_STA_FUNC),yes) |
| 51 | CFLAGS += -D__STA_FUNC__ |
| 52 | CFLAGS += -I$(zte_app_path)/wpa_supplicant-2.6/src/common |
| 53 | LDLIBS += -lwpa_client -L$(zte_app_path)/wpa_supplicant-2.6/wpa_supplicant |
| 54 | endif |
| 55 | ifeq ($(WLAN_AP_FUNC),yes) |
| 56 | CFLAGS += -D__AP_FUNC__ |
| 57 | CFLAGS += -I$(zte_app_path)/hostapd-2.6/src/common |
| 58 | LDLIBS += -lwpa_client -L$(zte_app_path)/hostapd-2.6/hostapd |
| 59 | endif |
| 60 | |
| 61 | |
| 62 | |
| 63 | BAKUP=backup |
| 64 | |
| 65 | # replace -O with -g in order to debug |
| 66 | OBJS = src/wlan_main.o src/wifi_socket.o src/wlan_rtc_sleep.o src/wifi_drv_ko.o \ |
| 67 | src/wifi_sta_ctrl.o src/wifi_util.o src/wlan_config_ssid.o src/wlan_netlink.o src/Vector.o |
| 68 | ifeq ($(CONFIG_WIFI_MODULE),realtek) |
| 69 | OBJS += src/wifi_hal.o |
| 70 | ifeq ($(WLAN_STA_FUNC),yes) |
| 71 | OBJS += src/wlan-station.o |
| 72 | endif |
| 73 | LDLIBS += -lwlan_interface |
| 74 | LDLIBS += -L$(zte_lib_path)/libwlan_interface |
| 75 | else ifeq ($(CONFIG_WIFI_MODULE),rda5995) |
| 76 | ifeq ($(WLAN_STA_FUNC),yes) |
| 77 | OBJS += src/wlan_sta_manager.o src/wlan_sm.o |
| 78 | endif |
| 79 | |
| 80 | ifeq ($(WLAN_AP_FUNC),yes) |
| 81 | OBJS += src/wifi_ap_ctrl.o |
| 82 | LDLIBS += -lwlan_interface |
| 83 | LDLIBS += -L$(zte_lib_path)/libwlan_interface |
| 84 | endif |
| 85 | else ifeq ($(CONFIG_WIFI_MODULE),esp8089) |
| 86 | ifeq ($(WLAN_STA_FUNC),yes) |
| 87 | OBJS += src/wlan_sta_manager.o src/wlan_sm.o |
| 88 | endif |
| 89 | |
| 90 | ifeq ($(WLAN_AP_FUNC),yes) |
| 91 | OBJS += src/wifi_ap_ctrl.o |
| 92 | LDLIBS += -lwlan_interface |
| 93 | LDLIBS += -L$(zte_lib_path)/libwlan_interface |
| 94 | endif |
| 95 | endif |
| 96 | |
| 97 | |
| 98 | OBJS_TEST = wifi_test.o src/wifi_util.o |
| 99 | |
| 100 | .PHONY: clean |
| 101 | |
| 102 | |
| 103 | all: $(TARGET2) |
| 104 | ifneq ($(tools_dir), ) |
| 105 | for i in $(tools_dir) ; do $(MAKE) -C $$i || exit $?; done |
| 106 | endif |
| 107 | ifeq ($(PC_LINT_CHECK), yes) |
| 108 | $(shell echo "$(filter -D% -I%, $(CFLAGS))" | tr " " "\n" > $(ROOT_DIR)/build/pclint/mywork.lnt ) |
| 109 | $(PC-LINT) $(patsubst %.o, %.c, $(OBJS)) > ./wlan.lnt |
| 110 | endif |
| 111 | |
| 112 | clean: |
| 113 | rm -f $(OBJS) $(TARGET1) $(TARGET2) *.gdb *.o *.elf |
| 114 | -find . -name \*.o -exec rm -rf {} \; |
| 115 | ifneq ($(tools_dir), ) |
| 116 | for i in $(tools_dir) ; do $(MAKE) -C $$i clean || exit $?; done |
| 117 | endif |
| 118 | |
| 119 | |
| 120 | $(TARGET1) : $(OBJS_TEST) |
| 121 | echo $(CUR_USED_OS) $(CFLAGS) $(LDFLAGS) |
| 122 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS_TEST) -Wl,--start-group $(LDLIBS) -Wl,--end-group |
| 123 | |
| 124 | $(TARGET2) : $(OBJS) |
| 125 | echo $(CUR_USED_OS) $(CFLAGS) $(LDFLAGS) |
| 126 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -Wl,--start-group $(LDLIBS) -Wl,--end-group |
| 127 | |
| 128 | romfs: $(BAKUP) |
| 129 | ifneq ($(tools_dir), ) |
| 130 | for i in $(tools_dir) ; do $(MAKE) -C $$i romfs || exit $?; done |
| 131 | endif |
| 132 | $(ROMFSINST) $(TARGET2) /bin/$(TARGET2) |
| 133 | # $(ROMFSINST) $(TARGET1) /bin/$(TARGET1) |
| 134 | backup: |
| 135 | # cp $(TARGET1) $(TARGET1).elf |
| 136 | cp $(TARGET2) $(TARGET2).elf |
| 137 | |