darknet/Makefile

83 lines
2.3 KiB
Makefile
Raw Normal View History

2016-09-02 07:48:41 +08:00
GPU=0
CUDNN=0
OPENCV=0
2015-01-23 08:38:24 +08:00
DEBUG=0
2015-06-10 15:11:41 +08:00
2016-11-25 14:56:23 +08:00
ARCH= -gencode arch=compute_20,code=[sm_20,sm_21] \
-gencode arch=compute_30,code=sm_30 \
-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]
# This is what I use, uncomment if you know your arch and want to specify
# ARCH= -gencode arch=compute_52,code=compute_52
2015-01-23 08:38:24 +08:00
VPATH=./src/
2015-01-28 05:52:37 +08:00
EXEC=darknet
2015-01-23 08:38:24 +08:00
OBJDIR=./obj/
2014-11-06 06:49:58 +08:00
CC=gcc
2016-10-25 04:32:49 +08:00
NVCC=nvcc
2015-09-02 02:21:01 +08:00
OPTS=-Ofast
2016-05-07 07:25:16 +08:00
LDFLAGS= -lm -pthread
2015-09-22 08:30:32 +08:00
COMMON=
2015-06-10 15:11:41 +08:00
CFLAGS=-Wall -Wfatal-errors
2015-01-23 08:38:24 +08:00
ifeq ($(DEBUG), 1)
OPTS=-O0 -g
2014-05-03 06:20:34 +08:00
endif
2014-11-06 06:49:58 +08:00
CFLAGS+=$(OPTS)
2015-06-10 15:11:41 +08:00
ifeq ($(OPENCV), 1)
COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
LDFLAGS+= `pkg-config --libs opencv`
COMMON+= `pkg-config --cflags opencv`
endif
2015-01-23 08:38:24 +08:00
ifeq ($(GPU), 1)
2015-09-22 08:30:32 +08:00
COMMON+= -DGPU -I/usr/local/cuda/include/
2015-06-10 15:11:41 +08:00
CFLAGS+= -DGPU
2015-03-22 03:25:14 +08:00
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
2014-11-06 06:49:58 +08:00
endif
2016-05-14 02:59:43 +08:00
ifeq ($(CUDNN), 1)
COMMON+= -DCUDNN
CFLAGS+= -DCUDNN
LDFLAGS+= -lcudnn
endif
2016-10-22 04:16:43 +08:00
OBJ=gemm.o utils.o cuda.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 darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o classifier.o local_layer.o swag.o shortcut_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o super.o voxel.o tree.o
2015-01-23 08:38:24 +08:00
ifeq ($(GPU), 1)
2016-05-07 07:25:16 +08:00
LDFLAGS+= -lstdc++
2016-10-22 04:16:43 +08:00
OBJ+=convolutional_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 network_kernels.o avgpool_layer_kernels.o
2014-04-20 04:10:59 +08:00
endif
2013-11-05 03:11:01 +08:00
2014-07-14 13:07:51 +08:00
OBJS = $(addprefix $(OBJDIR), $(OBJ))
2015-04-14 05:09:55 +08:00
DEPS = $(wildcard src/*.h) Makefile
2013-11-05 03:11:01 +08:00
2016-11-19 13:51:36 +08:00
all: obj backup results $(EXEC)
2013-11-05 03:11:01 +08:00
2014-07-14 13:07:51 +08:00
$(EXEC): $(OBJS)
2015-07-11 07:46:48 +08:00
$(CC) $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS)
2013-11-05 03:11:01 +08:00
2015-04-14 05:09:55 +08:00
$(OBJDIR)%.o: %.c $(DEPS)
2015-01-23 08:38:24 +08:00
$(CC) $(COMMON) $(CFLAGS) -c $< -o $@
2015-04-14 05:09:55 +08:00
$(OBJDIR)%.o: %.cu $(DEPS)
2015-01-28 05:31:06 +08:00
$(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@
2013-11-05 03:11:01 +08:00
2015-06-10 15:22:48 +08:00
obj:
mkdir -p obj
2016-11-19 13:51:36 +08:00
backup:
mkdir -p backup
2015-06-17 05:54:26 +08:00
results:
mkdir -p results
2015-06-10 15:22:48 +08:00
2013-11-05 03:11:01 +08:00
.PHONY: clean
clean:
2014-07-14 13:07:51 +08:00
rm -rf $(OBJS) $(EXEC)
2013-11-05 03:11:01 +08:00