Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 520 lines (425 sloc) 17.025 kB
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
1
05b0765 @yangtse Added another VS10 version string
yangtse authored
2 # Copyright (C) 2009-2010 by Daniel Stenberg
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
3 #
4 # Permission to use, copy, modify, and distribute this
5 # software and its documentation for any purpose and without
6 # fee is hereby granted, provided that the above copyright
7 # notice appear in all copies and that both that copyright
8 # notice and this permission notice appear in supporting
9 # documentation, and that the name of M.I.T. not be used in
10 # advertising or publicity pertaining to distribution of the
11 # software without specific, written prior permission.
12 # M.I.T. makes no representations about the suitability of
13 # this software for any purpose. It is provided "as is"
14 # without express or implied warranty.
15
16 # ------------------------------------------------------------------------------
17 #
18 # Makefile for building c-ares libraries and sample programs with MSVC.
19 #
20 # Usage: nmake /f makefile.msvc CFG=<config> <target>
21 #
22 # <config> must be one of: [ lib-release | lib-debug | dll-release | dll-debug }
23 # <target> must be one of: [ ALL | c-ares | acountry | adig | ahost | clean }
24 #
25 # If a <target> other than ALL or clean is given, <config> becomes mandatory.
26 #
27 # If neither <config> nor <target> are specified this results in
28 # all targets being built for all <config> c-ares library types.
29 #
30 # This makefile must be processed from the subdir where it is located.
31 #
32 # All results are generated below a subdirectory named msvcXXX.
33 #
34 # ------------------------------------------------------------------------------
35
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
36 NAME = cares
37
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
38 # ------------------------------------------------
39 # c-ares static and dynamic libraries common base
40 # file names for release and debug configurations
41 # ------------------------------------------------
42
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
43 STA_LIB_REL = lib$(NAME)
44 DYN_LIB_REL = $(NAME)
45 STA_LIB_DBG = $(STA_LIB_REL)d
46 DYN_LIB_DBG = $(DYN_LIB_REL)d
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
47
48 # -------------------------------------------
49 # Base names for c-ares DLL import libraries
50 # -------------------------------------------
51
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
52 IMP_LIB_REL = $(DYN_LIB_REL)
53 IMP_LIB_DBG = $(DYN_LIB_DBG)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
54
55 # --------------------------
56 # Runtime library selection
57 # --------------------------
58
59 RTLIB = /MD
60 RTLIBD = /MDd
61
62 !IF "$(RTLIBCFG)" == "static"
63 RTLIB = /MT
64 RTLIBD = /MTd
65 !ENDIF
66
67 # --------------------------------------------------------
68 # Define USE_WATT32 to 1 to use the Watt-32 tcp/ip stack,
69 # otherwise Winsock tcp/ip stack will be used as default.
70 # --------------------------------------------------------
71
72 USE_WATT32 = 0
73
74 # -------------------------------------------
75 # Detect NMAKE version deducing MSVC version
76 # -------------------------------------------
77
78 !IFNDEF _NMAKE_VER
79 ! MESSAGE Macro _NMAKE_VER not defined.
80 ! MESSAGE Use MSVC's NMAKE to process this makefile.
81 ! ERROR See previous message.
82 !ENDIF
83
84 !IF "$(_NMAKE_VER)" == "6.00.8168.0"
85 CC_VERS_NUM = 60
86 !ELSEIF "$(_NMAKE_VER)" == "6.00.9782.0"
87 CC_VERS_NUM = 60
e5fe34e @yangtse Makefile.msvc: add a couple of VS version strings
yangtse authored
88 !ELSEIF "$(_NMAKE_VER)" == "7.00.8882"
89 CC_VERS_NUM = 70
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
90 !ELSEIF "$(_NMAKE_VER)" == "7.00.9466"
91 CC_VERS_NUM = 70
92 !ELSEIF "$(_NMAKE_VER)" == "7.00.9955"
93 CC_VERS_NUM = 70
e5fe34e @yangtse Makefile.msvc: add a couple of VS version strings
yangtse authored
94 !ELSEIF "$(_NMAKE_VER)" == "7.10.2240.8"
95 CC_VERS_NUM = 71
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
96 !ELSEIF "$(_NMAKE_VER)" == "7.10.3077"
97 CC_VERS_NUM = 71
98 !ELSEIF "$(_NMAKE_VER)" == "8.00.40607.16"
99 CC_VERS_NUM = 80
100 !ELSEIF "$(_NMAKE_VER)" == "8.00.50727.42"
101 CC_VERS_NUM = 80
102 !ELSEIF "$(_NMAKE_VER)" == "8.00.50727.762"
103 CC_VERS_NUM = 80
dec9f79 @yangtse Makefile.msvc: add a couple of VS version strings
yangtse authored
104 !ELSEIF "$(_NMAKE_VER)" == "9.00.20706.01"
105 CC_VERS_NUM = 90
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
106 !ELSEIF "$(_NMAKE_VER)" == "9.00.21022.08"
107 CC_VERS_NUM = 90
108 !ELSEIF "$(_NMAKE_VER)" == "9.00.30729.01"
109 CC_VERS_NUM = 90
110 !ELSEIF "$(_NMAKE_VER)" == "10.00.20506.01"
111 CC_VERS_NUM = 100
05b0765 @yangtse Added another VS10 version string
yangtse authored
112 !ELSEIF "$(_NMAKE_VER)" == "10.00.21003.01"
113 CC_VERS_NUM = 100
dec9f79 @yangtse Makefile.msvc: add a couple of VS version strings
yangtse authored
114 !ELSEIF "$(_NMAKE_VER)" == "10.00.30128.01"
115 CC_VERS_NUM = 100
137a440 @yangtse Added another VS10 version string
yangtse authored
116 !ELSEIF "$(_NMAKE_VER)" == "10.00.30319.01"
117 CC_VERS_NUM = 100
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
118 !ELSE
119 ! MESSAGE Unknown value for _NMAKE_VER macro: "$(_NMAKE_VER)"
120 ! MESSAGE Please, report this condition on the c-ares development
121 ! MESSAGE mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
122 ! ERROR See previous message.
123 !ENDIF
124
125 CC_VERS_STR = msvc$(CC_VERS_NUM)
126
127 # ----------------------------------------------------
128 # Verify that current subdir is the c-ares source one
129 # ----------------------------------------------------
130
131 !IF ! EXIST(.\ares_init.c)
132 ! MESSAGE Can not process Makefile.msvc from outside of c-ares source subdirectory.
133 ! MESSAGE Change to the subdirectory where Makefile.msvc is found, and try again.
134 ! ERROR See previous message.
135 !ENDIF
136
137 # ------------------------------------------------------------------
138 # Base subdir is the common root from which other subdirs will hang,
139 # the name depends on MSVC version being used when building c-ares.
140 # ------------------------------------------------------------------
141
142 BASE_DIR = .\$(CC_VERS_STR)
143
144 # ----------------------------------------
145 # Subdir holding sources for all projects
146 # ----------------------------------------
147
148 SRCDIR = .
149
5a21ba2 @yangtse build: add install target to Makefile.msvc
yangtse authored
150 # -----------------------------
151 # Default installation subdirs
152 # -----------------------------
153
154 !IFNDEF INSTALL_DIR
155 INSTALL_DIR = .
156 !ENDIF
157
158 !IFNDEF INSTALL_DIR_LIB
159 INSTALL_DIR_LIB = $(INSTALL_DIR)\lib
160 !ENDIF
161
162 !IFNDEF INSTALL_DIR_INC
163 INSTALL_DIR_INC = $(INSTALL_DIR)\include
164 !ENDIF
165
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
166 # -------------------------
167 # Configuration validation
168 # -------------------------
169
170 VALID_CFGSET = FALSE
171 !IF "$(CFG)" == "lib-release" || "$(CFG)" == "lib-debug" || \
172 "$(CFG)" == "dll-release" || "$(CFG)" == "dll-debug"
173 VALID_CFGSET = TRUE
174 !ENDIF
175
176 !IF "$(VALID_CFGSET)" == "FALSE" && "$(CFG)" != ""
177 ! MESSAGE MSVC c-ares makefile
178 ! MESSAGE
179 ! MESSAGE Usage: nmake /f makefile.msvc CFG=<config> <target>
180 ! MESSAGE
181 ! MESSAGE <config> must be one of: [ lib-release | lib-debug | dll-release | dll-debug }
182 ! MESSAGE <target> must be one of: [ ALL | c-ares | acountry | adig | ahost | clean }
183 ! MESSAGE
184 ! MESSAGE If a <target> other than ALL or clean is given, <config> becomes mandatory.
185 ! MESSAGE
186 ! MESSAGE If neither <config> nor <target> are specified this results in
187 ! MESSAGE all targets being built for all <config> c-ares library types.
188 ! MESSAGE
189 ! ERROR Choose a valid configuration.
190 !ENDIF
191
192 # --------------------------------------------------------
193 # Project subdirs independent of configuration being used
194 # --------------------------------------------------------
195
196 CARES_DIR = $(BASE_DIR)\cares
197 PROG1_DIR = $(BASE_DIR)\acountry
198 PROG2_DIR = $(BASE_DIR)\adig
199 PROG3_DIR = $(BASE_DIR)\ahost
200
201 # ---------------------------------------------------
202 # Subdirs which are configuration dependent are only
203 # defined when a valid configuration has been given.
204 # ---------------------------------------------------
205
206 !IF "$(VALID_CFGSET)" == "TRUE"
207 CARES_OUTDIR = $(CARES_DIR)\$(CFG)
208 PROG1_OUTDIR = $(PROG1_DIR)\$(CFG)
209 PROG2_OUTDIR = $(PROG2_DIR)\$(CFG)
210 PROG3_OUTDIR = $(PROG3_DIR)\$(CFG)
211 CARES_OBJDIR = $(CARES_OUTDIR)\obj
212 PROG1_OBJDIR = $(PROG1_OUTDIR)\obj
213 PROG2_OBJDIR = $(PROG2_OUTDIR)\obj
214 PROG3_OBJDIR = $(PROG3_OUTDIR)\obj
215 !ELSE
216 !UNDEF CARES_OUTDIR
217 !UNDEF PROG1_OUTDIR
218 !UNDEF PROG2_OUTDIR
219 !UNDEF PROG3_OUTDIR
220 !UNDEF CARES_OBJDIR
221 !UNDEF PROG1_OBJDIR
222 !UNDEF PROG2_OBJDIR
223 !UNDEF PROG3_OBJDIR
224 !ENDIF
225
226 # -------------------------------------
227 # Settings that depend on tcp/ip stack
228 # -------------------------------------
229
230 !IF "$(USE_WATT32)" == "1"
231 CFLAGS = /UWIN32 /DWATT32 /I$(WATT_ROOT)\inc
ff90f9d @yangtse Allow using different extra import libraries for debug and release bu…
yangtse authored
232 EX_LIBS_REL = $(WATT_ROOT)\lib\wattcpvc_imp.lib
233 EX_LIBS_DBG = $(WATT_ROOT)\lib\wattcpvc_imp_d.lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
234 !ELSE
235 CFLAGS = /DWIN32
ff90f9d @yangtse Allow using different extra import libraries for debug and release bu…
yangtse authored
236 EX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib
237 EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
238 !ENDIF
239
240 # -----------------------------------------
241 # Switches that depend on compiler version
242 # -----------------------------------------
243
244 !IF $(CC_VERS_NUM) == 60
245 PDB_NONE = /pdb:none
246 PDBTYPE_CONSOLIDATE = /pdbtype:consolidate
247 !ELSE
248 !UNDEF PDB_NONE
249 !UNDEF PDBTYPE_CONSOLIDATE
250 !ENDIF
251
bb3f003 @yangtse - Where run-time error checks enabling compiler option /GZ was used i…
yangtse authored
252 !IF $(CC_VERS_NUM) <= 70
253 RT_ERROR_CHECKING = /GZ
254 !ELSE
255 RT_ERROR_CHECKING = /RTCsu
256 !ENDIF
257
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
258 # ----------------------------
259 # Assorted commands and flags
260 # ----------------------------
261
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
262 CC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2
bb3f003 @yangtse - Where run-time error checks enabling compiler option /GZ was used i…
yangtse authored
263 CC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi $(RT_ERROR_CHECKING)
264 CC_CFLAGS = $(CFLAGS) /I. /W3 /EHsc /FD
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
265
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
266 RC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG"
267 RC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG"
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
268
269 LINK_CMD_LIB = link.exe /lib /nologo
270 LINK_CMD_DLL = link.exe /dll /nologo /incremental:no /fixed:no
271 LINK_CMD_EXE = link.exe /nologo /incremental:no /fixed:no /subsystem:console
272
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
273 LINK_CMD_EXE_REL = $(LINK_CMD_EXE) /release $(PDB_NONE)
274 LINK_CMD_EXE_DBG = $(LINK_CMD_EXE) /debug $(PDBTYPE_CONSOLIDATE)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
275
276 # ---------------------------------
277 # Configuration dependent settings
278 # ---------------------------------
279
280 !IF "$(CFG)" == "lib-release"
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
281 CARES_TARGET = $(STA_LIB_REL).lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
282 CARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DCARES_STATICLIB
283 CARES_LFLAGS =
284 SPROG_CFLAGS = /DCARES_STATICLIB
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
285 SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_REL) $(STA_LIB_REL).lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
286 CARES_LINK = $(LINK_CMD_LIB)
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
287 SPROG_LINK = $(LINK_CMD_EXE_REL)
288 CC_CMD = $(CC_CMD_REL)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
289 !ENDIF
290
291 !IF "$(CFG)" == "lib-debug"
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
292 CARES_TARGET = $(STA_LIB_DBG).lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
293 CARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DCARES_STATICLIB /DDEBUGBUILD
294 CARES_LFLAGS =
295 SPROG_CFLAGS = /DCARES_STATICLIB
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
296 SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_DBG) $(STA_LIB_DBG).lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
297 CARES_LINK = $(LINK_CMD_LIB)
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
298 SPROG_LINK = $(LINK_CMD_EXE_DBG)
299 CC_CMD = $(CC_CMD_DBG)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
300 !ENDIF
301
302 !IF "$(CFG)" == "dll-release"
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
303 CARES_TARGET = $(DYN_LIB_REL).dll
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
304 CARES_CFLAGS = /DCARES_BUILDING_LIBRARY
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
305 CARES_LFLAGS = /release $(EX_LIBS_REL) /implib:$(CARES_OUTDIR)\$(IMP_LIB_REL).lib $(PDB_NONE)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
306 SPROG_CFLAGS =
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
307 SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_REL) $(IMP_LIB_REL).lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
308 CARES_LINK = $(LINK_CMD_DLL)
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
309 SPROG_LINK = $(LINK_CMD_EXE_REL)
310 CC_CMD = $(CC_CMD_REL)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
311 USE_RES_FILE = TRUE
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
312 RC_CMD = $(RC_CMD_REL)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
313 !ENDIF
314
315 !IF "$(CFG)" == "dll-debug"
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
316 CARES_TARGET = $(DYN_LIB_DBG).dll
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
317 CARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DDEBUGBUILD
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
318 CARES_LFLAGS = /debug $(EX_LIBS_DBG) /implib:$(CARES_OUTDIR)\$(IMP_LIB_DBG).lib /pdb:$(CARES_OUTDIR)\$(DYN_LIB_DBG).pdb $(PDBTYPE_CONSOLIDATE)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
319 SPROG_CFLAGS =
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
320 SPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_DBG) $(IMP_LIB_DBG).lib
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
321 CARES_LINK = $(LINK_CMD_DLL)
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
322 SPROG_LINK = $(LINK_CMD_EXE_DBG)
323 CC_CMD = $(CC_CMD_DBG)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
324 USE_RES_FILE = TRUE
9084888 @yangtse Changed c-ares naming conventions when using MSVC as described in REA…
yangtse authored
325 RC_CMD = $(RC_CMD_DBG)
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
326 !ENDIF
327
328 # --------------------------------------------
329 # Makefile.inc provides lists of source files
330 # --------------------------------------------
331
332 !INCLUDE .\Makefile.inc
333
334 # ----------------------------
335 # Build lists of object files
336 # ----------------------------
337
338 !IF "$(VALID_CFGSET)" == "TRUE"
339
340 !IF [ECHO CARES_OBJS=^$(CARES_OBJDIR)\$(CSOURCES: = $(CARES_OBJDIR^)\) > .\cares_objs.inc] == 0
341 !INCLUDE .\cares_objs.inc
342 !IF [DEL .\cares_objs.inc]
343 !ENDIF
344 !ELSE
345 !ERROR Problem generating CARES_OBJS list.
346 !ENDIF
347 CARES_OBJS = $(CARES_OBJS:.c=.obj)
348 !IF "$(USE_RES_FILE)" == "TRUE"
349 CARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res
350 !ENDIF
351
352 !IF [ECHO PROG1_OBJS=^$(PROG1_OBJDIR)\$(SAMPLESOURCES: = $(PROG1_OBJDIR^)\) > .\prog1_objs.inc] == 0
353 !INCLUDE .\prog1_objs.inc
354 !IF [DEL .\prog1_objs.inc]
355 !ENDIF
356 !ELSE
357 !ERROR Problem generating PROG1_OBJS list.
358 !ENDIF
359 PROG1_OBJS = $(PROG1_OBJS:.c=.obj)
360 PROG1_OBJS = $(PROG1_OBJS) $(PROG1_OBJDIR)\acountry.obj
361
362 !IF [ECHO PROG2_OBJS=^$(PROG2_OBJDIR)\$(SAMPLESOURCES: = $(PROG2_OBJDIR^)\) > .\prog2_objs.inc] == 0
363 !INCLUDE .\prog2_objs.inc
364 !IF [DEL .\prog2_objs.inc]
365 !ENDIF
366 !ELSE
367 !ERROR Problem generating PROG2_OBJS list.
368 !ENDIF
369 PROG2_OBJS = $(PROG2_OBJS:.c=.obj)
370 PROG2_OBJS = $(PROG2_OBJS) $(PROG2_OBJDIR)\adig.obj
371
372 !IF [ECHO PROG3_OBJS=^$(PROG3_OBJDIR)\$(SAMPLESOURCES: = $(PROG3_OBJDIR^)\) > .\prog3_objs.inc] == 0
373 !INCLUDE .\prog3_objs.inc
374 !IF [DEL .\prog3_objs.inc]
375 !ENDIF
376 !ELSE
377 !ERROR Problem generating PROG3_OBJS list.
378 !ENDIF
379 PROG3_OBJS = $(PROG3_OBJS:.c=.obj)
380 PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj
381
382 !ENDIF
383
384 # --------------------------------
385 # Only our custom inference rules
386 # --------------------------------
387
388 .SUFFIXES:
389 .SUFFIXES: .c .rc
390
391 {$(SRCDIR)}.rc{$(CARES_OBJDIR)}.res:
392 $(RC_CMD) /Fo $@ $<
393
394 {$(SRCDIR)}.c{$(CARES_OBJDIR)}.obj:
395 $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
396
397 {$(SRCDIR)}.c{$(PROG1_OBJDIR)}.obj:
398 $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
399
400 {$(SRCDIR)}.c{$(PROG2_OBJDIR)}.obj:
401 $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
402
403 {$(SRCDIR)}.c{$(PROG3_OBJDIR)}.obj:
404 $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $<
405
406 # ------------------------------------------------------------- #
407 # ------------------------------------------------------------- #
408 # Default target when no CFG library type has been specified, #
409 # results in building target ALL for all c-ares library types. #
410 # ------------------------------------------------------------- #
411 # ------------------------------------------------------------- #
412
413 !IF "$(VALID_CFGSET)" == "FALSE"
414
415 ALL:
416 $(MAKE) /f .\Makefile.msvc CFG=lib-release ALL
417 $(MAKE) /f .\Makefile.msvc CFG=lib-debug ALL
418 $(MAKE) /f .\Makefile.msvc CFG=dll-release ALL
419 $(MAKE) /f .\Makefile.msvc CFG=dll-debug ALL
420
421 clean:
422 @-RMDIR /S /Q $(BASE_DIR) >NUL 2>&1
423
5a21ba2 @yangtse build: add install target to Makefile.msvc
yangtse authored
424 install:
425 @$(MAKE) /nologo /f .\Makefile.msvc CFG=lib-release install
426 @$(MAKE) /nologo /f .\Makefile.msvc CFG=lib-debug install
427 @$(MAKE) /nologo /f .\Makefile.msvc CFG=dll-release install
428 @$(MAKE) /nologo /f .\Makefile.msvc CFG=dll-debug install
429
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
430 !ENDIF
431
432 # ---------------------------------------------------------------------
433 # Targets only available when a proper CFG library type has been given
434 # ---------------------------------------------------------------------
435
436 !IF "$(VALID_CFGSET)" == "TRUE"
437
438 ALL: c-ares acountry adig ahost
439 @
440
441 c-ares: $(HHEADERS) $(CSOURCES) $(CARES_OBJDIR) $(CARES_OBJS) $(CARES_OUTDIR)
442 $(CARES_LINK) $(CARES_LFLAGS) /out:$(CARES_OUTDIR)\$(CARES_TARGET) $(CARES_OBJS)
29e173d @yangtse Add manifest stuff to msvc makefile
yangtse authored
443 ! IF "$(USE_RES_FILE)" == "TRUE"
ff90f9d @yangtse Allow using different extra import libraries for debug and release bu…
yangtse authored
444 @if exist $(CARES_OUTDIR)\$(CARES_TARGET).manifest mt -nologo -manifest $(CARES_OUTDIR)\$(CARES_TARGET).manifest -outputresource:$(CARES_OUTDIR)\$(CARES_TARGET);2
29e173d @yangtse Add manifest stuff to msvc makefile
yangtse authored
445 ! ENDIF
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
446
447 acountry: c-ares acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS) $(PROG1_OBJDIR) $(PROG1_OBJS) $(PROG1_OUTDIR)
448 $(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG1_OUTDIR)\acountry.exe $(PROG1_OBJS)
ff90f9d @yangtse Allow using different extra import libraries for debug and release bu…
yangtse authored
449 @if exist $(PROG1_OUTDIR)\acountry.exe.manifest mt -nologo -manifest $(PROG1_OUTDIR)\acountry.exe.manifest -outputresource:$(PROG1_OUTDIR)\acountry.exe;1
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
450
451 adig: c-ares adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) $(PROG2_OBJDIR) $(PROG2_OBJS) $(PROG2_OUTDIR)
452 $(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG2_OUTDIR)\adig.exe $(PROG2_OBJS)
ff90f9d @yangtse Allow using different extra import libraries for debug and release bu…
yangtse authored
453 @if exist $(PROG2_OUTDIR)\adig.exe.manifest mt -nologo -manifest $(PROG2_OUTDIR)\adig.exe.manifest -outputresource:$(PROG2_OUTDIR)\adig.exe;1
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
454
455 ahost: c-ares ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS) $(PROG3_OBJDIR) $(PROG3_OBJS) $(PROG3_OUTDIR)
456 $(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG3_OUTDIR)\ahost.exe $(PROG3_OBJS)
ff90f9d @yangtse Allow using different extra import libraries for debug and release bu…
yangtse authored
457 @if exist $(PROG3_OUTDIR)\ahost.exe.manifest mt -nologo -manifest $(PROG3_OUTDIR)\ahost.exe.manifest -outputresource:$(PROG3_OUTDIR)\ahost.exe;1
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
458
459 $(CARES_OUTDIR): $(CARES_DIR)
460 @if not exist $(CARES_OUTDIR) mkdir $(CARES_OUTDIR)
461
462 $(PROG1_OUTDIR): $(PROG1_DIR)
463 @if not exist $(PROG1_OUTDIR) mkdir $(PROG1_OUTDIR)
464
465 $(PROG2_OUTDIR): $(PROG2_DIR)
466 @if not exist $(PROG2_OUTDIR) mkdir $(PROG2_OUTDIR)
467
468 $(PROG3_OUTDIR): $(PROG3_DIR)
469 @if not exist $(PROG3_OUTDIR) mkdir $(PROG3_OUTDIR)
470
471 $(CARES_OBJDIR): $(CARES_OUTDIR)
472 @if not exist $(CARES_OBJDIR) mkdir $(CARES_OBJDIR)
473
474 $(PROG1_OBJDIR): $(PROG1_OUTDIR)
475 @if not exist $(PROG1_OBJDIR) mkdir $(PROG1_OBJDIR)
476
477 $(PROG2_OBJDIR): $(PROG2_OUTDIR)
478 @if not exist $(PROG2_OBJDIR) mkdir $(PROG2_OBJDIR)
479
480 $(PROG3_OBJDIR): $(PROG3_OUTDIR)
481 @if not exist $(PROG3_OBJDIR) mkdir $(PROG3_OBJDIR)
482
483 clean:
484 @-RMDIR /S /Q $(CARES_OUTDIR) >NUL 2>&1
485 @-RMDIR /S /Q $(PROG1_OUTDIR) >NUL 2>&1
486 @-RMDIR /S /Q $(PROG2_OUTDIR) >NUL 2>&1
487 @-RMDIR /S /Q $(PROG3_OUTDIR) >NUL 2>&1
488
5a21ba2 @yangtse build: add install target to Makefile.msvc
yangtse authored
489 install:
490 @if not exist $(CARES_OUTDIR)\$(CARES_TARGET) \
491 $(MAKE) /f .\Makefile.msvc CFG=$(CFG) c-ares
492 @if not exist "$(INSTALL_DIR)" mkdir "$(INSTALL_DIR)"
493 @if not exist "$(INSTALL_DIR_LIB)" mkdir "$(INSTALL_DIR_LIB)"
494 @if not exist "$(INSTALL_DIR_INC)" mkdir "$(INSTALL_DIR_INC)"
495 @copy /y $(CARES_OUTDIR)\*.* "$(INSTALL_DIR_LIB)" >NUL
496 @copy /y $(SRCDIR)\ares.h "$(INSTALL_DIR_INC)" >NUL
497 @copy /y $(SRCDIR)\ares_build.h "$(INSTALL_DIR_INC)" >NUL
498 @copy /y $(SRCDIR)\ares_rules.h "$(INSTALL_DIR_INC)" >NUL
499 @copy /y $(SRCDIR)\ares_version.h "$(INSTALL_DIR_INC)" >NUL
500 @echo Installed c-ares $(CFG)
501
c555893 @yangtse Updated MSVC makefile that allows building dynamic and static
yangtse authored
502 !ENDIF
503
504 $(BASE_DIR):
505 @if not exist $(BASE_DIR) mkdir $(BASE_DIR)
506
507 $(CARES_DIR): $(BASE_DIR)
508 @if not exist $(CARES_DIR) mkdir $(CARES_DIR)
509
510 $(PROG1_DIR): $(BASE_DIR)
511 @if not exist $(PROG1_DIR) mkdir $(PROG1_DIR)
512
513 $(PROG2_DIR): $(BASE_DIR)
514 @if not exist $(PROG2_DIR) mkdir $(PROG2_DIR)
515
516 $(PROG3_DIR): $(BASE_DIR)
517 @if not exist $(PROG3_DIR) mkdir $(PROG3_DIR)
103dec0 @yangtse Preserve empty line following last target
yangtse authored
518
519 # End of Makefile.msvc
Something went wrong with that request. Please try again.