Skip to content

Commit 5001a3c

Browse files
authored
Merge pull request #350 from hlein/respect-makej
Respect make -j if set, #349
2 parents c56018e + e0c1b2c commit 5001a3c

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

Makefile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,16 @@ LDFLAGS += -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/opt/openssl/lib
9292
CFLAGS += -I/usr/local/include -I/usr/local/ssl/include -I/usr/local/ssl/include/openssl -I/usr/local/opt/openssl/include -I/opt/local/include -I/opt/local/include/openssl
9393
endif
9494

95-
# Find the number of processors on the system (used in -j option in building OpenSSL).
95+
# If -j wasn't passed to make, find the number of processors on the system.
9696
# Uses /usr/bin/nproc if available, otherwise defaults to 1.
97-
NUM_PROCS = 1
98-
ifneq (,$(wildcard /usr/bin/nproc))
99-
NUM_PROCS = `/usr/bin/nproc --all`
100-
endif
101-
ifeq ($(OS), Darwin)
102-
NUM_PROCS = `sysctl -n hw.ncpu`
97+
ifeq (,$(findstring -j,$(MAKEFLAGS)))
98+
JOBS_ARG = -j1
99+
ifneq (,$(wildcard /usr/bin/nproc))
100+
JOBS_ARG = -j`/usr/bin/nproc --all`
101+
endif
102+
ifeq ($(OS), Darwin)
103+
JOBS_ARG = -j`sysctl -n hw.ncpu`
104+
endif
103105
endif
104106

105107
.PHONY: all sslscan clean realclean install uninstall static opensslpull
@@ -154,12 +156,12 @@ openssl/Makefile: .openssl.is.fresh
154156
cd ./openssl; ./Configure -v -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC no-shared enable-weak-ssl-ciphers zlib
155157

156158
openssl/libcrypto.a: openssl/Makefile
157-
$(MAKE) -j $(NUM_PROCS) -C openssl depend
158-
$(MAKE) -j $(NUM_PROCS) -C openssl build_libs
159-
# $(MAKE) -j $(NUM_PROCS) -C openssl test # Disabled because this takes 45+ minutes for OpenSSL v1.1.1.
159+
$(MAKE) $(JOBS_ARG) -C openssl depend
160+
$(MAKE) $(JOBS_ARG) -C openssl build_libs
161+
# $(MAKE) $(JOBS_ARG) -C openssl test # Disabled because this takes 45+ minutes for OpenSSL v1.1.1.
160162

161163
static: openssl/libcrypto.a
162-
$(MAKE) -j $(NUM_PROCS) sslscan STATIC_BUILD=TRUE
164+
$(MAKE) $(JOBS_ARG) sslscan STATIC_BUILD=TRUE
163165

164166
docker:
165167
docker build -t sslscan:sslscan .

0 commit comments

Comments
 (0)