From 5a77940bd58ac29841a7ba36e18f73d32272c48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Thu, 21 Nov 2019 01:53:31 +0000 Subject: [PATCH] Add $(OBJDIR) as prerequisite to $(LIBNAMESO) The directory must exist before running this rule. When running `make` with several parallel jobs it can happen that $(LIBNAMESO) rule is run before creating the directory. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 41e5fc8d..c5999128 100644 --- a/Makefile +++ b/Makefile @@ -127,12 +127,12 @@ endif OBJS = $(addprefix $(OBJDIR), $(OBJ)) DEPS = $(wildcard src/*.h) Makefile include/darknet.h -all: obj backup results setchmod $(EXEC) $(LIBNAMESO) $(APPNAMESO) +all: $(OBJDIR) backup results setchmod $(EXEC) $(LIBNAMESO) $(APPNAMESO) ifeq ($(LIBSO), 1) CFLAGS+= -fPIC -$(LIBNAMESO): $(OBJS) include/yolo_v2_class.hpp src/yolo_v2_class.cpp +$(LIBNAMESO): $(OBJDIR) $(OBJS) include/yolo_v2_class.hpp src/yolo_v2_class.cpp $(CPP) -shared -std=c++11 -fvisibility=hidden -DLIB_EXPORTS $(COMMON) $(CFLAGS) $(OBJS) src/yolo_v2_class.cpp -o $@ $(LDFLAGS) $(APPNAMESO): $(LIBNAMESO) include/yolo_v2_class.hpp src/yolo_console_dll.cpp @@ -151,8 +151,8 @@ $(OBJDIR)%.o: %.cpp $(DEPS) $(OBJDIR)%.o: %.cu $(DEPS) $(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@ -obj: - mkdir -p obj +$(OBJDIR): + mkdir -p $(OBJDIR) backup: mkdir -p backup results: