forked from datacratic/curlpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.msvc
281 lines (218 loc) · 7.16 KB
/
Makefile.msvc
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# Makefile for building curlpp with MSVC
# Giuseppe "Cowo" Corbelli - cowo.lugbs.linux.it
# Piotr Dobrogost - pd.curlpp.org (February 2009 - March 2009)
#
# Usage:
# nmake /f makefile.msvc BUILD_CFG=[dynamic|static]-[debug|release]
# RTLIB_CFG=[dynamic|static]-[debug|release]
# LIBCURL_CFG=[dynamic|static]-[debug|release]
#
# All options are optional
# Default for BUILD_CFG is dynamic-release
# Default for others is the value of BUILD_CFG
#
# Should be invoked from curlpp directory
# Edit the LIBCURL_PATH or set LIBCURL_PATH envvar !
# DEFAULTS SECTION - default values of some variables
#####################################################
LIB_NAME = curlpp
LIBCURL_NAME = libcurl
DEFAULT_DIR_OUT = .\out\$(BUILD_CFG)
DEFAULT_LIBCURL_PATH= c:\program files (x86)\libcurl
DEFAULT_SELF_CONTAINED = yes
DEFAULT_BUILD_TYPE = dynamic
DEFAULT_BUILD_MODE = release
!IFNDEF SELF_CONTAINED
SELF_CONTAINED = $(DEFAULT_SELF_CONTAINED)
!ENDIF
!IFNDEF BUILD_CFG
BUILD_CFG = $(DEFAULT_BUILD_TYPE)-$(DEFAULT_BUILD_MODE)
!ENDIF
!IFNDEF RTLIB_CFG
RTLIB_CFG = $(BUILD_CFG)
!ENDIF
!IFNDEF LIBCURL_CFG
LIBCURL_CFG = $(BUILD_CFG)
!ENDIF
!IFNDEF LIBCURL_PATH
LIBCURL_PATH = $(DEFAULT_LIBCURL_PATH)
!ENDIF
!IFNDEF DIR_OUT
DIR_OUT = $(DEFAULT_DIR_OUT)
!ENDIF
DIR_OBJ = $(DIR_OUT)\obj
TARGET = $(LIB_NAME)$(TARGET_SUFFIX)
# GLOBAL SECTION - common options needed for DEBUG/RELEASE and DYNAMIC/STATIC variants of builds
################################################################################################
# BASE entity
# definitions to be used in following compiler part
COMPILER = cl.exe
C_DEFS = /DWIN32 /DBUILDING_CURLPP
!IF "$(SELF_CONTAINED)" == "yes"
C_DEFS = $(C_DEFS) /DCURLPP_SELF_CONTAINED
!ENDIF
C_INCLUDES = /I "./include"
CFLAGS_STD = $(C_INCLUDES) $(C_DEFS) /nologo /W0 /EHsc /FD /c
CFLAGS_DYNAMIC = /UCURLPP_STATICLIB
CFLAGS_STATIC = /DCURLPP_STATICLIB
CFLAGS_DEBUG = /D_DEBUG /Od /Gm /Zi /RTC1 /GR
CFLAGS_RELEASE = /DNDEBUG /O2 /GR
CFLAGS =
# compiler part
!IF "$(BUILD_CFG)" == "dynamic-release"
CFLAGS = $(CFLAGS) $(CFLAGS_DYNAMIC) $(CFLAGS_RELEASE)
!ENDIF
!IF "$(BUILD_CFG)" == "dynamic-debug"
CFLAGS = $(CFLAGS) $(CFLAGS_DYNAMIC) $(CFLAGS_DEBUG)
!ENDIF
!IF "$(BUILD_CFG)" == "static-release"
CFLAGS = $(CFLAGS) $(CFLAGS_STATIC) $(CFLAGS_RELEASE)
!ENDIF
!IF "$(BUILD_CFG)" == "static-debug"
CFLAGS = $(CFLAGS) $(CFLAGS_STATIC) $(CFLAGS_DEBUG)
!ENDIF
# definitions to be used in following linker part
LINKER = link.exe
LFLAGS_STD = /nologo /libpath:"$(LIBCURL_PATH)/lib"
LFLAGS_DYNAMIC = /dll /release /debug /incremental:no /opt:noref
LFLAGS_STATIC = /lib
LFLAGS =
# linker part
!IF "$(BUILD_CFG)" == "dynamic-release"
LFLAGS = $(LFLAGS) $(LFLAGS_DYNAMIC)
!ENDIF
!IF "$(BUILD_CFG)" == "dynamic-debug"
LFLAGS = $(LFLAGS) $(LFLAGS_DYNAMIC)
!ENDIF
!IF "$(BUILD_CFG)" == "static-release"
LFLAGS = $(LFLAGS) $(LFLAGS_STATIC)
!ENDIF
!IF "$(BUILD_CFG)" == "static-debug"
LFLAGS = $(LFLAGS) $(LFLAGS_STATIC)
!ENDIF
# RUN-TIME entity
# compiler part
!IF "$(RTLIB_CFG)" == "dynamic-release"
CFLAGS = /MD $(CFLAGS)
!ENDIF
!IF "$(RTLIB_CFG)" == "dynamic-debug"
CFLAGS = /MDd $(CFLAGS)
!ENDIF
!IF "$(RTLIB_CFG)" == "static-release"
CFLAGS = /MT $(CFLAGS)
!ENDIF
!IF "$(RTLIB_CFG)" == "static-debug"
CFLAGS = /MTd $(CFLAGS)
!ENDIF
# linker part
# none
# DEPENDENCIES SECTION
######################
CFLAGS_DEPENDENCIES =
LFLAGS_DEPENDENCIES =
# LIBCURL
# definitions to be used in following compiler part
CFLAGS_LIBCURL = /I "$(LIBCURL_PATH)/include"
# compiler part
!IF "$(LIBCURL_CFG)" == "dynamic-release"
CFLAGS = $(CFLAGS) $(CFLAGS_LIBCURL)
!ENDIF
!IF "$(LIBCURL_CFG)" == "dynamic-debug"
CFLAGS = $(CFLAGS) $(CFLAGS_LIBCURL)
!ENDIF
!IF "$(LIBCURL_CFG)" == "static-release"
CFLAGS = $(CFLAGS) $(CFLAGS_LIBCURL)
!ENDIF
!IF "$(LIBCURL_CFG)" == "static-debug"
CFLAGS = $(CFLAGS) $(CFLAGS_LIBCURL)
!ENDIF
# libcurl configuration - linker part
!IF "$(LIBCURL_CFG)" == "dynamic-release"
LFLAGS_DEPENDENCIES = $(LFLAGS_DEPENDENCIES) $(LIBCURL_NAME)$(TARGET_SUFFIX).lib
!ENDIF
!IF "$(LIBCURL_CFG)" == "dynamic-debug"
LFLAGS_DEPENDENCIES = $(LFLAGS_DEPENDENCIES) $(LIBCURL_NAME)$(TARGET_SUFFIX).lib
!ENDIF
!IF "$(LIBCURL_CFG)" == "static-release"
LFLAGS_DEPENDENCIES = $(LFLAGS_DEPENDENCIES) $(LIBCURL_NAME)$(TARGET_SUFFIX).lib
!ENDIF
!IF "$(LIBCURL_CFG)" == "static-debug"
LFLAGS_DEPENDENCIES = $(LFLAGS_DEPENDENCIES) $(LIBCURL_NAME)$(TARGET_SUFFIX).lib
!ENDIF
# TARGET
# compiler part
# none
# definitions to be uses in following linker part
LNK_OUT = /out:$(DIR_OUT)\$(TARGET)
LNK_OUT_IMP = /implib:$(DIR_OUT)\$(TARGET).lib
LNK_OUT_PDB = /pdb:$(DIR_OUT)\$(TARGET).pdb
# linker part
!IF "$(BUILD_CFG)" == "dynamic-release"
LFLAGS = $(LFLAGS) $(LNK_OUT).dll $(LNK_OUT_IMP) $(LNK_OUT_PDB)
!ENDIF
!IF "$(BUILD_CFG)" == "dynamic-debug"
LFLAGS = $(LFLAGS) $(LNK_OUT).dll $(LNK_OUT_IMP) $(LNK_OUT_PDB)
!ENDIF
!IF "$(BUILD_CFG)" == "static-release"
LFLAGS = $(LFLAGS) $(LNK_OUT).lib
!ENDIF
!IF "$(BUILD_CFG)" == "static-debug"
LFLAGS = $(LFLAGS) $(LNK_OUT).lib
!ENDIF
!IF "$(BUILD_CFG)" == "dynamic-release"
TARGET_SUFFIX = MD
!ENDIF
!IF "$(BUILD_CFG)" == "dynamic-debug"
TARGET_SUFFIX = MDd
!ENDIF
!IF "$(BUILD_CFG)" == "static-release"
TARGET_SUFFIX = MT
!ENDIF
!IF "$(BUILD_CFG)" == "static-debug"
TARGET_SUFFIX = MTd
!ENDIF
CC = $(COMPILER) $(CFLAGS) $(CFLAGS_STD)
LNK = $(LINKER) $(LFLAGS) $(LFLAGS_DEPENDENCIES) $(LFLAGS_STD)
X_OBJS= \
$(DIR_OBJ)/CurlHandle.o \
$(DIR_OBJ)/cURLpp.o \
$(DIR_OBJ)/Exception.o \
$(DIR_OBJ)/Easy.o \
$(DIR_OBJ)/Form.o \
$(DIR_OBJ)/Info.o \
$(DIR_OBJ)/Multi.o \
$(DIR_OBJ)/OptionBase.o \
$(DIR_OBJ)/OptionList.o \
$(DIR_OBJ)/OptionSetter.o \
$(DIR_OBJ)/SList.o \
all : $(DIR_OUT)$(TARGET)
$(DIR_OUT)$(TARGET): $(X_OBJS)
$(LNK) $(X_OBJS)
$(X_OBJS): $(DIR_OBJ) $(DIR_OUT)
$(DIR_OBJ):
@if not exist "$(DIR_OBJ)" mkdir $(DIR_OBJ)
$(DIR_OUT):
@if not exist "$(DIR_OUT)" mkdir $(DIR_OUT)
.SUFFIXES: .cpp .obj
{.\src\curlpp}.cpp{$(DIR_OBJ)\}.o:
$(CC) $(CFLAGS) /Fo"$@" $<
{.\src\curlpp\internal}.cpp{$(DIR_OBJ)\}.o:
$(CC) $(CFLAGS) /Fo"$@" $<
clean:
@-erase /s $(DIR_OUT)\*.dll 2> NUL
@-erase /s $(DIR_OUT)\*.exp 2> NUL
@-erase /s $(DIR_OUT)\*.idb 2> NUL
@-erase /s $(DIR_OUT)\*.lib 2> NUL
@-erase /s $(DIR_OUT)\*.o 2> NUL
@-erase /s $(DIR_OUT)\*.pch 2> NUL
@-erase /s $(DIR_OUT)\*.pdb 2> NUL
@-erase /s $(DIR_OUT)\*.res 2> NUL
@-erase /s $(DIR_OUT)\*.manifest 2> NUL
help options usage :
@echo "Usage: nmake /f makefile.msvc \
BUILD_CFG=[dynamic|static]-[debug|release] \
RTLIB_CFG=[dynamic|static]-[debug|release] \
LIBCURL_CFG=[dynamic|static]-[debug|release] \
All options are optional \
Default for BUILD_CFG is dynamic-release \
Default for others is the value of BUILD_CFG"