# Directory structure CUR_PATH := $(shell pwd) LIB_PATH := $(CUR_PATH)/lib LIB_PATH_OUT := $(CUR_PATH)/out/lib OPENCV_PATH := $(CUR_PATH)/3rdparty/opencv-arm-linux OPENCV_LIB_PATH := $(OPENCV_PATH)/lib OPENCV_LIB2_PATH := $(OPENCV_PATH)/lib/opencv4/3rdparty OPENCV_INCLUDE := $(OPENCV_PATH)/include/opencv4 # Compiler flags CROSS_COMPILE := /root/axera/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- CPP := $(CROSS_COMPILE)g++ CC := $(CROSS_COMPILE)gcc CFLAGS := -Wall -DAX620A CFLAGS += -O2 CFLAGS += -fPIC # Dependency libraries CLIB += -lm -lpthread -L$(LIB_PATH) -lax_run_joint -lax_interpreter_external -lax_interpreter -lax_sys -laxsyslog -lstdc++fs -ldl CLIB += -L$(OPENCV_LIB_PATH) -L$(OPENCV_LIB2_PATH) -lopencv_imgproc -lopencv_core # Source and header files directories INC_DIR := -I$(CUR_PATH)/include INC_DIR += -I$(CUR_PATH)/include/npu_cv_kit INC_DIR += -I$(OPENCV_INCLUDE) INC_DIR += -I$(CUR_PATH)/out/include INC_DIR_OUT := $(CUR_PATH)/out/include SRC_DIR := $(CUR_PATH)/src # Source files SRCS := $(wildcard $(SRC_DIR)/*.cpp) # Object files OBJS := $(patsubst $(SRC_DIR)/%.cpp, $(LIB_PATH_OUT)/%.o, $(SRCS)) # Target static library TARGET := $(LIB_PATH_OUT)/libxw_m1.a # Compilation rule $(TARGET): $(OBJS) @echo "Building $@..." ar rcs $@ $(OBJS) # Rule to compile source files to object files $(LIB_PATH_OUT)/%.o: $(SRC_DIR)/%.cpp $(CPP) $(CFLAGS) $(INC_DIR) -c $< -o $@ # Clean rule clean: rm -f $(OBJS) $(TARGET)