2018-08-15 23:09:53 +03:00
|
|
|
GPU=0
|
|
|
|
CUDNN=0
|
|
|
|
OPENCV=0
|
|
|
|
OPENMP=0
|
2015-01-23 03:38:24 +03:00
|
|
|
DEBUG=0
|
2015-06-10 10:11:41 +03:00
|
|
|
|
2017-10-03 01:17:48 +03:00
|
|
|
ARCH= -gencode arch=compute_30,code=sm_30 \
|
2016-11-25 09:56:23 +03:00
|
|
|
-gencode arch=compute_35,code=sm_35 \
|
|
|
|
-gencode arch=compute_50,code=[sm_50,compute_50] \
|
|
|
|
-gencode arch=compute_52,code=[sm_52,compute_52]
|
2017-10-03 01:17:48 +03:00
|
|
|
# -gencode arch=compute_20,code=[sm_20,sm_21] \ This one is deprecated?
|
2016-11-25 09:56:23 +03:00
|
|
|
|
|
|
|
# This is what I use, uncomment if you know your arch and want to specify
|
2017-06-10 02:41:00 +03:00
|
|
|
# ARCH= -gencode arch=compute_52,code=compute_52
|
2015-01-23 03:38:24 +03:00
|
|
|
|
2017-06-01 07:06:35 +03:00
|
|
|
VPATH=./src/:./examples
|
2017-06-11 09:27:15 +03:00
|
|
|
SLIB=libdarknet.so
|
|
|
|
ALIB=libdarknet.a
|
2015-01-28 00:52:37 +03:00
|
|
|
EXEC=darknet
|
2015-01-23 03:38:24 +03:00
|
|
|
OBJDIR=./obj/
|
2014-11-06 01:49:58 +03:00
|
|
|
|
|
|
|
CC=gcc
|
2018-09-14 02:53:20 +03:00
|
|
|
CPP=g++
|
2017-07-12 02:44:09 +03:00
|
|
|
NVCC=nvcc
|
2017-06-01 07:06:35 +03:00
|
|
|
AR=ar
|
2017-06-11 09:27:15 +03:00
|
|
|
ARFLAGS=rcs
|
2020-04-21 18:49:32 +03:00
|
|
|
OPTS=-Ofast -fno-unsafe-math-optimizations
|
2016-05-07 02:25:16 +03:00
|
|
|
LDFLAGS= -lm -pthread
|
2017-06-02 06:31:13 +03:00
|
|
|
COMMON= -Iinclude/ -Isrc/
|
2018-03-25 04:23:04 +03:00
|
|
|
CFLAGS=-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC
|
2017-07-12 02:44:09 +03:00
|
|
|
|
|
|
|
ifeq ($(OPENMP), 1)
|
2017-07-27 11:28:57 +03:00
|
|
|
CFLAGS+= -fopenmp
|
2017-07-12 02:44:09 +03:00
|
|
|
endif
|
2015-01-23 03:38:24 +03:00
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
2015-02-07 05:53:53 +03:00
|
|
|
OPTS=-O0 -g
|
2014-05-03 02:20:34 +04:00
|
|
|
endif
|
2014-11-06 01:49:58 +03:00
|
|
|
|
2015-02-07 05:53:53 +03:00
|
|
|
CFLAGS+=$(OPTS)
|
|
|
|
|
2015-06-10 10:11:41 +03:00
|
|
|
ifeq ($(OPENCV), 1)
|
|
|
|
COMMON+= -DOPENCV
|
|
|
|
CFLAGS+= -DOPENCV
|
2018-09-14 02:53:20 +03:00
|
|
|
LDFLAGS+= `pkg-config --libs opencv` -lstdc++
|
2015-06-10 10:11:41 +03:00
|
|
|
COMMON+= `pkg-config --cflags opencv`
|
|
|
|
endif
|
|
|
|
|
2015-01-23 03:38:24 +03:00
|
|
|
ifeq ($(GPU), 1)
|
2015-09-22 03:30:32 +03:00
|
|
|
COMMON+= -DGPU -I/usr/local/cuda/include/
|
2015-06-10 10:11:41 +03:00
|
|
|
CFLAGS+= -DGPU
|
2015-03-21 22:25:14 +03:00
|
|
|
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
|
2014-11-06 01:49:58 +03:00
|
|
|
endif
|
|
|
|
|
2016-05-13 21:59:43 +03:00
|
|
|
ifeq ($(CUDNN), 1)
|
|
|
|
COMMON+= -DCUDNN
|
|
|
|
CFLAGS+= -DCUDNN
|
|
|
|
LDFLAGS+= -lcudnn
|
|
|
|
endif
|
|
|
|
|
2018-09-14 02:53:20 +03:00
|
|
|
OBJ=gemm.o utils.o cuda.o deconvolutional_layer.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o detection_layer.o route_layer.o upsample_layer.o box.o normalization_layer.o avgpool_layer.o layer.o local_layer.o shortcut_layer.o logistic_layer.o activation_layer.o rnn_layer.o gru_layer.o crnn_layer.o demo.o batchnorm_layer.o region_layer.o reorg_layer.o tree.o lstm_layer.o l2norm_layer.o yolo_layer.o iseg_layer.o image_opencv.o
|
2018-08-04 01:57:48 +03:00
|
|
|
EXECOBJA=captcha.o lsd.o super.o art.o tag.o cifar.o go.o rnn.o segmenter.o regressor.o classifier.o coco.o yolo.o detector.o nightmare.o instance-segmenter.o darknet.o
|
2015-01-23 03:38:24 +03:00
|
|
|
ifeq ($(GPU), 1)
|
2016-05-07 02:25:16 +03:00
|
|
|
LDFLAGS+= -lstdc++
|
2017-10-17 21:41:34 +03:00
|
|
|
OBJ+=convolutional_kernels.o deconvolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o avgpool_layer_kernels.o
|
2014-04-20 00:10:59 +04:00
|
|
|
endif
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2017-06-01 07:06:35 +03:00
|
|
|
EXECOBJ = $(addprefix $(OBJDIR), $(EXECOBJA))
|
2014-07-14 09:07:51 +04:00
|
|
|
OBJS = $(addprefix $(OBJDIR), $(OBJ))
|
2017-06-02 06:31:13 +03:00
|
|
|
DEPS = $(wildcard src/*.h) Makefile include/darknet.h
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2018-05-04 11:28:59 +03:00
|
|
|
all: obj backup results $(SLIB) $(ALIB) $(EXEC)
|
|
|
|
#all: obj results $(SLIB) $(ALIB) $(EXEC)
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2017-06-01 07:06:35 +03:00
|
|
|
|
2017-06-11 09:27:15 +03:00
|
|
|
$(EXEC): $(EXECOBJ) $(ALIB)
|
|
|
|
$(CC) $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(ALIB)
|
2017-06-01 07:06:35 +03:00
|
|
|
|
2017-06-11 09:27:15 +03:00
|
|
|
$(ALIB): $(OBJS)
|
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
|
|
|
|
$(SLIB): $(OBJS)
|
2017-06-08 23:47:31 +03:00
|
|
|
$(CC) $(CFLAGS) -shared $^ -o $@ $(LDFLAGS)
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2018-09-14 02:53:20 +03:00
|
|
|
$(OBJDIR)%.o: %.cpp $(DEPS)
|
|
|
|
$(CPP) $(COMMON) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2015-04-14 00:09:55 +03:00
|
|
|
$(OBJDIR)%.o: %.c $(DEPS)
|
2015-01-23 03:38:24 +03:00
|
|
|
$(CC) $(COMMON) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2015-04-14 00:09:55 +03:00
|
|
|
$(OBJDIR)%.o: %.cu $(DEPS)
|
2015-01-28 00:31:06 +03:00
|
|
|
$(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@
|
2013-11-04 23:11:01 +04:00
|
|
|
|
2015-06-10 10:22:48 +03:00
|
|
|
obj:
|
|
|
|
mkdir -p obj
|
2016-11-19 08:51:36 +03:00
|
|
|
backup:
|
|
|
|
mkdir -p backup
|
2015-06-17 00:54:26 +03:00
|
|
|
results:
|
|
|
|
mkdir -p results
|
2015-06-10 10:22:48 +03:00
|
|
|
|
2013-11-04 23:11:01 +04:00
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2018-03-15 01:42:17 +03:00
|
|
|
rm -rf $(OBJS) $(SLIB) $(ALIB) $(EXEC) $(EXECOBJ) $(OBJDIR)/*
|
2013-11-04 23:11:01 +04:00
|
|
|
|