加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gnu_makefile 1.96 KB
一键复制 编辑 原始数据 按行查看 历史
泾渭漳淮 提交于 2022-12-14 10:26 . update
OPENMP=1
USE_SOCKET=1
USE_USBCAMERA=1
DEBUG=0
CC = gcc
CPPC = g++
LIB = ar
LIBDIR = ./lib/x64_gnu
REMOVE = rm -rf
CCFLAGS = -O2 -fPIC -Wall -Wno-format
ifeq ($(OPENMP), 1)
CCFLAGS += -fopenmp
endif
ifeq ($(DEBUG), 1)
CCFLAGS += -DDEBUG
endif
WRAPDEF =
DEPENDLIB = -lopenblas -lm
ifeq ($(USE_SOCKET),1)
WRAPDEF += -DMORN_USE_SOCKET
endif
ifeq ($(USE_USBCAMERA),1)
WRAPDEF += -DMORN_USE_USBCAMERA
endif
STATICLIB = $(LIBDIR)/libmorn.a
SHAREDLIB = ./tool/libmorn.so
TOOLSOURCES = $(wildcard ./tool/*.c)
TOOLEXE = $(patsubst %.c,%.exe,$(TOOLSOURCES))
CSOURCES = $(wildcard ./src/util/*.c)
CSOURCES += $(wildcard ./src/ptc/*.c)
CSOURCES += $(wildcard ./src/math/*.c)
CSOURCES += $(wildcard ./src/wave/*.c)
CSOURCES += $(wildcard ./src/image/*.c)
# CSOURCES += $(wildcard ./src/machine_learning/*.c)
CSOURCES += $(wildcard ./src/deep_learning/*.c)
WRAPSOURCES = $(wildcard ./src/wrap/*.c)
WRAPOBJS = $(patsubst %.c,%.o,$(WRAPSOURCES))
WRAPSOURCES2 = $(wildcard ./src/wrap/*.cpp)
WRAPOBJS2 = $(patsubst %.cpp,%.o,$(WRAPSOURCES2))
ifeq ($(JPG_PNG), 1)
CSOURCES += $(wildcard ./src/wrap/*.c)
endif
OBJS = $(patsubst %.c,%.o,$(CSOURCES))
INCLUDEDIR = -I ./include
#-I ./lib/include/
all:$(STATICLIB) $(TOOLEXE)
tool:$(TOOLEXE)
%.exe:%.c $(STATICLIB)
$(CC) $(CCFLAGS) $(INCLUDEDIR) $< $(STATICLIB) -L $(LIBDIR) $(DEPENDLIB) -o $@
static:$(STATICLIB)
$(STATICLIB):$(OBJS) $(WRAPOBJS) $(WRAPOBJS2)
$(LIB) -rc $(STATICLIB) $(OBJS) $(WRAPOBJS) $(WRAPOBJS2)
shared:$(SHAREDLIB)
$(SHAREDLIB):$(OBJS) $(WRAPOBJS) $(WRAPOBJS2)
$(CC) $(CCFLAGS) -shared $(OBJS) $(WRAPOBJS) $(WRAPOBJS2) -L $(LIBDIR) $(DEPENDLIB) -o $(SHAREDLIB)
$(WRAPOBJS):%.o:%.c
$(CC) $(CCFLAGS) $(WRAPDEF) $(INCLUDEDIR) -c $< -o $@
$(WRAPOBJS2):%.o:%.cpp
$(CPPC) $(CCFLAGS) $(WRAPDEF) $(INCLUDEDIR) -c $< -o $@
$(OBJS):%.o:%.c
$(CC) $(CCFLAGS) $(INCLUDEDIR) -c $< -o $@
clean:
$(REMOVE) $(OBJS)
$(REMOVE) $(WRAPOBJS)
$(REMOVE) $(WRAPOBJS2)
$(REMOVE) $(STATICLIB)
$(REMOVE) $(SHAREDLIB)
$(REMOVE) $(TOOLEXE)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化