Last active
August 29, 2015 14:22
-
-
Save emptypage/9c0152f94084c9b2c761 to your computer and use it in GitHub Desktop.
Makefile to build FreeType 2 DLLs / static libs for MS Windows.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile to build FreeType 2 DLLs / static libs for MS Windows. | |
VER_NAME = freetype-2.5.5 | |
GIT_TAG = VER-2-5-5 | |
PLATFORMTOOLSET = v$(VISUALSTUDIOVERSION:.=) | |
SRC_DIR = freetype2 | |
CD_SRC_DIR = cd $(SRC_DIR) | |
DIST_BASE = $(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 | |
FT2BUILD_WIN32DLL_H = _ft2build_win32dll.h | |
DLL_BUILD_DIR = _dll_build | |
STATIC_BUILD_DIR = _static_build | |
AUTOGENFILES = .gitignore $(FT2BUILD_WIN32DLL_H) | |
all: .gitignore checkout build | |
checkout: | |
$(CD_SRC_DIR) && git checkout $(GIT_TAG) | |
build: dll-debug-build dll-release-build static-debug-build static-release-build | |
clean: dll-debug-clean dll-release-clean static-debug-clean static-release-clean | |
dist: dll-debug-dist dll-release-dist static-debug-dist static-release-dist | |
zip: $(DIST_DLL_DEBUG).zip $(DIST_DLL_RELEASE).zip $(DIST_STATIC_DEBUG).zip $(DIST_STATIC_RELEASE).zip | |
$(DIST_DLL_DEBUG).zip: dll-debug-dist | |
-del $@ | |
zip -r -9 $@ $* | |
$(DIST_DLL_RELEASE).zip: dll-release-dist | |
-del $@ | |
zip -r -9 $@ $* | |
$(DIST_STATIC_DEBUG).zip: static-debug-dist | |
-del $@ | |
zip -r -9 $@ $* | |
$(DIST_STATIC_RELEASE).zip: static-release-dist | |
-del $@ | |
zip -r -9 $@ $* | |
dll-debug-build: $(DLL_BUILD_DIR) $(FT2BUILD_WIN32DLL_H) | |
cd $(DLL_BUILD_DIR) && devenv freetype.sln /build Debug | |
dll-debug-clean: | |
-cd $(DLL_BUILD_DIR) && devenv freetype.sln /clean Debug | |
dll-debug-dist: dll-debug-build | |
cd $(DLL_BUILD_DIR) && cmake -DCMAKE_INSTALL_PREFIX=..\$(DIST_DLL_DEBUG) -DBUILD_TYPE=Debug -P cmake_install.cmake | |
copy $(FT2BUILD_WIN32DLL_H) $(DIST_DLL_DEBUG)\include\freetype2\ft2build.h /y | |
copy $(DLL_BUILD_DIR)\Debug\freetype.pdb $(DIST_DLL_DEBUG)\bin\ /y | |
dll-release-build: $(DLL_BUILD_DIR) $(FT2BUILD_WIN32DLL_H) | |
cd $(DLL_BUILD_DIR) && devenv freetype.sln /build Release | |
dll-release-clean: | |
-cd $(DLL_BUILD_DIR) && devenv freetype.sln /clean Release | |
dll-release-dist: dll-release-build | |
cd $(DLL_BUILD_DIR) && cmake -DCMAKE_INSTALL_PREFIX=..\$(DIST_DLL_RELEASE) -DBUILD_TYPE=Release -P cmake_install.cmake | |
copy $(FT2BUILD_WIN32DLL_H) $(DIST_DLL_RELEASE)\include\freetype2\ft2build.h /y | |
-copy $(DLL_BUILD_DIR)\Release\freetype.pdb $(DIST_DLL_RELEASE)\bin\ /y | |
static-debug-build: $(STATIC_BUILD_DIR) | |
cd $(STATIC_BUILD_DIR) && devenv freetype.sln /build Debug | |
static-debug-clean: | |
-cd $(STATIC_BUILD_DIR) && devenv freetype.sln /clean Debug | |
static-debug-dist: static-debug-build | |
cd $(STATIC_BUILD_DIR) && cmake -DCMAKE_INSTALL_PREFIX=..\$(DIST_STATIC_DEBUG) -DBUILD_TYPE=Debug -P cmake_install.cmake | |
static-release-build: $(STATIC_BUILD_DIR) | |
cd $(STATIC_BUILD_DIR) && devenv freetype.sln /build Release | |
static-release-clean: | |
-cd $(STATIC_BUILD_DIR) && devenv freetype.sln /clean Release | |
static-release-dist: static-release-build | |
cd $(STATIC_BUILD_DIR) && cmake -DCMAKE_INSTALL_PREFIX=..\$(DIST_STATIC_RELEASE) -DBUILD_TYPE=Release -P cmake_install.cmake | |
$(DLL_BUILD_DIR): $(FT2BUILD_WIN32DLL_H) | |
-mkdir $@ | |
cd $@ && cmake -DBUILD_SHARED_LIBS:BOOL=true ..\$(SRC_DIR) | |
copy $(FT2BUILD_WIN32DLL_H) $@\include\freetype2\ft2build.h | |
$(STATIC_BUILD_DIR): | |
-mkdir $@ | |
cd $@ && cmake ..\$(SRC_DIR) | |
$(FT2BUILD_WIN32DLL_H): | |
copy /b $(SRC_DIR)\include\ft2build.h + << $@ | |
/* Additional definitions to build the appropriate DLLs on MS Windows. */ | |
#if _WIN32 && _DLL | |
#if FT2_BUILD_LIBRARY | |
#define FT_EXPORT(x) extern __declspec(dllexport) x | |
#else | |
#define FT_EXPORT(x) extern __declspec(dllimport) x | |
#endif | |
#endif | |
<< | |
BANG = ! | |
.gitignore: | |
copy << $@ | |
* | |
$(BANG)Makefile | |
<< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment