11cb0ef41Sopenharmony_ci 21cb0ef41Sopenharmony_ci# Copyright (C) 2009-2013 by Daniel Stenberg 31cb0ef41Sopenharmony_ci# 41cb0ef41Sopenharmony_ci# Permission to use, copy, modify, and distribute this 51cb0ef41Sopenharmony_ci# software and its documentation for any purpose and without 61cb0ef41Sopenharmony_ci# fee is hereby granted, provided that the above copyright 71cb0ef41Sopenharmony_ci# notice appear in all copies and that both that copyright 81cb0ef41Sopenharmony_ci# notice and this permission notice appear in supporting 91cb0ef41Sopenharmony_ci# documentation, and that the name of M.I.T. not be used in 101cb0ef41Sopenharmony_ci# advertising or publicity pertaining to distribution of the 111cb0ef41Sopenharmony_ci# software without specific, written prior permission. 121cb0ef41Sopenharmony_ci# M.I.T. makes no representations about the suitability of 131cb0ef41Sopenharmony_ci# this software for any purpose. It is provided "as is" 141cb0ef41Sopenharmony_ci# without express or implied warranty. 151cb0ef41Sopenharmony_ci# 161cb0ef41Sopenharmony_ci# SPDX-License-Identifier: MIT 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci# ------------------------------------------------------------------------------ 191cb0ef41Sopenharmony_ci# 201cb0ef41Sopenharmony_ci# Makefile for building c-ares libraries and sample programs with MSVC. 211cb0ef41Sopenharmony_ci# 221cb0ef41Sopenharmony_ci# Usage: nmake /f makefile.msvc CFG=<config> <target> 231cb0ef41Sopenharmony_ci# 241cb0ef41Sopenharmony_ci# <config> must be one of: [ lib-release | lib-debug | dll-release | dll-debug } 251cb0ef41Sopenharmony_ci# <target> must be one of: [ ALL | c-ares | adig | ahost | clean } 261cb0ef41Sopenharmony_ci# 271cb0ef41Sopenharmony_ci# If a <target> other than ALL or clean is given, <config> becomes mandatory. 281cb0ef41Sopenharmony_ci# 291cb0ef41Sopenharmony_ci# If neither <config> nor <target> are specified this results in 301cb0ef41Sopenharmony_ci# all targets being built for all <config> c-ares library types. 311cb0ef41Sopenharmony_ci# 321cb0ef41Sopenharmony_ci# This makefile must be processed from the subdir where it is located. 331cb0ef41Sopenharmony_ci# 341cb0ef41Sopenharmony_ci# All results are generated below a subdirectory named msvcXXX. 351cb0ef41Sopenharmony_ci# 361cb0ef41Sopenharmony_ci# ------------------------------------------------------------------------------ 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ciNAME = cares 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci# ------------------------------------------------ 411cb0ef41Sopenharmony_ci# c-ares static and dynamic libraries common base 421cb0ef41Sopenharmony_ci# file names for release and debug configurations 431cb0ef41Sopenharmony_ci# ------------------------------------------------ 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ciSTA_LIB_REL = lib$(NAME) 461cb0ef41Sopenharmony_ciDYN_LIB_REL = $(NAME) 471cb0ef41Sopenharmony_ciSTA_LIB_DBG = $(STA_LIB_REL)d 481cb0ef41Sopenharmony_ciDYN_LIB_DBG = $(DYN_LIB_REL)d 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci# ------------------------------------------- 511cb0ef41Sopenharmony_ci# Base names for c-ares DLL import libraries 521cb0ef41Sopenharmony_ci# ------------------------------------------- 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ciIMP_LIB_REL = $(DYN_LIB_REL) 551cb0ef41Sopenharmony_ciIMP_LIB_DBG = $(DYN_LIB_DBG) 561cb0ef41Sopenharmony_ci 571cb0ef41Sopenharmony_ci# -------------------------- 581cb0ef41Sopenharmony_ci# Runtime library selection 591cb0ef41Sopenharmony_ci# -------------------------- 601cb0ef41Sopenharmony_ci 611cb0ef41Sopenharmony_ciRTLIB = /MD 621cb0ef41Sopenharmony_ciRTLIBD = /MDd 631cb0ef41Sopenharmony_ci 641cb0ef41Sopenharmony_ci!IF "$(RTLIBCFG)" == "static" 651cb0ef41Sopenharmony_ciRTLIB = /MT 661cb0ef41Sopenharmony_ciRTLIBD = /MTd 671cb0ef41Sopenharmony_ci!ENDIF 681cb0ef41Sopenharmony_ci 691cb0ef41Sopenharmony_ci# -------------------------------------------------------- 701cb0ef41Sopenharmony_ci# Define USE_WATT32 to 1 to use the Watt-32 tcp/ip stack, 711cb0ef41Sopenharmony_ci# otherwise Winsock tcp/ip stack will be used as default. 721cb0ef41Sopenharmony_ci# -------------------------------------------------------- 731cb0ef41Sopenharmony_ci 741cb0ef41Sopenharmony_ciUSE_WATT32 = 0 751cb0ef41Sopenharmony_ci 761cb0ef41Sopenharmony_ci# -------------------------------------------------------- 771cb0ef41Sopenharmony_ci# Detect compiler version. 781cb0ef41Sopenharmony_ci# -------------------------------------------------------- 791cb0ef41Sopenharmony_ci!INCLUDE .\msvc_ver.inc 801cb0ef41Sopenharmony_ci 811cb0ef41Sopenharmony_ci# ---------------------------------------------------- 821cb0ef41Sopenharmony_ci# Verify that current subdir is the c-ares source one 831cb0ef41Sopenharmony_ci# ---------------------------------------------------- 841cb0ef41Sopenharmony_ci 851cb0ef41Sopenharmony_ci!IF ! EXIST(.\src\lib\ares_init.c) 861cb0ef41Sopenharmony_ci! MESSAGE Can not process Makefile.msvc from outside of c-ares source subdirectory. 871cb0ef41Sopenharmony_ci! MESSAGE Change to the subdirectory where Makefile.msvc is found, and try again. 881cb0ef41Sopenharmony_ci! ERROR See previous message. 891cb0ef41Sopenharmony_ci!ENDIF 901cb0ef41Sopenharmony_ci 911cb0ef41Sopenharmony_ci# ------------------------------------------------------------------ 921cb0ef41Sopenharmony_ci# Base subdir is the common root from which other subdirs will hang. 931cb0ef41Sopenharmony_ci# ------------------------------------------------------------------ 941cb0ef41Sopenharmony_ci 951cb0ef41Sopenharmony_ciBASE_DIR = .\msvc 961cb0ef41Sopenharmony_ci 971cb0ef41Sopenharmony_ci# ---------------------------------------- 981cb0ef41Sopenharmony_ci# Subdir holding sources for all projects 991cb0ef41Sopenharmony_ci# ---------------------------------------- 1001cb0ef41Sopenharmony_ci 1011cb0ef41Sopenharmony_ciSRCDIR = . 1021cb0ef41Sopenharmony_ci 1031cb0ef41Sopenharmony_ci# ----------------------------- 1041cb0ef41Sopenharmony_ci# Default installation subdirs 1051cb0ef41Sopenharmony_ci# ----------------------------- 1061cb0ef41Sopenharmony_ci 1071cb0ef41Sopenharmony_ci!IFNDEF INSTALL_DIR 1081cb0ef41Sopenharmony_ciINSTALL_DIR = . 1091cb0ef41Sopenharmony_ci!ENDIF 1101cb0ef41Sopenharmony_ci 1111cb0ef41Sopenharmony_ci!IFNDEF INSTALL_DIR_LIB 1121cb0ef41Sopenharmony_ciINSTALL_DIR_LIB = $(INSTALL_DIR)\lib 1131cb0ef41Sopenharmony_ci!ENDIF 1141cb0ef41Sopenharmony_ci 1151cb0ef41Sopenharmony_ci!IFNDEF INSTALL_DIR_INC 1161cb0ef41Sopenharmony_ciINSTALL_DIR_INC = $(INSTALL_DIR)\include 1171cb0ef41Sopenharmony_ci!ENDIF 1181cb0ef41Sopenharmony_ci 1191cb0ef41Sopenharmony_ci# ------------------------- 1201cb0ef41Sopenharmony_ci# Configuration validation 1211cb0ef41Sopenharmony_ci# ------------------------- 1221cb0ef41Sopenharmony_ci 1231cb0ef41Sopenharmony_ciVALID_CFGSET = FALSE 1241cb0ef41Sopenharmony_ci!IF "$(CFG)" == "lib-release" || "$(CFG)" == "lib-debug" || \ 1251cb0ef41Sopenharmony_ci "$(CFG)" == "dll-release" || "$(CFG)" == "dll-debug" 1261cb0ef41Sopenharmony_ciVALID_CFGSET = TRUE 1271cb0ef41Sopenharmony_ci!ENDIF 1281cb0ef41Sopenharmony_ci 1291cb0ef41Sopenharmony_ci!IF "$(VALID_CFGSET)" == "FALSE" && "$(CFG)" != "" 1301cb0ef41Sopenharmony_ci! MESSAGE MSVC c-ares makefile 1311cb0ef41Sopenharmony_ci! MESSAGE 1321cb0ef41Sopenharmony_ci! MESSAGE Usage: nmake /f makefile.msvc CFG=<config> <target> 1331cb0ef41Sopenharmony_ci! MESSAGE 1341cb0ef41Sopenharmony_ci! MESSAGE <config> must be one of: [ lib-release | lib-debug | dll-release | dll-debug } 1351cb0ef41Sopenharmony_ci! MESSAGE <target> must be one of: [ ALL | c-ares | adig | ahost | clean } 1361cb0ef41Sopenharmony_ci! MESSAGE 1371cb0ef41Sopenharmony_ci! MESSAGE If a <target> other than ALL or clean is given, <config> becomes mandatory. 1381cb0ef41Sopenharmony_ci! MESSAGE 1391cb0ef41Sopenharmony_ci! MESSAGE If neither <config> nor <target> are specified this results in 1401cb0ef41Sopenharmony_ci! MESSAGE all targets being built for all <config> c-ares library types. 1411cb0ef41Sopenharmony_ci! MESSAGE 1421cb0ef41Sopenharmony_ci! ERROR Choose a valid configuration. 1431cb0ef41Sopenharmony_ci!ENDIF 1441cb0ef41Sopenharmony_ci 1451cb0ef41Sopenharmony_ci# -------------------------------------------------------- 1461cb0ef41Sopenharmony_ci# Project subdirs independent of configuration being used 1471cb0ef41Sopenharmony_ci# -------------------------------------------------------- 1481cb0ef41Sopenharmony_ci 1491cb0ef41Sopenharmony_ciCARES_DIR = $(BASE_DIR)\cares 1501cb0ef41Sopenharmony_ciPROG2_DIR = $(BASE_DIR)\adig 1511cb0ef41Sopenharmony_ciPROG3_DIR = $(BASE_DIR)\ahost 1521cb0ef41Sopenharmony_ci 1531cb0ef41Sopenharmony_ci# --------------------------------------------------- 1541cb0ef41Sopenharmony_ci# Subdirs which are configuration dependent are only 1551cb0ef41Sopenharmony_ci# defined when a valid configuration has been given. 1561cb0ef41Sopenharmony_ci# --------------------------------------------------- 1571cb0ef41Sopenharmony_ci 1581cb0ef41Sopenharmony_ci!IF "$(VALID_CFGSET)" == "TRUE" 1591cb0ef41Sopenharmony_ciCARES_OUTDIR = $(CARES_DIR)\$(CFG) 1601cb0ef41Sopenharmony_ciPROG2_OUTDIR = $(PROG2_DIR)\$(CFG) 1611cb0ef41Sopenharmony_ciPROG3_OUTDIR = $(PROG3_DIR)\$(CFG) 1621cb0ef41Sopenharmony_ciCARES_OBJDIR = $(CARES_OUTDIR)\obj 1631cb0ef41Sopenharmony_ciPROG2_OBJDIR = $(PROG2_OUTDIR)\obj 1641cb0ef41Sopenharmony_ciPROG3_OBJDIR = $(PROG3_OUTDIR)\obj 1651cb0ef41Sopenharmony_ci!ELSE 1661cb0ef41Sopenharmony_ci!UNDEF CARES_OUTDIR 1671cb0ef41Sopenharmony_ci!UNDEF PROG2_OUTDIR 1681cb0ef41Sopenharmony_ci!UNDEF PROG3_OUTDIR 1691cb0ef41Sopenharmony_ci!UNDEF CARES_OBJDIR 1701cb0ef41Sopenharmony_ci!UNDEF PROG2_OBJDIR 1711cb0ef41Sopenharmony_ci!UNDEF PROG3_OBJDIR 1721cb0ef41Sopenharmony_ci!ENDIF 1731cb0ef41Sopenharmony_ci 1741cb0ef41Sopenharmony_ci# ------------------------------------- 1751cb0ef41Sopenharmony_ci# Settings that depend on tcp/ip stack 1761cb0ef41Sopenharmony_ci# ------------------------------------- 1771cb0ef41Sopenharmony_ci 1781cb0ef41Sopenharmony_ci!IF "$(USE_WATT32)" == "1" 1791cb0ef41Sopenharmony_ciCFLAGS = /UWIN32 /DWATT32 /I$(WATT_ROOT)\inc 1801cb0ef41Sopenharmony_ciEX_LIBS_REL = $(WATT_ROOT)\lib\wattcpvc_imp.lib 1811cb0ef41Sopenharmony_ciEX_LIBS_DBG = $(WATT_ROOT)\lib\wattcpvc_imp_d.lib 1821cb0ef41Sopenharmony_ci!ELSE 1831cb0ef41Sopenharmony_ciCFLAGS = /DWIN32 /D_WIN32_WINNT=0x0602 1841cb0ef41Sopenharmony_ciEX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib iphlpapi.lib 1851cb0ef41Sopenharmony_ciEX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib iphlpapi.lib 1861cb0ef41Sopenharmony_ci!ENDIF 1871cb0ef41Sopenharmony_ci 1881cb0ef41Sopenharmony_ci# ------------------------------------------------- 1891cb0ef41Sopenharmony_ci# Switches that depend on ancient compiler versions 1901cb0ef41Sopenharmony_ci# ------------------------------------------------- 1911cb0ef41Sopenharmony_ci 1921cb0ef41Sopenharmony_ci!IF $(CC_VERS_NUM) == 60 1931cb0ef41Sopenharmony_ciPDB_NONE = /pdb:none 1941cb0ef41Sopenharmony_ciPDBTYPE_CONSOLIDATE = /pdbtype:consolidate 1951cb0ef41Sopenharmony_ci!ELSE 1961cb0ef41Sopenharmony_ci!UNDEF PDB_NONE 1971cb0ef41Sopenharmony_ci!UNDEF PDBTYPE_CONSOLIDATE 1981cb0ef41Sopenharmony_ci!ENDIF 1991cb0ef41Sopenharmony_ci 2001cb0ef41Sopenharmony_ci!IF $(CC_VERS_NUM) <= 70 2011cb0ef41Sopenharmony_ciRT_ERROR_CHECKING = /GZ 2021cb0ef41Sopenharmony_ci!ELSE 2031cb0ef41Sopenharmony_ciRT_ERROR_CHECKING = /RTCsu 2041cb0ef41Sopenharmony_ci!ENDIF 2051cb0ef41Sopenharmony_ci 2061cb0ef41Sopenharmony_ci# ---------------------------- 2071cb0ef41Sopenharmony_ci# Assorted commands and flags 2081cb0ef41Sopenharmony_ci# ---------------------------- 2091cb0ef41Sopenharmony_ci 2101cb0ef41Sopenharmony_ciCC_CMD_REL = cl.exe /nologo $(RTLIB) /DNDEBUG /O2 2111cb0ef41Sopenharmony_ciCC_CMD_DBG = cl.exe /nologo $(RTLIBD) /D_DEBUG /Od /Zi $(RT_ERROR_CHECKING) 2121cb0ef41Sopenharmony_ciCC_CFLAGS = $(CFLAGS) /I.\src\lib /I.\include /W3 /EHsc /FD 2131cb0ef41Sopenharmony_ci 2141cb0ef41Sopenharmony_ciRC_CMD_REL = rc.exe /l 0x409 /d "NDEBUG" 2151cb0ef41Sopenharmony_ciRC_CMD_DBG = rc.exe /l 0x409 /d "_DEBUG" 2161cb0ef41Sopenharmony_ci 2171cb0ef41Sopenharmony_ciLINK_CMD_LIB = link.exe /lib /nologo 2181cb0ef41Sopenharmony_ciLINK_CMD_DLL = link.exe /dll /nologo /incremental:no /fixed:no 2191cb0ef41Sopenharmony_ciLINK_CMD_EXE = link.exe /nologo /incremental:no /fixed:no /subsystem:console 2201cb0ef41Sopenharmony_ci 2211cb0ef41Sopenharmony_ciLINK_CMD_EXE_REL = $(LINK_CMD_EXE) /release $(PDB_NONE) 2221cb0ef41Sopenharmony_ciLINK_CMD_EXE_DBG = $(LINK_CMD_EXE) /debug $(PDBTYPE_CONSOLIDATE) 2231cb0ef41Sopenharmony_ci 2241cb0ef41Sopenharmony_ci# --------------------------------- 2251cb0ef41Sopenharmony_ci# Configuration dependent settings 2261cb0ef41Sopenharmony_ci# --------------------------------- 2271cb0ef41Sopenharmony_ci 2281cb0ef41Sopenharmony_ci!IF "$(CFG)" == "lib-release" 2291cb0ef41Sopenharmony_ciCARES_TARGET = $(STA_LIB_REL).lib 2301cb0ef41Sopenharmony_ciCARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DCARES_STATICLIB 2311cb0ef41Sopenharmony_ciCARES_LFLAGS = 2321cb0ef41Sopenharmony_ciSPROG_CFLAGS = /DCARES_STATICLIB 2331cb0ef41Sopenharmony_ciSPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_REL) $(STA_LIB_REL).lib 2341cb0ef41Sopenharmony_ciCARES_LINK = $(LINK_CMD_LIB) 2351cb0ef41Sopenharmony_ciSPROG_LINK = $(LINK_CMD_EXE_REL) 2361cb0ef41Sopenharmony_ciCC_CMD = $(CC_CMD_REL) 2371cb0ef41Sopenharmony_ci!ENDIF 2381cb0ef41Sopenharmony_ci 2391cb0ef41Sopenharmony_ci!IF "$(CFG)" == "lib-debug" 2401cb0ef41Sopenharmony_ciCARES_TARGET = $(STA_LIB_DBG).lib 2411cb0ef41Sopenharmony_ciCARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DCARES_STATICLIB /DDEBUGBUILD 2421cb0ef41Sopenharmony_ciCARES_LFLAGS = 2431cb0ef41Sopenharmony_ciSPROG_CFLAGS = /DCARES_STATICLIB 2441cb0ef41Sopenharmony_ciSPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_DBG) $(STA_LIB_DBG).lib 2451cb0ef41Sopenharmony_ciCARES_LINK = $(LINK_CMD_LIB) 2461cb0ef41Sopenharmony_ciSPROG_LINK = $(LINK_CMD_EXE_DBG) 2471cb0ef41Sopenharmony_ciCC_CMD = $(CC_CMD_DBG) 2481cb0ef41Sopenharmony_ci!ENDIF 2491cb0ef41Sopenharmony_ci 2501cb0ef41Sopenharmony_ci!IF "$(CFG)" == "dll-release" 2511cb0ef41Sopenharmony_ciCARES_TARGET = $(DYN_LIB_REL).dll 2521cb0ef41Sopenharmony_ciCARES_CFLAGS = /DCARES_BUILDING_LIBRARY 2531cb0ef41Sopenharmony_ciCARES_LFLAGS = /release $(EX_LIBS_REL) /implib:$(CARES_OUTDIR)\$(IMP_LIB_REL).lib $(PDB_NONE) 2541cb0ef41Sopenharmony_ciSPROG_CFLAGS = 2551cb0ef41Sopenharmony_ciSPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_REL) $(IMP_LIB_REL).lib 2561cb0ef41Sopenharmony_ciCARES_LINK = $(LINK_CMD_DLL) 2571cb0ef41Sopenharmony_ciSPROG_LINK = $(LINK_CMD_EXE_REL) 2581cb0ef41Sopenharmony_ciCC_CMD = $(CC_CMD_REL) 2591cb0ef41Sopenharmony_ciUSE_RES_FILE = TRUE 2601cb0ef41Sopenharmony_ciRC_CMD = $(RC_CMD_REL) 2611cb0ef41Sopenharmony_ci!ENDIF 2621cb0ef41Sopenharmony_ci 2631cb0ef41Sopenharmony_ci!IF "$(CFG)" == "dll-debug" 2641cb0ef41Sopenharmony_ciCARES_TARGET = $(DYN_LIB_DBG).dll 2651cb0ef41Sopenharmony_ciCARES_CFLAGS = /DCARES_BUILDING_LIBRARY /DDEBUGBUILD 2661cb0ef41Sopenharmony_ciCARES_LFLAGS = /debug $(EX_LIBS_DBG) /implib:$(CARES_OUTDIR)\$(IMP_LIB_DBG).lib /pdb:$(CARES_OUTDIR)\$(DYN_LIB_DBG).pdb $(PDBTYPE_CONSOLIDATE) 2671cb0ef41Sopenharmony_ciSPROG_CFLAGS = 2681cb0ef41Sopenharmony_ciSPROG_LFLAGS = /libpath:$(CARES_OUTDIR) $(EX_LIBS_DBG) $(IMP_LIB_DBG).lib 2691cb0ef41Sopenharmony_ciCARES_LINK = $(LINK_CMD_DLL) 2701cb0ef41Sopenharmony_ciSPROG_LINK = $(LINK_CMD_EXE_DBG) 2711cb0ef41Sopenharmony_ciCC_CMD = $(CC_CMD_DBG) 2721cb0ef41Sopenharmony_ciUSE_RES_FILE = TRUE 2731cb0ef41Sopenharmony_ciRC_CMD = $(RC_CMD_DBG) 2741cb0ef41Sopenharmony_ci!ENDIF 2751cb0ef41Sopenharmony_ci 2761cb0ef41Sopenharmony_ci# -------------------------------------------- 2771cb0ef41Sopenharmony_ci# Makefile.inc provides lists of source files 2781cb0ef41Sopenharmony_ci# -------------------------------------------- 2791cb0ef41Sopenharmony_ci 2801cb0ef41Sopenharmony_ci!INCLUDE .\src\lib\Makefile.inc 2811cb0ef41Sopenharmony_ci!INCLUDE .\src\tools\Makefile.inc 2821cb0ef41Sopenharmony_ci 2831cb0ef41Sopenharmony_ci# ---------------------------- 2841cb0ef41Sopenharmony_ci# Build lists of object files 2851cb0ef41Sopenharmony_ci# ---------------------------- 2861cb0ef41Sopenharmony_ci 2871cb0ef41Sopenharmony_ci!IF "$(VALID_CFGSET)" == "TRUE" 2881cb0ef41Sopenharmony_ci 2891cb0ef41Sopenharmony_ci!IF [ECHO CARES_OBJS=^$(CARES_OBJDIR)\$(CSOURCES: = $(CARES_OBJDIR^)\) > .\cares_objs.inc] == 0 2901cb0ef41Sopenharmony_ci!INCLUDE .\cares_objs.inc 2911cb0ef41Sopenharmony_ci!IF [DEL .\cares_objs.inc] 2921cb0ef41Sopenharmony_ci!ENDIF 2931cb0ef41Sopenharmony_ci!ELSE 2941cb0ef41Sopenharmony_ci!ERROR Problem generating CARES_OBJS list. 2951cb0ef41Sopenharmony_ci!ENDIF 2961cb0ef41Sopenharmony_ciCARES_OBJS = $(CARES_OBJS:.c=.obj) 2971cb0ef41Sopenharmony_ci!IF "$(USE_RES_FILE)" == "TRUE" 2981cb0ef41Sopenharmony_ciCARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res 2991cb0ef41Sopenharmony_ci!ENDIF 3001cb0ef41Sopenharmony_ci 3011cb0ef41Sopenharmony_ci!IF [ECHO PROG2_OBJS=^$(PROG2_OBJDIR)\$(SAMPLESOURCES: = $(PROG2_OBJDIR^)\) > .\prog2_objs.inc] == 0 3021cb0ef41Sopenharmony_ci!INCLUDE .\prog2_objs.inc 3031cb0ef41Sopenharmony_ci!IF [DEL .\prog2_objs.inc] 3041cb0ef41Sopenharmony_ci!ENDIF 3051cb0ef41Sopenharmony_ci!ELSE 3061cb0ef41Sopenharmony_ci!ERROR Problem generating PROG2_OBJS list. 3071cb0ef41Sopenharmony_ci!ENDIF 3081cb0ef41Sopenharmony_ciPROG2_OBJS = $(PROG2_OBJS:.c=.obj) 3091cb0ef41Sopenharmony_ciPROG2_OBJS = $(PROG2_OBJS:/=\) 3101cb0ef41Sopenharmony_ciPROG2_OBJS = $(PROG2_OBJS) $(PROG2_OBJDIR)\adig.obj 3111cb0ef41Sopenharmony_ci 3121cb0ef41Sopenharmony_ci!IF [ECHO PROG3_OBJS=^$(PROG3_OBJDIR)\$(SAMPLESOURCES: = $(PROG3_OBJDIR^)\) > .\prog3_objs.inc] == 0 3131cb0ef41Sopenharmony_ci!INCLUDE .\prog3_objs.inc 3141cb0ef41Sopenharmony_ci!IF [DEL .\prog3_objs.inc] 3151cb0ef41Sopenharmony_ci!ENDIF 3161cb0ef41Sopenharmony_ci!ELSE 3171cb0ef41Sopenharmony_ci!ERROR Problem generating PROG3_OBJS list. 3181cb0ef41Sopenharmony_ci!ENDIF 3191cb0ef41Sopenharmony_ciPROG3_OBJS = $(PROG3_OBJS:.c=.obj) 3201cb0ef41Sopenharmony_ciPROG3_OBJS = $(PROG3_OBJS:/=\) 3211cb0ef41Sopenharmony_ciPROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj 3221cb0ef41Sopenharmony_ci 3231cb0ef41Sopenharmony_ci!ENDIF 3241cb0ef41Sopenharmony_ci 3251cb0ef41Sopenharmony_ci 3261cb0ef41Sopenharmony_ci# -------------------------------- 3271cb0ef41Sopenharmony_ci# Only our custom inference rules 3281cb0ef41Sopenharmony_ci# -------------------------------- 3291cb0ef41Sopenharmony_ci 3301cb0ef41Sopenharmony_ci.SUFFIXES: 3311cb0ef41Sopenharmony_ci.SUFFIXES: .c .rc 3321cb0ef41Sopenharmony_ci 3331cb0ef41Sopenharmony_ci{$(SRCDIR)\src\lib}.rc{$(CARES_OBJDIR)}.res: 3341cb0ef41Sopenharmony_ci $(RC_CMD) /Fo $@ $< 3351cb0ef41Sopenharmony_ci 3361cb0ef41Sopenharmony_ci{$(SRCDIR)\src\lib}.c{$(CARES_OBJDIR)}.obj: 3371cb0ef41Sopenharmony_ci $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< 3381cb0ef41Sopenharmony_ci 3391cb0ef41Sopenharmony_ci{$(SRCDIR)\src\tools}.c{$(PROG2_OBJDIR)}.obj: 3401cb0ef41Sopenharmony_ci $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< 3411cb0ef41Sopenharmony_ci 3421cb0ef41Sopenharmony_ci{$(SRCDIR)\src\tools}.c{$(PROG3_OBJDIR)}.obj: 3431cb0ef41Sopenharmony_ci $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< 3441cb0ef41Sopenharmony_ci 3451cb0ef41Sopenharmony_ci# Hack Alert! we reference ../lib/ files in the Makefile.inc for tools as they 3461cb0ef41Sopenharmony_ci# share some files with the library itself. We need to hack around that here. 3471cb0ef41Sopenharmony_ci 3481cb0ef41Sopenharmony_ci{$(SRCDIR)\src\lib}.c{$(PROG2_OBJDIR)\..\lib}.obj: 3491cb0ef41Sopenharmony_ci $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\$(@F) /Fd$(PROG2_OBJDIR)\ /c $< 3501cb0ef41Sopenharmony_ci 3511cb0ef41Sopenharmony_ci{$(SRCDIR)\src\lib}.c{$(PROG3_OBJDIR)\..\lib}.obj: 3521cb0ef41Sopenharmony_ci $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG3_OBJDIR)\$(@F) /Fd$(PROG3_OBJDIR)\ /c $< 3531cb0ef41Sopenharmony_ci 3541cb0ef41Sopenharmony_ci# ------------------------------------------------------------- # 3551cb0ef41Sopenharmony_ci# ------------------------------------------------------------- # 3561cb0ef41Sopenharmony_ci# Default target when no CFG library type has been specified, # 3571cb0ef41Sopenharmony_ci# results in building target ALL for all c-ares library types. # 3581cb0ef41Sopenharmony_ci# ------------------------------------------------------------- # 3591cb0ef41Sopenharmony_ci# ------------------------------------------------------------- # 3601cb0ef41Sopenharmony_ci 3611cb0ef41Sopenharmony_ci!IF "$(VALID_CFGSET)" == "FALSE" 3621cb0ef41Sopenharmony_ci 3631cb0ef41Sopenharmony_ciALL: 3641cb0ef41Sopenharmony_ci $(MAKE) /NOLOGO /f .\Makefile.msvc CFG=lib-release ALL 3651cb0ef41Sopenharmony_ci $(MAKE) /NOLOGO /f .\Makefile.msvc CFG=lib-debug ALL 3661cb0ef41Sopenharmony_ci $(MAKE) /NOLOGO /f .\Makefile.msvc CFG=dll-release ALL 3671cb0ef41Sopenharmony_ci $(MAKE) /NOLOGO /f .\Makefile.msvc CFG=dll-debug ALL 3681cb0ef41Sopenharmony_ci 3691cb0ef41Sopenharmony_ciclean: 3701cb0ef41Sopenharmony_ci @-RMDIR /S /Q $(BASE_DIR) >NUL 2>&1 3711cb0ef41Sopenharmony_ci 3721cb0ef41Sopenharmony_ciinstall: 3731cb0ef41Sopenharmony_ci @$(MAKE) /nologo /f .\Makefile.msvc CFG=lib-release install 3741cb0ef41Sopenharmony_ci @$(MAKE) /nologo /f .\Makefile.msvc CFG=lib-debug install 3751cb0ef41Sopenharmony_ci @$(MAKE) /nologo /f .\Makefile.msvc CFG=dll-release install 3761cb0ef41Sopenharmony_ci @$(MAKE) /nologo /f .\Makefile.msvc CFG=dll-debug install 3771cb0ef41Sopenharmony_ci 3781cb0ef41Sopenharmony_ci!ENDIF 3791cb0ef41Sopenharmony_ci 3801cb0ef41Sopenharmony_ci# --------------------------------------------------------------------- 3811cb0ef41Sopenharmony_ci# Targets only available when a proper CFG library type has been given 3821cb0ef41Sopenharmony_ci# --------------------------------------------------------------------- 3831cb0ef41Sopenharmony_ci 3841cb0ef41Sopenharmony_ci!IF "$(VALID_CFGSET)" == "TRUE" 3851cb0ef41Sopenharmony_ci 3861cb0ef41Sopenharmony_ciALL: c-ares adig ahost 3871cb0ef41Sopenharmony_ci @ 3881cb0ef41Sopenharmony_ci 3891cb0ef41Sopenharmony_ci# $(HHEADERS) $(CSOURCES) 3901cb0ef41Sopenharmony_cic-ares: $(CARES_OBJDIR) $(CARES_OBJS) $(CARES_OUTDIR) 3911cb0ef41Sopenharmony_ci $(CARES_LINK) $(CARES_LFLAGS) /out:$(CARES_OUTDIR)\$(CARES_TARGET) $(CARES_OBJS) 3921cb0ef41Sopenharmony_ci! IF "$(USE_RES_FILE)" == "TRUE" 3931cb0ef41Sopenharmony_ci @if exist $(CARES_OUTDIR)\$(CARES_TARGET).manifest mt -nologo -manifest $(CARES_OUTDIR)\$(CARES_TARGET).manifest -outputresource:$(CARES_OUTDIR)\$(CARES_TARGET);2 3941cb0ef41Sopenharmony_ci! ENDIF 3951cb0ef41Sopenharmony_ci 3961cb0ef41Sopenharmony_ci# adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) 3971cb0ef41Sopenharmony_ciadig: c-ares $(PROG2_OBJDIR) $(PROG2_OBJS) $(PROG2_OUTDIR) 3981cb0ef41Sopenharmony_ci $(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG2_OUTDIR)\adig.exe $(PROG2_OBJS:..\lib=) 3991cb0ef41Sopenharmony_ci @if exist $(PROG2_OUTDIR)\adig.exe.manifest mt -nologo -manifest $(PROG2_OUTDIR)\adig.exe.manifest -outputresource:$(PROG2_OUTDIR)\adig.exe;1 4001cb0ef41Sopenharmony_ci 4011cb0ef41Sopenharmony_ci# ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS) 4021cb0ef41Sopenharmony_ciahost: c-ares $(PROG3_OBJDIR) $(PROG3_OBJS) $(PROG3_OUTDIR) 4031cb0ef41Sopenharmony_ci $(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG3_OUTDIR)\ahost.exe $(PROG3_OBJS:..\lib=) 4041cb0ef41Sopenharmony_ci @if exist $(PROG3_OUTDIR)\ahost.exe.manifest mt -nologo -manifest $(PROG3_OUTDIR)\ahost.exe.manifest -outputresource:$(PROG3_OUTDIR)\ahost.exe;1 4051cb0ef41Sopenharmony_ci 4061cb0ef41Sopenharmony_ci$(CARES_OUTDIR): $(CARES_DIR) 4071cb0ef41Sopenharmony_ci @if not exist $(CARES_OUTDIR) mkdir $(CARES_OUTDIR) 4081cb0ef41Sopenharmony_ci 4091cb0ef41Sopenharmony_ci$(PROG2_OUTDIR): $(PROG2_DIR) 4101cb0ef41Sopenharmony_ci @if not exist $(PROG2_OUTDIR) mkdir $(PROG2_OUTDIR) 4111cb0ef41Sopenharmony_ci 4121cb0ef41Sopenharmony_ci$(PROG3_OUTDIR): $(PROG3_DIR) 4131cb0ef41Sopenharmony_ci @if not exist $(PROG3_OUTDIR) mkdir $(PROG3_OUTDIR) 4141cb0ef41Sopenharmony_ci 4151cb0ef41Sopenharmony_ci$(CARES_OBJDIR): $(CARES_OUTDIR) 4161cb0ef41Sopenharmony_ci @if not exist $(CARES_OBJDIR) mkdir $(CARES_OBJDIR) 4171cb0ef41Sopenharmony_ci 4181cb0ef41Sopenharmony_ci$(PROG2_OBJDIR): $(PROG2_OUTDIR) 4191cb0ef41Sopenharmony_ci @if not exist $(PROG2_OBJDIR) mkdir $(PROG2_OBJDIR) 4201cb0ef41Sopenharmony_ci 4211cb0ef41Sopenharmony_ci$(PROG3_OBJDIR): $(PROG3_OUTDIR) 4221cb0ef41Sopenharmony_ci @if not exist $(PROG3_OBJDIR) mkdir $(PROG3_OBJDIR) 4231cb0ef41Sopenharmony_ci 4241cb0ef41Sopenharmony_ciclean: 4251cb0ef41Sopenharmony_ci @-RMDIR /S /Q $(CARES_OUTDIR) >NUL 2>&1 4261cb0ef41Sopenharmony_ci @-RMDIR /S /Q $(PROG2_OUTDIR) >NUL 2>&1 4271cb0ef41Sopenharmony_ci @-RMDIR /S /Q $(PROG3_OUTDIR) >NUL 2>&1 4281cb0ef41Sopenharmony_ci 4291cb0ef41Sopenharmony_ciinstall: 4301cb0ef41Sopenharmony_ci @if not exist $(CARES_OUTDIR)\$(CARES_TARGET) \ 4311cb0ef41Sopenharmony_ci $(MAKE) /f .\Makefile.msvc CFG=$(CFG) c-ares 4321cb0ef41Sopenharmony_ci @if not exist "$(INSTALL_DIR)" mkdir "$(INSTALL_DIR)" 4331cb0ef41Sopenharmony_ci @if not exist "$(INSTALL_DIR_LIB)" mkdir "$(INSTALL_DIR_LIB)" 4341cb0ef41Sopenharmony_ci @if not exist "$(INSTALL_DIR_INC)" mkdir "$(INSTALL_DIR_INC)" 4351cb0ef41Sopenharmony_ci @copy /y $(CARES_OUTDIR)\*.* "$(INSTALL_DIR_LIB)" >NUL 4361cb0ef41Sopenharmony_ci @copy /y $(SRCDIR)\include\ares.h "$(INSTALL_DIR_INC)" >NUL 4371cb0ef41Sopenharmony_ci @copy /y $(SRCDIR)\include\ares_build.h "$(INSTALL_DIR_INC)" >NUL 4381cb0ef41Sopenharmony_ci @copy /y $(SRCDIR)\include\ares_rules.h "$(INSTALL_DIR_INC)" >NUL 4391cb0ef41Sopenharmony_ci @copy /y $(SRCDIR)\include\ares_version.h "$(INSTALL_DIR_INC)" >NUL 4401cb0ef41Sopenharmony_ci @copy /y $(SRCDIR)\include\ares_dns_record.h "$(INSTALL_DIR_INC)" >NUL 4411cb0ef41Sopenharmony_ci @echo Installed c-ares $(CFG) 4421cb0ef41Sopenharmony_ci 4431cb0ef41Sopenharmony_ci!ENDIF 4441cb0ef41Sopenharmony_ci 4451cb0ef41Sopenharmony_ci$(BASE_DIR): 4461cb0ef41Sopenharmony_ci @if not exist $(BASE_DIR) mkdir $(BASE_DIR) 4471cb0ef41Sopenharmony_ci 4481cb0ef41Sopenharmony_ci$(CARES_DIR): $(BASE_DIR) 4491cb0ef41Sopenharmony_ci @if not exist $(CARES_DIR) mkdir $(CARES_DIR) 4501cb0ef41Sopenharmony_ci 4511cb0ef41Sopenharmony_ci$(PROG2_DIR): $(BASE_DIR) 4521cb0ef41Sopenharmony_ci @if not exist $(PROG2_DIR) mkdir $(PROG2_DIR) 4531cb0ef41Sopenharmony_ci 4541cb0ef41Sopenharmony_ci$(PROG3_DIR): $(BASE_DIR) 4551cb0ef41Sopenharmony_ci @if not exist $(PROG3_DIR) mkdir $(PROG3_DIR) 4561cb0ef41Sopenharmony_ci 4571cb0ef41Sopenharmony_ci# End of Makefile.msvc 458