diff --git a/Makefile b/Makefile
index 960635a3a103c6f36e211d8fcf7b21eb7b5308f3..11938e3d0c1ff0bbc06403da6118e4d1d7b53363 100644
--- a/Makefile
+++ b/Makefile
@@ -1216,7 +1216,7 @@ else
 endif
 endif
 	$(Q)$(MAKE) -C third_party/openssl clean
-	$(Q)$(MAKE) -C third_party/openssl build_crypto build_ssl
+	$(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl)
 	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl
 	$(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl
 
diff --git a/templates/Makefile.template b/templates/Makefile.template
index f6028cdecc08fc00e3e686637ca035392d9a6069..3f8686f50c7bf83e3e9de519de3dfdc8aa37545d 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -665,7 +665,7 @@ else
 endif
 endif
 	$(Q)$(MAKE) -C third_party/openssl clean
-	$(Q)$(MAKE) -C third_party/openssl build_crypto build_ssl
+	$(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl)
 	$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl
 	$(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl