summaryrefslogtreecommitdiff
blob: 4550f3f2cdd11790a5299c1765e82d4a56c8bcc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 0d17fb66c45aa532a26e0e9a3b179d1f57bf037f Mon Sep 17 00:00:00 2001
From: NexAdn <nex@nexadn.de>
Date: Thu, 15 Dec 2022 10:04:33 +0100
Subject: [PATCH] Makefile: make build targets depend on directories

Since directory creation is a requirement for writing the built
artifacts, this commit introduces a dependency on the directories for
all build targets (compile and link), so parallel builds can't fail
because a build target is executed before the directories target.

Closes: https://github.com/aristocratos/btop/issues/479
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index ec9f90a..a52929c 100644
--- a/Makefile
+++ b/Makefile
@@ -259,7 +259,7 @@ uninstall:
 
 #? Link
 .ONESHELL:
-btop: $(OBJECTS)
+btop: $(OBJECTS) | directories
 	@sleep 0.2 2>/dev/null || true
 	@TSTAMP=$$(date +%s 2>/dev/null || echo "0")
 	@$(QUIET) || printf "\n\033[1;92mLinking and optimizing binary\033[37m...\033[0m\n"
@@ -270,7 +270,7 @@ btop: $(OBJECTS)
 
 #? Compile
 .ONESHELL:
-$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
+$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT) | directories
 	@sleep 0.3 2>/dev/null || true
 	@TSTAMP=$$(date +%s 2>/dev/null || echo "0")
 	@$(QUIET) || printf "\033[1;97mCompiling $<\033[0m\n"
-- 
2.37.4