summaryrefslogtreecommitdiff
path: root/cpp/config/Make.rules.MINGW
blob: 0fc36fc74303a0b2865698b4902b82c87b8e67f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

#
# This file is included by Make.rules when building with MinGW.
#

#
# Default compiler is c++ (aka g++).
#
CXX          = c++

# ICE_WIN32_WINNT sets the minimum version of Windows supported by this build
# 0x600 = Windows Vista / Windows Server 2008
# 0x601 = Windows 7 / Windows Server 2008 R2
# 0x602 = Windows 8 / Windows Server 2012
ICE_WIN32_WINNT := 0x601

CXXFLAGS		= $(CXXARCHFLAGS) -mthreads -Wall -Werror -D_WIN32_WINNT=$(ICE_WIN32_WINNT) -DWIN32_LEAN_AND_MEAN
LDFLAGS			= -Wl,-no-undefined 

ifeq ($(STATICLIBS),yes)
    CXXFLAGS		+= -DICE_STATIC_LIBS
    LDFLAGS		+= -static-libgcc -static-libstdc++
endif

ifeq ($(OPTIMIZE),yes)
    CXXFLAGS		+= -O2 -DNDEBUG
else
    CXXFLAGS		+= -g -D_DEBUG
endif

COMPSUFFIX		= _mingw

mklibfilename	= $(shell echo $(1) | tr A-Z a-z)$(SOVERSION)$(COMPSUFFIX).dll

ifeq ($(STATICLIBS),yes)
    mklibtargets	= $(3)
else
    mklibtargets	= $(1)
endif

mkshlib			= $(CXX) -shared $(LDFLAGS) -o $(1) $(3) \
			  $(subst cpp/lib,cpp/bin, \
			  $(subst -lIce,-lice$(SOVERSION)$(COMPSUFFIX), \
			  $(subst -lIceUtil,-liceutil$(SOVERSION)$(COMPSUFFIX), \
			  $(subst -lSlice,-lslice$(SOVERSION)$(COMPSUFFIX), \
			  $(subst -lIceSSL,-licessl$(SOVERSION)$(COMPSUFFIX), \
			  $(subst -lIceDiscovery,-licediscovery$(SOVERSION)$(COMPSUFFIX),$(4)))))))

mklib			= ar cr $(1) $(2)


ifeq ($(LP64),yes)
    libsubdir		:= bin$(lp64suffix)
    binsubdir		:= bin$(lp64suffix)
else
    libsubdir		:= bin
    binsubdir		:= bin
endif

ifneq ($(LP64),yes)
PLATFORM 		= Win32
else
PLATFORM 		= x64
endif

PLATFORMTOOLSET		= mingw4.7.2
PKG_DIR			= $(top_srcdir)/third-party-packages

BZIP2_VERSION		= 1.0.6.1
BZIP2_HOME		= $(PKG_DIR)/bzip2.$(PLATFORMTOOLSET)
BZIP2_FLAGS		= -I$(BZIP2_HOME)/build/native/include
BZIP2_LIBS		= -L$(BZIP2_HOME)/build/native/bin/$(PLATFORM) -lbzip2$(COMPSUFFIX)
BZIP2_NUPKG		= $(BZIP2_HOME)/bzip2.$(PLATFORMTOOLSET).nupkg

MCPP_VERSION		= 2.7.2.4
MCPP_HOME		= $(PKG_DIR)/mcpp.$(PLATFORMTOOLSET)
MCPP_LIBS		= -L$(MCPP_HOME)/build/native/lib/$(PLATFORM) -lmcpp
MCPP_NUPKG		= $(MCPP_HOME)/mcpp.$(PLATFORMTOOLSET).nupkg

NUGET			= $(subst \,/,$(LOCALAPPDATA)/ZeroC/nuget/nuget.exe)

$(NUGET):
	@mkdir -p "$(LOCALAPPDATA)\ZeroC\nuget"
	powershell -Command "(New-Object Net.WebClient).DownloadFile('http://nuget.org/nuget.exe', '$(NUGET)')"

$(BZIP2_NUPKG): $(NUGET)
	@mkdir -p "$(PKG_DIR)"
	@rm -rf "$(PKG_DIR)\bzip2.$(PLATFORMTOOLSET)"
	$(NUGET) install bzip2.$(PLATFORMTOOLSET) -OutputDirectory "$(PKG_DIR)" -ExcludeVersion

$(MCPP_NUPKG): $(NUGET)
	@mkdir -p "$(PKG_DIR)"
	@rm -rf "$(PKG_DIR)\mcpp.$(PLATFORMTOOLSET)"
	$(NUGET) install mcpp.$(PLATFORMTOOLSET) -OutputDirectory "$(PKG_DIR)" -ExcludeVersion

libdir			:= $(top_srcdir)/$(libsubdir)
bindir			:= $(top_srcdir)/$(binsubdir)

installlib		= $(INSTALL) $(2)/$(3) $(1); \
			  chmod a+rx $(1)/$(3) 

installprogram		= $(INSTALL_PROGRAM) $(1) $(2); \
			  chmod a+rx $(2)/$(notdir $(1))

SSL_OS_LIBS		= -lsecur32 -lcrypt32 -lws2_32

ifeq ($(STATICLIBS),yes)
BASELIBS		= -liceutil $(ICEUTIL_OS_LIBS)
LIBS			= -lice $(BASELIBS) 
ICESSL_LIBS             = -licessl
SLICE_LIBS		= -lslice $(BASELIBS)
else
BASELIBS		= -liceutil$(SOVERSION)$(COMPSUFFIX) $(ICEUTIL_OS_LIBS)
LIBS			= -lice$(SOVERSION)$(COMPSUFFIX) $(BASELIBS) 
ICESSL_LIBS             = -licessl$(SOVERSION)$(COMPSUFFIX)
SLICE_LIBS		= -lslice$(SOVERSION)$(COMPSUFFIX) $(BASELIBS)
endif

ICEUTIL_OS_LIBS		= -lrpcrt4  -ladvapi32
ICE_OS_LIBS		= $(ICEUTIL_OS_LIBS) -lIphlpapi -lws2_32
EXE_EXT                 = .exe