1diff --git a/Makefile b/Makefile
2index 695be54..4efe5e5 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -5,10 +5,13 @@
6 # - iOS                       - build everything for iOS
7 # - tvOS                      - build everything for tvOS
8 # - watchOS                   - build everything for watchOS
9 # - OpenSSL-macOS   - build OpenSSL for macOS
10 # - OpenSSL-iOS     - build OpenSSL for iOS
11+# - OpenSSL-iOS-simulator     - build OpenSSL for iOS-simulator
12 # - OpenSSL-tvOS    - build OpenSSL for tvOS
13+# - OpenSSL-tvOS-simulator    - build OpenSSL for tvOS-simulator
14 # - OpenSSL-watchOS - build OpenSSL for watchOS
15+# - OpenSSL-watchOS-simulator - build OpenSSL for watchOS-simulator
16 # - BZip2-macOS     - build BZip2 for macOS
17 # - BZip2-iOS       - build BZip2 for iOS
18 # - BZip2-tvOS      - build BZip2 for tvOS
19@@ -36,31 +39,45 @@ OPENSSL_VERSION=$(OPENSSL_VERSION_NUMBER)$(OPENSSL_REVISION)
20 BZIP2_VERSION=1.0.6
21
22 # Supported OS
23-OS=macOS iOS tvOS watchOS
24+OS=macOS iOS iOS-simulator tvOS tvOS-simulator watchOS watchOS-simulator
25
26 # macOS targets
27-TARGETS-macOS=macosx.x86_64
28+TARGETS-macOS=macosx.arm64 macosx.x86_64
29+PYTHON_TARGETS-macOS=macOS
30 CFLAGS-macOS=-mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)
31
32 # iOS targets
33-TARGETS-iOS=iphonesimulator.x86_64 iphonesimulator.i386 iphoneos.armv7 iphoneos.armv7s iphoneos.arm64
34+TARGETS-iOS=iphoneos.armv7 iphoneos.armv7s iphoneos.arm64
35 CFLAGS-iOS=-mios-version-min=7.0
36 CFLAGS-iphoneos.armv7=-fembed-bitcode
37 CFLAGS-iphoneos.armv7s=-fembed-bitcode
38 CFLAGS-iphoneos.arm64=-fembed-bitcode
39
40+# iOS-simulator targets
41+TARGETS-iOS-simulator=iphonesimulator.x86_64 iphonesimulator.i386 iphonesimulator.arm64
42+CFLAGS-iOS-simulator=-mios-simulator-version-min=7.0
43+
44 # tvOS targets
45-TARGETS-tvOS=appletvsimulator.x86_64 appletvos.arm64
46+TARGETS-tvOS=appletvos.arm64
47 CFLAGS-tvOS=-mtvos-version-min=9.0
48 CFLAGS-appletvos.arm64=-fembed-bitcode
49 PYTHON_CONFIGURE-tvOS=ac_cv_func_sigaltstack=no
50
51+# tvOS-simulator targets
52+TARGETS-tvOS-simulator=appletvsimulator.x86_64 appletvsimulator.arm64
53+CFLAGS-tvOS-simulator=-mtvos-simulator-version-min=9.0
54+
55 # watchOS targets
56-TARGETS-watchOS=watchsimulator.i386 watchos.armv7k
57+TARGETS-watchOS=watchos.armv7k watchos.arm64_32
58 CFLAGS-watchOS=-mwatchos-version-min=4.0
59 CFLAGS-watchos.armv7k=-fembed-bitcode
60+CFLAGS-watchos.arm64_32=-fembed-bitcode
61 PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
62
63+# watchOS-simulator targets
64+TARGETS-watchOS-simulator=watchsimulator.i386 watchsimulator.x86_64 watchsimulator.arm64
65+CFLAGS-watchOS-simulator=-mwatchos-simulator-version-min=4.0
66+
67 # override machine types for arm64
68 MACHINE_DETAILED-arm64=aarch64
69 MACHINE_SIMPLE-arm64=arm
70@@ -194,9 +211,11 @@ endif
71
72 	# Configure the build
73 ifeq ($2,macOS)
74+	# Patch openssl-darwin-arm64
75+	cd $$(OPENSSL_DIR-$1) && git apply ../../../../openssl-1.0.2n-darwin-arm64.patch
76 	cd $$(OPENSSL_DIR-$1) && \
77 	CC="$$(CC-$1)" MACOSX_DEPLOYMENT_TARGET=$$(MACOSX_DEPLOYMENT_TARGET) \
78-		./Configure darwin64-x86_64-cc --openssldir=$(PROJECT_DIR)/build/$2/openssl
79+		./Configure darwin64-$$(ARCH-$1)-cc --openssldir=$(PROJECT_DIR)/build/$2/openssl
80 else
81 	cd $$(OPENSSL_DIR-$1) && \
82 		CC="$$(CC-$1)" \
83