@@ -28,7 +28,7 @@ BINDIR = $(PREFIX)/bin
2828MANDIR = $(PREFIX ) /share/man
2929MAN1DIR = $(MANDIR ) /man1
3030
31- WARNINGS = -Wall -Wformat=2 -Wformat-security
31+ WARNINGS = -Wall -Wformat=2 -Wformat-security -Wno-deprecated-declarations
3232DEFINES = -DVERSION=\"$(GIT_VERSION ) \"
3333
3434# for dynamic linking
@@ -49,10 +49,7 @@ CFLAGS += -D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIE
4949# Don't enable some hardening flags on OS X because it uses an old version of Clang
5050ifneq ($(OS ) , Darwin)
5151ifneq ($(OS ) , SunOS)
52- # Cygwin's linker does not support -z option.
53- ifneq ($(findstring CYGWIN,$(OS ) ) ,CYGWIN)
54- LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now
55- endif
52+ LDFLAGS += -pie -z relro -z now
5653endif
5754endif
5855
@@ -61,7 +58,7 @@ ifeq ($(STATIC_BUILD), TRUE)
6158PWD = $(shell pwd) /openssl
6259LDFLAGS += -L${PWD}/
6360CFLAGS += -I${PWD}/include/ -I${PWD}/
64- LIBS = -lssl -lcrypto -lz
61+ LIBS = -lssl -lcrypto -lz -lpthread
6562ifneq ($(OS ) , FreeBSD)
6663 LIBS += -ldl
6764endif
@@ -75,6 +72,14 @@ LDFLAGS += -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/opt/openssl/lib
7572CFLAGS += -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
7673endif
7774
75+ # Find the number of processors on the system (used in -j option in building OpenSSL).
76+ # Uses /usr/bin/nproc if available, otherwise defaults to 1.
77+ NUM_PROCS = 1
78+ ifneq (,$(wildcard /usr/bin/nproc) )
79+ NUM_PROCS = `/usr/bin/nproc --all`
80+ endif
81+
82+
7883.PHONY : all sslscan clean install uninstall static opensslpull
7984
8085all : sslscan
@@ -114,28 +119,31 @@ uninstall:
114119 true
115120opensslpull :
116121 if [ -d openssl -a -d openssl/.git ]; then \
117- cd ./openssl && git checkout OpenSSL_1_0_2 -stable && git pull | grep -q " Already up-to-date." && [ -e ../.openssl.is.fresh ] || touch ../.openssl.is.fresh ; \
122+ cd ./openssl && git checkout OpenSSL_1_1_1 -stable && git pull | grep -q " Already up-to-date." && [ -e ../.openssl.is.fresh ] || touch ../.openssl.is.fresh ; \
118123 else \
119- git clone --depth 1 -b OpenSSL_1_0_2 -stable https://github.com/PeterMosmans /openssl ./openssl && cd ./openssl && touch ../.openssl.is.fresh ; \
124+ git clone --depth 1 -b OpenSSL_1_1_1 -stable https://github.com/openssl /openssl ./openssl && cd ./openssl && touch ../.openssl.is.fresh ; \
120125 fi
121126
122127# Need to build OpenSSL differently on OSX
123128ifeq ($(OS ) , Darwin)
124129openssl/Makefile : .openssl.is.fresh
125- cd ./openssl; ./Configure -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC enable-ssl2 enable- weak-ssl-ciphers zlib darwin64-x86_64-cc
130+ cd ./openssl; ./Configure -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC enable-weak-ssl-ciphers zlib darwin64-x86_64-cc
126131# Any other *NIX platform
127132else
128133openssl/Makefile : .openssl.is.fresh
129- cd ./openssl; ./config -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC no-shares enable-weak-ssl-ciphers enable-ssl2 zlib
134+ cd ./openssl; ./config -v - fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC no-shared enable-weak-ssl-ciphers zlib
130135endif
131136
132137openssl/libcrypto.a : openssl/Makefile
133- $(MAKE ) -C openssl depend
134- $(MAKE ) -C openssl all
135- $(MAKE ) -C openssl test
138+ $(MAKE ) -j $( NUM_PROCS ) - C openssl depend
139+ $(MAKE ) -j $( NUM_PROCS ) - C openssl all
140+ # $(MAKE) -j $(NUM_PROCS) - C openssl test # Disabled because this takes 45+ minutes for OpenSSL v1.1.1.
136141
137142static : openssl/libcrypto.a
138- $(MAKE ) sslscan STATIC_BUILD=TRUE
143+ $(MAKE ) -j $(NUM_PROCS ) sslscan STATIC_BUILD=TRUE
144+
145+ test : static
146+ ./docker_test.sh
139147
140148clean :
141149 if [ -d openssl ]; then ( rm -rf openssl ); fi ;
0 commit comments