blob: 2e84c380cd06575a6851e7757d2cec674d0a7ddf [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001include $(zte_app_mak)
2#include ../net_team.mk
3include $(COMMON_MK)
4
5ifeq ($(CUR_USED_OS),LINUX)
6CC = $(CROSS_COMPILE)gcc
7STRIP = $(CROSS_COMPILE)strip
8LD = $(CROSS_COMPILE)ld
9AR = $(CROSS_COMPILE)ar
10endif
11
12EXEC_ZX = fota_dm_zx
13EXEC_ZX_TEST = fota_zx_test
14
15
16AM_CFLAGS += -D__packed__= \
17 -I./inc \
18 -I$(zte_lib_path)/libzte_dmapp/inc \
19 -I$(zte_app_path)/include \
20 -I$(zte_lib_path)/libnvram
21
22CFLAGS += $(AM_CFLAGS) -O2 -fPIC -c -g -Wall
23LDFLAGS += -lnvram -L$(zte_lib_path)/libnvram
24LDFLAGS += -lpthread
25LDFLAGS += -lztedmapp -L$(zte_lib_path)/libzte_dmapp
26LDFLAGS += -lsoftap -L$(zte_lib_path)/libsoftap
27LDFLAGS += -lsoft_timer -L$(zte_lib_path)/libsoft_timer
28
29
30CFLAGS += -I$(zte_lib_path)/libdmgr
31
32LDFLAGS_ZX += -lcurl -L$(zte_lib_path)/libcurl/install/lib
33LDFLAGS_ZX += -ldmgr -L$(zte_lib_path)/libdmgr $(LDFLAGS)
34
35
36h_sources += $(wildcard ./inc/*.h)
37c_sources = $(wildcard ./src/*.c)
38OBJS += $(patsubst %.c,%.o, $(c_sources))
39
40OBJS_TEST = fota_test.o ./src/fota_dm_dl_gs.o ./src/fota_dm_utils.o ./src/fota_dm_netdog.o
41
42
43
44all:$(EXEC_ZX) $(EXEC_ZX_TEST)
45ifeq ($(PC_LINT_CHECK), no)
46 $(shell echo "$(filter -D% -I%, $(CFLAGS))" | tr " " "\n" > $(ROOT_DIR)/build/pclint/mywork.lnt )
47 $(PC-LINT) $(patsubst %.o, %.c, $(OBJS)) > ./fota.lnt
48endif
49
50
51$(EXEC_ZX):$(OBJS)
52 @echo "=====================build fota_dm_zx====================="
53 $(CC) -o $@ $(OBJS) -Wl,--start-group $(LDFLAGS_ZX) -Wl,--end-group
54 cp $(EXEC_ZX) $(EXEC_ZX).elf
55
56%.o : %.c $(h_sources)
57 $(CC) $(CFLAGS) -o $@ $<
58
59
60$(EXEC_ZX_TEST): $(OBJS_TEST)
61 @echo "=====================build fota_zx_test====================="
62 $(CC) -o $@ $(OBJS_TEST) -Wl,--start-group $(LDFLAGS_ZX) -Wl,--end-group
63 cp $(EXEC_ZX_TEST) $(EXEC_ZX_TEST).elf
64
65romfs:
66 @echo "==========> zte FOTA rootfs $(bin_PROGRAMS)<=========="
67 $(ROMFSINST) $(EXEC_ZX) /bin/$(EXEC_ZX)
68# $(ROMFSINST) $(EXEC_ZX_TEST) /bin/$(EXEC_ZX_TEST)
69ifeq ($(CONFIG_USER_SINGLE_DM), gs)
70 rm -rf $(ROOTFS_DIR)//bin/$(EXEC_ZX)
71endif
72
73clean:
74 @echo "==========> clean fota dm zx<=========="
75 rm -f $(EXEC_ZX) $(EXEC_ZX_TEST) *.gdb $(EXEC_ZX).elf $(EXEC_ZX_TEST).elf ./src/*.o *.o