From fc72622ba820ba8d81145af63290dff394890d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?= =?UTF-8?q?=E3=82=B4=E3=83=B3=E3=83=91=29?= Date: Fri, 24 Feb 2017 08:49:29 -0500 Subject: [PATCH] Makefile: Allow for overriding job threads for making 'qemu' dir (#762) Providing a default level of parallelism is perfectly fine, but it should also be possible to set higher or lower levels of parallelism easily. This is particularly beneficial for people packaging the software for Linux distributions. --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bc79b8b3..fa458470 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,13 @@ include pkgconfig.mk # package version LIBNAME = unicorn UNAME_S := $(shell uname -s) +# SMP_MFLAGS is used for controlling the amount of parallelism used +# in external 'make' invocations. If the user doesn't override it, it +# does "-j4". That is, it uses 4 job threads. If you want to use more or less, +# pass in a different -jX, with X being the number of threads. +# For example, to completely disable parallel building, pass "-j1". +# If you want to use 16 job threads, use "-j16". +SMP_MFLAGS := -j4 GENOBJ = $(shell find qemu/$(1) -name "*.o" 2>/dev/null) @@ -204,7 +211,7 @@ qemu/config-host.h-timestamp: cd qemu && \ ./configure --cc="${CC}" --extra-cflags="$(UNICORN_CFLAGS)" --target-list="$(UNICORN_TARGETS)" ${UNICORN_QEMU_FLAGS} printf "$(UNICORN_ARCHS)" > config.log - $(MAKE) -C qemu -j 4 + $(MAKE) -C qemu $(SMP_MFLAGS) $(eval UC_TARGET_OBJ += $$(wildcard qemu/util/*.o) $$(wildcard qemu/*.o) $$(wildcard qemu/qom/*.o) $$(wildcard qemu/hw/core/*.o) $$(wildcard qemu/qapi/*.o) $$(wildcard qemu/qobject/*.o)) unicorn: $(LIBRARY) $(ARCHIVE)