b.liu | 3743bce | 2024-03-22 19:27:58 +0800 | [diff] [blame] | 1 | BUILD_ROOT = $(shell pwd)/.. |
| 2 | include $(BUILD_ROOT)/Make.defines |
b.liu | 9a30686 | 2024-03-06 16:49:40 +0800 | [diff] [blame] | 3 | |
| 4 | LOCAL_PATH=$(BUILD_ROOT)/libmbtk_tcpip |
| 5 | |
| 6 | INC_DIR += |
| 7 | |
| 8 | LIB_DIR += |
| 9 | |
| 10 | LIBS += -llog -lmbtk_lib -lmbtk_net |
| 11 | |
| 12 | CFLAGS += -shared -Wl,-shared,-Bsymbolic |
| 13 | |
| 14 | MY_FILES_PATH:=$(LOCAL_PATH) |
| 15 | MY_FILES_SUFFIX:=%.c %.cpp |
| 16 | My_All_Files := $(foreach src_path,$(MY_FILES_PATH), $(shell find "$(src_path)" -type f)) |
| 17 | MY_SRC_LIST := $(filter $(MY_FILES_SUFFIX),$(My_All_Files)) |
| 18 | MY_SRC_LIST := $(MY_SRC_LIST:$(LOCAL_PATH)/%=%) |
| 19 | LOCAL_SRC_FILES += $(MY_SRC_LIST) |
| 20 | |
| 21 | OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(LOCAL_SRC_FILES))) |
| 22 | $(info OBJS = $(OBJS)) |
| 23 | |
| 24 | dtarget := $(OUT_DIR)/lib/libmbtk_tcpip.so |
| 25 | |
| 26 | all: $(dtarget) |
| 27 | |
| 28 | $(dtarget):$(OBJS) |
| 29 | $(CC) $(CFLAGS) $(DEFINE) $(LIB_DIR) $(LIBS) $(OBJS) -o $@ |
| 30 | |
| 31 | %.o:%.c |
| 32 | $(CC) $(CFLAGS) $(INC_DIR) $(DEFINE) -c $< -o $@ |
| 33 | |
| 34 | %.o:%.cpp |
| 35 | $(CC) $(CFLAGS) $(INC_DIR) $(DEFINE) -c $< -o $@ |
| 36 | |
| 37 | clean: |
| 38 | rm -f $(OBJS) $(dtarget) |
| 39 | |