summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-03-15 09:21:47 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-03-20 23:45:00 +0800
commita6fff3ae360da26cbadab0dbbfded01e2b70a396 (patch)
treef3aeb3f2e839565960da54a371898f09e9e2b3d3 /Makefile
parent60e0c64717e1620d471640c066b328b7199d51e4 (diff)
build: auto parallel with nproc
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 2581730..25d9972 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,9 @@ DEBUG_LDFLAGS = -Wl,--as-needed,-z,now,-z,pack-relative-relocs
JOB_COUNT := $(BIN) $(OBJS)
JOBS_DONE := $(shell ls -l $(JOB_COUNT) 2> /dev/null | wc -l)
+NPROC := $(shell nproc 2>/dev/null || getconf NPROCESSORS_CONF || echo 2)
+MAKEFLAGS += -j$(NPROC)
+
define progress
$(eval JOBS_DONE := $(shell echo $$(($(JOBS_DONE) + 1))))
@printf "[$(JOBS_DONE)/$(shell echo $(JOB_COUNT) | wc -w)] %s %s\n" $(1) $(2)