# SOURCES = $(wildcard ./src/*.cpp) #指定源文件列表, HEADERS = $(wildcard ./inc/*.h) OBJS = $(patsubst %.cpp,%.o,$(SOURCES)) #patsubst是把后面文件列表中所有.c结尾的文件替换成.o结尾的文件。 SOURCES_C = $(wildcard ./src/*.c) OBJS_C = $(patsubst %.c,%.o,$(SOURCES_C)) OBJS += $(OBJS_C) TOOL_PREFIX = COMPILE_TOOLS = $(TOOL_PREFIX)gcc COMPILE_TOOLS_G++ = $(TOOL_PREFIX)g++ AR = $(TOOL_PREFIX)ar RANLIB = $(TOOL_PREFIX)ranlib #TARGET_MAP = libhisdk_hi3536_single_dbg.map IFLAG = -I./inc -I./inc/opencv2/core -I./inc/opencv2 -I./ CFLAGS = $(IFLAG) -O0 -Wall -D __linux -fPIC #CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 LDFLAGS = -L./lib -L/opt/chengjiao/fc/ffmpeg-4.2/lib -L/usr/local/lib TARGET = signal TARGET_EXT := .so DEMO_TARGET := run DEMO :=./demo/main.cpp #LIBS += -lopencv_video -lopencv_imgproc -lopencv_highgui -lopencv_core LIBS += -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_imgproc LIBS += -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_legacy -lopencv_gpu LIBS += -lopencv_photo -lopencv_superres -lopencv_contrib -lopencv_nonfree LIBS += -lopencv_video -lopencv_videostab -lopencv_ts -lopencv_stitching -lopencv_core #.PHONY: all #all : sfd default: all ./src/%.o:./src/%.c $(COMPILE_TOOLS_G++) $(CFLAGS) -std=c++11 -c -g $^ -o $@ -lstdc++ ./src/%.o:./src/%.cpp $(COMPILE_TOOLS_G++) $(CFLAGS) -std=c++11 -c -g $^ -o $@ -lstdc++ all : $(OBJS) $(COMPILE_TOOLS_G++) $(CFLAGS) -shared -o lib$(TARGET)$(TARGET_EXT) $(OBJS) $(LDFLAGS) $(LIBS) mv libsignal.so ./lib $(COMPILE_TOOLS_G++) $(CFLAGS) -o $(DEMO_TARGET) $(DEMO) $(LDFLAGS) $(LIBS) -lsignal #$@ $(OBJS) $(LDFLAGS) $(LIBS) -g -std=c++11 -fopenmp -pthread -lm -lstdc++ clean: rm -f $(OBJS) $(TARGET).* $(RESOURCE) @echo $(SOURCES) @echo $(SOURCES_C) @echo $(OBJS)