From c85978e77725ef233543370d24e23f853f449170 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 21 Sep 2017 17:47:02 -0700
Subject: [PATCH] Makefile: Fix parallel build

Sometimes mkdir $(SHARED_OUTDIR)/db races with compiler which is
creating .o file in the same directory $(SHARED_OUTDIR)/db/db_bench.o

Fixes error like

| mkdir out-static
| mkdir out-shared/db
| Assembler messages:
| Fatal error: can't create out-shared/db/db_bench.o: No such file or directory

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index f7cc7d7..51a0bcd 100644
--- a/Makefile
+++ b/Makefile
@@ -386,6 +386,7 @@ $(STATIC_OUTDIR)/write_batch_test:db/write_batch_test.cc $(STATIC_LIBOBJECTS) $(
 $(STATIC_OUTDIR)/memenv_test:$(STATIC_OUTDIR)/helpers/memenv/memenv_test.o $(STATIC_OUTDIR)/libmemenv.a $(STATIC_OUTDIR)/libleveldb.a $(TESTHARNESS)
 	$(XCRUN) $(CXX) $(LDFLAGS) $(STATIC_OUTDIR)/helpers/memenv/memenv_test.o $(STATIC_OUTDIR)/libmemenv.a $(STATIC_OUTDIR)/libleveldb.a $(TESTHARNESS) -o $@ $(LIBS)
 
+$(SHARED_OUTDIR)/db/db_bench.o: | $(SHARED_OUTDIR)/db
 $(SHARED_OUTDIR)/db_bench:$(SHARED_OUTDIR)/db/db_bench.o $(SHARED_LIBS) $(TESTUTIL)
 	$(XCRUN) $(CXX) $(LDFLAGS) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SHARED_OUTDIR)/db/db_bench.o $(TESTUTIL) $(SHARED_OUTDIR)/$(SHARED_LIB3) -o $@ $(LIBS)
 
