blob: 791f916a91090db0e286c472efe5099f02c83eea [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001###################################################
2export PC_LINT_CHECK = no
3export PC-LINT = wine $(ROOT_DIR)/build/pclint/LINT-NT.EXE -u -b +fdi -zero $(ROOT_DIR)/build/pclint/std.lnt
4
5############### °üº¬È«¾ÖÎļþ #######################
6include $(COMMON_MK)
7################ Ä¿±êÎļþ ##########################
8TARGET1=wifi_test
9TARGET2=wifi_manager
10############### FLAGS ¶¨Òå ###########################
11
12ifeq ($(CONFIG_WIFI_MODULE),realtek)
13CFLAGS += -D__REALTEK_8192_CHIP__
14tools_dir += realtek_tools/auth realtek_tools/mini_upnp realtek_tools/utility
15tools_dir += realtek_tools/wsc realtek_tools/wireless_tools.25
16else ifeq ($(CONFIG_WIFI_MODULE),rda5995)
17CFLAGS += -D__RDA_5995_CHIP__
18tools_dir += rda_tools
19else ifeq ($(CONFIG_WIFI_MODULE),esp8089)
20CFLAGS += -D__ESP_8089_CHIP__
21tools_dir += esp_tools/eagle_test esp_tools/fcctest
22endif
23
24$(warning CONFIG_WIFI_FUNCTION=$(CONFIG_WIFI_FUNCTION))
25
26ifeq ($(findstring sta,$(CONFIG_WIFI_FUNCTION)), sta)
27WLAN_STA_FUNC=yes
28endif
29
30ifeq ($(findstring ap,$(CONFIG_WIFI_FUNCTION)), ap)
31WLAN_AP_FUNC=yes
32endif
33
34
35
36
37CFLAGS += -I. -I./inc
38CFLAGS += -I$(zte_app_path)/include
39
40LDLIBS += -lpthread
41LDLIBS += -lnvram_sc -L$(zte_lib_path)/libnvram
42LDLIBS += -lsoft_timer_sc -L$(zte_lib_path)/libsoft_timer
43LDLIBS += -lsoftap -L$(zte_lib_path)/libsoftap
44
45CFLAGS += -I$(zte_lib_path)/include
46CFLAGS += -I$(zte_lib_path)/libsoft_timer -I$(zte_lib_path)/libnvram -I$(zte_lib_path)/libsoftap
47CFLAGS += -D__QRCODE_WIFI__
48CFLAGS += -g -Werror=implicit-function-declaration
49
50ifeq ($(WLAN_STA_FUNC),yes)
51CFLAGS += -D__STA_FUNC__
52CFLAGS += -I$(zte_app_path)/wpa_supplicant-2.6/src/common
53LDLIBS += -lwpa_client -L$(zte_app_path)/wpa_supplicant-2.6/wpa_supplicant
54endif
55ifeq ($(WLAN_AP_FUNC),yes)
56CFLAGS += -D__AP_FUNC__
57CFLAGS += -I$(zte_app_path)/hostapd-2.6/src/common
58LDLIBS += -lwpa_client -L$(zte_app_path)/hostapd-2.6/hostapd
59endif
60
61
62
63BAKUP=backup
64
65# replace -O with -g in order to debug
66OBJS = 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
68ifeq ($(CONFIG_WIFI_MODULE),realtek)
69OBJS += src/wifi_hal.o
70 ifeq ($(WLAN_STA_FUNC),yes)
71 OBJS += src/wlan-station.o
72 endif
73LDLIBS += -lwlan_interface
74LDLIBS += -L$(zte_lib_path)/libwlan_interface
75else 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
82LDLIBS += -lwlan_interface
83LDLIBS += -L$(zte_lib_path)/libwlan_interface
84 endif
85else 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
92LDLIBS += -lwlan_interface
93LDLIBS += -L$(zte_lib_path)/libwlan_interface
94 endif
95endif
96
97
98OBJS_TEST = wifi_test.o src/wifi_util.o
99
100.PHONY: clean
101
102
103all: $(TARGET2)
104ifneq ($(tools_dir), )
105 for i in $(tools_dir) ; do $(MAKE) -C $$i || exit $?; done
106endif
107ifeq ($(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
110endif
111
112clean:
113 rm -f $(OBJS) $(TARGET1) $(TARGET2) *.gdb *.o *.elf
114 -find . -name \*.o -exec rm -rf {} \;
115ifneq ($(tools_dir), )
116 for i in $(tools_dir) ; do $(MAKE) -C $$i clean || exit $?; done
117endif
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
128romfs: $(BAKUP)
129ifneq ($(tools_dir), )
130 for i in $(tools_dir) ; do $(MAKE) -C $$i romfs || exit $?; done
131endif
132 $(ROMFSINST) $(TARGET2) /bin/$(TARGET2)
133# $(ROMFSINST) $(TARGET1) /bin/$(TARGET1)
134backup:
135# cp $(TARGET1) $(TARGET1).elf
136 cp $(TARGET2) $(TARGET2).elf
137