Skip to content

Instantly share code, notes, and snippets.

@emptypage
Last active April 6, 2022 03:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emptypage/0b51cb89ef5713781020 to your computer and use it in GitHub Desktop.
Save emptypage/0b51cb89ef5713781020 to your computer and use it in GitHub Desktop.
Makefile to build OpenSSL DLLs / static libs for MS Windows.
# Makefile to build OpenSSL DLLs / static libs for MS Windows.
!IFDEF OPENSSL
INSTALL_DIR = $(OPENSSL)
!ELSE IFNDEF INSTALL_DIR
INSTALL_DIR = C:\OpenSSL
!ENDIF
!IFNDEF SRC_DIR
SRC_DIR = openssl
!ENDIF
VER_NAME = openssl-1.0.2d
GIT_TAG = OpenSSL_1_0_2d
PLATFORMTOOLSET = v$(VISUALSTUDIOVERSION:.=)
DIST_BASE = $(MAKEDIR)\$(VER_NAME)-win32-$(PLATFORMTOOLSET)
DIST_DLL_DEBUG = $(DIST_BASE)-dll-debug
DIST_DLL_RELEASE = $(DIST_BASE)-dll-release
DIST_STATIC_DEBUG = $(DIST_BASE)-static-debug
DIST_STATIC_RELEASE = $(DIST_BASE)-static-release
all: build
install: static-release-install
archive: dist
zip -r -9 $(DIST_DLL_DEBUG).zip $(DIST_DLL_DEBUG)
zip -r -9 $(DIST_DLL_RELEASE).zip $(DIST_DLL_RELEASE)
zip -r -9 $(DIST_STATIC_DEBUG).zip $(DIST_STATIC_DEBUG)
zip -r -9 $(DIST_STATIC_RELEASE).zip $(DIST_STATIC_RELEASE)
build: dll-debug-build dll-release-build static-debug-build static-release-build
dist: dll-debug-dist dll-release-dist static-debug-dist static-release-dist
test: dll-debug-test dll-release-test static-debug-test static-release-test
clean: dll-debug-clean dll-release-clean static-debug-clean static-release-clean
cleanall: clean autogen-clean
setup: .gitignore checkout
checkout:
-cd $(SRC_DIR) && git checkout $(GIT_TAG)
dll-debug-build: setup
cd $(SRC_DIR) && perl Configure debug-VC-WIN32 --prefix=$(INSTALL_DIR) && ms\do_nasm
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak
dll-debug-dist: dll-debug-build
cd $(SRC_DIR) && perl Configure debug-VC-WIN32 --prefix=$(DIST_DLL_DEBUG) && ms\do_nasm
-rd /s /q $(DIST_DLL_DEBUG)
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak install
dll-debug-test: dll-debug-build
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak test
dll-debug-clean:
-cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak clean
dll-debug-install: dll-debug-build
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak install
dll-release-build: setup
cd $(SRC_DIR) && perl Configure VC-WIN32 --prefix=$(INSTALL_DIR) && ms\do_nasm
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak
dll-release-dist: dll-release-build
cd $(SRC_DIR) && perl Configure VC-WIN32 --prefix=$(DIST_DLL_RELEASE) && ms\do_nasm
-rd /s /q $(DIST_DLL_RELEASE)
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak install
dll-release-test: dll-release-build
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak test
dll-release-clean:
-cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak clean
dll-release-install: dll-release-build
cd $(SRC_DIR) && $(MAKE) /f ms\ntdll.mak install
static-debug-build: setup
cd $(SRC_DIR) && perl Configure debug-VC-WIN32 --prefix=$(INSTALL_DIR) && ms\do_nasm
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak
static-debug-dist: static-debug-build
cd $(SRC_DIR) && perl Configure debug-VC-WIN32 --prefix=$(DIST_STATIC_DEBUG) && ms\do_nasm
-rd /s /q $(DIST_STATIC_DEBUG)
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak install
static-debug-test: static-debug-build
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak test
static-debug-clean:
-cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak clean
static-debug-install: static-debug-build
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak install
static-release-build: setup
cd $(SRC_DIR) && perl Configure VC-WIN32 --prefix=$(INSTALL_DIR) && ms\do_nasm
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak
static-release-dist: static-release-build
cd $(SRC_DIR) && perl Configure VC-WIN32 --prefix=$(DIST_STATIC_RELEASE) && ms\do_nasm
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak install
static-release-test: static-release-build
cd $(SRC_DIR) && perl Configure VC-WIN32 --prefix=$(TEMP_DIST_DIR) && ms\do_nasm
-rd /s /q $(DIST_STATIC_RELEASE)
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak test
static-release-clean:
-cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak clean
static-release-install: static-release-build
cd $(SRC_DIR) && $(MAKE) /f ms\nt.mak install
AUTOGENFILES = .gitignore
autogen-clean:
-del $(AUTOGENFILES)
BANG = !
.gitignore:
copy << $@
*
$(BANG)Makefile
<<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment