-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fab295e
commit 11755f1
Showing
7 changed files
with
249 additions
and
36 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
# Makefile for MinGW32/MinGW-W64 | ||
|
||
# Example usages: | ||
# Out-of-source build (build in the same directory as sakura_core): | ||
# $ mkdir -p build/MinGW/Release/ | ||
# $ cd build/MinGW/Release | ||
# $ mingw32-make -f ../../../tests/unittests/Makefile SAKURA_CORE=. OUTDIR=. -j4 | ||
# | ||
# Out-of-source build (create tests1 and sakura_core in a common directory): | ||
# $ mkdir -p build/MinGW/Release/tests1/ | ||
# $ cd build/MinGW/Release/tests1 | ||
# $ mingw32-make -f ../../../../tests/unittests/Makefile OUTDIR=.. -j4 | ||
# | ||
# Debug build with coverage: | ||
# $ cd tests/unittests | ||
# $ mingw32-make MYCFLAGS="-g --coverage" MYLIBS=--coverage -j4 | ||
|
||
# Path of "sakura_core" directory. Compute it from the path of Makefile. | ||
SRCDIR = $(patsubst %/,%,$(subst \,/,$(dir $(firstword $(MAKEFILE_LIST))))) | ||
|
||
# If SRCDIR is different from the current directory, set it to VPATH. | ||
# (If SRCDIR ends with a backslash, remove it before set to VPATH.) | ||
ifneq ($(SRCDIR),.) | ||
VPATH = $(patsubst %\,%,$(SRCDIR)) | ||
endif | ||
|
||
# The directory where "sakura_core" is built. | ||
SAKURA_CORE = ../sakura_core | ||
|
||
GOOGLETEST_INSTALL_DIR = ../googletest | ||
|
||
# The directory where the .exe files will be output. | ||
# If empty, they will be output to the default directories. | ||
OUTDIR = | ||
|
||
ifeq ($(SHELL),sh.exe) | ||
# If cmd.exe is used as a shell. | ||
MKDIR = md | ||
RM = del | ||
DIRSEP = $(strip \ ) | ||
DEVNULL = NUL | ||
else | ||
# If unix-like shell is used. | ||
MKDIR = mkdir -p | ||
RM = rm -f | ||
DIRSEP = / | ||
DEVNULL = /dev/null | ||
endif | ||
|
||
ifndef PREFIX | ||
PREFIX= | ||
RCPREFIX= | ||
else ifeq ($(PREFIX),x86_64-w64-mingw32-) | ||
RCPREFIX=$(PREFIX) | ||
else ifeq ($(PREFIX),i686-w64-mingw32-) | ||
ifeq ($(OS),Windows_NT) | ||
RCPREFIX= | ||
else | ||
RCPREFIX=$(PREFIX) | ||
endif | ||
endif | ||
|
||
CC= $(PREFIX)gcc | ||
CXX= $(PREFIX)g++ | ||
RC= $(RCPREFIX)windres | ||
|
||
DEFINES= \ | ||
-DWIN32 \ | ||
-D_WIN32_WINNT=_WIN32_WINNT_WIN7 \ | ||
-D_UNICODE \ | ||
-DUNICODE \ | ||
$(MYDEFINES) | ||
|
||
ifeq (,$(findstring -D_DEBUG,$(DEFINES))) | ||
ifeq (,$(findstring -DNDEBUG,$(DEFINES))) | ||
DEFINES += -DNDEBUG | ||
endif | ||
else | ||
LIB_SUFFIX = d | ||
endif | ||
|
||
CFLAGS= \ | ||
-finput-charset=utf-8 \ | ||
-fexec-charset=cp932 \ | ||
-MMD \ | ||
-isystem $(GOOGLETEST_INSTALL_DIR)/include \ | ||
-I$(SAKURA_CORE) \ | ||
-I$(SRCDIR)/../../sakura_core \ | ||
-I. \ | ||
-I$(SRCDIR) \ | ||
$(DEFINES) $(MYCFLAGS) | ||
|
||
CXXFLAGS= $(CFLAGS) \ | ||
-std=c++17 \ | ||
$(MYCXXFLAGS) | ||
|
||
LIBS= \ | ||
-static \ | ||
-lwinspool \ | ||
-lole32 \ | ||
-loleaut32 \ | ||
-luuid \ | ||
-lcomctl32 \ | ||
-limm32 \ | ||
-lmpr \ | ||
-limagehlp \ | ||
-lshlwapi \ | ||
-lwinmm \ | ||
-lwindowscodecs \ | ||
-lmsimg32 \ | ||
-lkernel32 \ | ||
-lgdi32 \ | ||
-lcomdlg32 \ | ||
-L$(GOOGLETEST_INSTALL_DIR)/lib \ | ||
-lgtest$(or $(LIB_SUFFIX),) \ | ||
-lgtest_main$(or $(LIB_SUFFIX),) \ | ||
$(MYLIBS) | ||
|
||
exe= $(or $(OUTDIR),.)/tests1.exe | ||
|
||
SRCS = $(wildcard $(SRCDIR)/test-*.cpp) \ | ||
$(wildcard $(SRCDIR)/code-*.cpp) | ||
OBJS = $(SRCS:$(SRCDIR)/%.cpp=%.o) | ||
|
||
DEPS= $(OBJS:%.o=%.d) | ||
|
||
SAKURA_SRCS = $(wildcard $(SRCDIR)/../../sakura_core/*.cpp) \ | ||
$(wildcard $(SRCDIR)/../../sakura_core/*/*.cpp) \ | ||
$(wildcard $(SRCDIR)/../../sakura_core/*/*/*.cpp) | ||
SAKURA_OBJS = $(SAKURA_SRCS:$(SRCDIR)/../../sakura_core/%.cpp=$(SAKURA_CORE)/%.o) \ | ||
$(SAKURA_CORE)/sakura_rc.o | ||
|
||
all: $(exe) | ||
|
||
$(exe): $(OBJS) $(SAKURA_OBJS) | ||
$(CXX) -o $@ $(OBJS) $(SAKURA_OBJS) $(LIBS) | ||
|
||
.cpp.o: | ||
$(CXX) $(CXXFLAGS) -o $@ -c $< | ||
|
||
$(OBJS): | ||
|
||
clean: | ||
-$(RM) $(subst /,$(DIRSEP),$(exe) $(OBJS)) | ||
-$(RM) $(subst /,$(DIRSEP),$(DEPS)) | ||
|
||
.SUFFIXES: .cpp .o | ||
.PHONY: all clean | ||
|
||
-include $(DEPS) |