diff options
author | egon_ffj <egon@freifunk-jena.de> | 2011-11-23 23:07:55 (GMT) |
---|---|---|
committer | egon_ffj <egon@freifunk-jena.de> | 2011-11-23 23:07:55 (GMT) |
commit | 68ed1c8254613b8a4958cc9e8b80cae500f60179 (patch) | |
tree | f8c41cc47b993213666a221f82345dc299c50711 | |
parent | ec5ade1f68571c10cbb1e3df69f917feac81d678 (diff) |
added automatic parallel job-number for make depending on processor-count
-rw-r--r-- | Makefile | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -1,3 +1,22 @@ +NUMPROC := 1 +OS := $(shell uname) +export NUMPROC + +ifeq ($(OS),Linux) + NUMPROC := $(shell grep -c ^processor /proc/cpuinfo) + +else ifeq ($(OS),Darwin) + NUMPROC := $(shell sysctl hw.ncpu | awk '{print $$2}') +endif + +# Always use # of processory plus 1 +NUMPROC:=$$((${NUMPROC}+1)) +NUMPROC:=$(shell echo ${NUMPROC}) + +ifeq ($(NUMPROC),0) + NUMPROC = 1 +endif + .NOTPARALLEL: openwrt/backfire/.repo_access: @@ -44,6 +63,6 @@ image/%: config/$$(REPO)-$$(PLATFORM)-$$(MODEL).config \ cp -a files/common openwrt/$(REPO)/files [ -d files/$(PLATFORM) ] && rsync -a files/$(PLATFORM)/ openwrt/$(REPO)/files/ [ -d files/$(PLATFORM)-$(MODEL) ] && rsync -a files/$(PLATFORM)-$(MODEL)/ openwrt/$(REPO)/files/ - cd openwrt/$(REPO) && $(MAKE) + cd openwrt/$(REPO) && $(MAKE) -j$(NUMPROC) mkdir -p $@ rsync -a openwrt/$(REPO)/bin/$(PLATFORM)/ $@/ |