darknet/Makefile

66 lines
1.6 KiB
Makefile
Raw Normal View History

2015-06-16 21:45:40 +03:00
GPU=0
OPENCV=0
2015-01-23 03:38:24 +03:00
DEBUG=0
2015-06-10 10:11:41 +03:00
2015-03-28 03:32:01 +03:00
ARCH= -arch=sm_52
2015-01-23 03:38:24 +03:00
VPATH=./src/
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
2015-01-23 03:38:24 +03:00
NVCC=nvcc
2015-04-21 22:58:03 +03:00
OPTS=-Ofast
2015-06-10 10:11:41 +03:00
LDFLAGS= -lm -pthread -lstdc++
COMMON= -I/usr/local/cuda/include/
CFLAGS=-Wall -Wfatal-errors
2015-01-23 03:38:24 +03:00
ifeq ($(DEBUG), 1)
OPTS=-O0 -g
2014-05-03 02:20:34 +04:00
endif
2014-11-06 01:49:58 +03:00
CFLAGS+=$(OPTS)
2015-06-10 10:11:41 +03:00
ifeq ($(OPENCV), 1)
COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
LDFLAGS+= `pkg-config --libs opencv`
COMMON+= `pkg-config --cflags opencv`
endif
2015-01-23 03:38:24 +03:00
ifeq ($(GPU), 1)
2015-06-10 10:11:41 +03:00
COMMON+= -DGPU
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
2015-07-10 01:22:14 +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 darknet.o detection_layer.o imagenet.o captcha.o detection.o route_layer.o writing.o box.o nightmare.o normalization_layer.o
2015-01-23 03:38:24 +03:00
ifeq ($(GPU), 1)
2015-02-11 06:41:03 +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 softmax_layer_kernels.o network_kernels.o
2014-04-20 00:10:59 +04:00
endif
2013-11-04 23:11:01 +04:00
2014-07-14 09:07:51 +04:00
OBJS = $(addprefix $(OBJDIR), $(OBJ))
2015-04-14 00:09:55 +03:00
DEPS = $(wildcard src/*.h) Makefile
2013-11-04 23:11:01 +04:00
2015-06-17 00:54:26 +03:00
all: obj results $(EXEC)
2013-11-04 23:11:01 +04:00
2014-07-14 09:07:51 +04:00
$(EXEC): $(OBJS)
2015-07-11 02:46:48 +03:00
$(CC) $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS)
2013-11-04 23:11:01 +04:00
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
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:
2014-07-14 09:07:51 +04:00
rm -rf $(OBJS) $(EXEC)
2013-11-04 23:11:01 +04:00