From a6fff3ae360da26cbadab0dbbfded01e2b70a396 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 15 Mar 2025 09:21:47 +0800 Subject: build: auto parallel with nproc --- Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Makefile') 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) -- cgit v1.2.3