Last active
November 19, 2019 22:38
-
-
Save jgrahamc/2cc6df7fd5cd61c4d93f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | parallel ; @echo $(JOB_COUNT) | |
parallel: .parallel ; @$(eval JOB_COUNT := $(shell sort -n $< | tail -n 1)) | |
.parallel: FORCE ; @$(MAKE) --no-print-directory par 2>/dev/null >$@ || true | |
FORCE: | |
to_n = $(words $2) $(if $(filter-out $1,$(words x $2)),$(call to_n,$1,x $2)) | |
PAR_COUNT := | |
par: $(addprefix par-,$(call to_n,32)) | |
par-%: ; @$(eval PAR_COUNT += x)@echo $(words $(PAR_COUNT)) && sleep 1 && false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment