2014-10-22 05:49:18 +08:00
|
|
|
GPU=1
|
2015-01-23 08:38:24 +08:00
|
|
|
DEBUG=0
|
2015-03-27 10:13:59 +08:00
|
|
|
ARCH= -arch=sm_50
|
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
|
2015-01-23 08:38:24 +08:00
|
|
|
NVCC=nvcc
|
2015-03-22 05:17:39 +08:00
|
|
|
OPTS=-O3
|
2015-03-05 06:56:38 +08:00
|
|
|
LDFLAGS=`pkg-config --libs opencv` -lm -pthread -lstdc++
|
2015-01-23 08:38:24 +08:00
|
|
|
COMMON=`pkg-config --cflags opencv` -I/usr/local/cuda/include/
|
|
|
|
CFLAGS=-Wall -Wfatal-errors
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
2015-02-07 10:53:53 +08:00
|
|
|
OPTS=-O0 -g
|
2014-05-03 06:20:34 +08:00
|
|
|
endif
|
2014-11-06 06:49:58 +08:00
|
|
|
|
2015-02-07 10:53:53 +08:00
|
|
|
CFLAGS+=$(OPTS)
|
|
|
|
|
2015-01-23 08:38:24 +08:00
|
|
|
ifeq ($(GPU), 1)
|
|
|
|
COMMON+=-DGPU
|
|
|
|
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
|
|
|
|
|
2015-03-07 02:49:03 +08: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 normalization_layer.o parser.o option_list.o darknet.o detection_layer.o imagenet.o captcha.o detection.o
|
2015-01-23 08:38:24 +08:00
|
|
|
ifeq ($(GPU), 1)
|
2015-02-11 11:41:03 +08: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 softmax_layer_kernels.o network_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))
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-01-28 15:16:56 +08:00
|
|
|
all: $(EXEC)
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-07-14 13:07:51 +08:00
|
|
|
$(EXEC): $(OBJS)
|
2015-01-23 08:38:24 +08:00
|
|
|
$(CC) $(COMMON) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
2013-11-05 03:11:01 +08:00
|
|
|
|
2014-07-14 13:07:51 +08:00
|
|
|
$(OBJDIR)%.o: %.c
|
2015-01-23 08:38:24 +08:00
|
|
|
$(CC) $(COMMON) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJDIR)%.o: %.cu
|
2015-01-28 05:31:06 +08:00
|
|
|
$(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@
|
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
|
|
|
|