281 lines
9.2 KiB
Plaintext
281 lines
9.2 KiB
Plaintext
# MSVC/clang-cl compiler defaults
|
|
|
|
CMPLR_CLASS = msvc
|
|
|
|
OPT_WHOLE_PROGRAM = YES
|
|
|
|
#-------------------------------------------------------
|
|
|
|
WINLINK = link
|
|
|
|
RCCMD = $(MSVC_PREFIX)rc$(MSVC_SUFFIX) -nologo -l 0x409 $(INCLUDES) -fo $@ $<
|
|
|
|
ARCMD = $(MSVC_PREFIX)lib$(MSVC_SUFFIX) -nologo -verbose -out:$@ $(LIB_OPT_LDFLAGS) $(LIBRARY_LD_OBJS)
|
|
|
|
#
|
|
# Configure OS vendor C compiler
|
|
CC = cl
|
|
|
|
# OS vendor c preprocessor
|
|
CPP = $(CC) -nologo -C -E
|
|
|
|
# Configure OS vendor C++ compiler
|
|
#
|
|
# -EHsc - generate code for exceptions
|
|
# -GR - generate code for run time type identification
|
|
#
|
|
CCC = $(CC) -EHsc -GR
|
|
|
|
# Override CONFIG.gnuCommon settings for cross builds.
|
|
GNU = NO
|
|
HDEPENDS_METHOD = MKMF
|
|
|
|
# Compiler flags for C files (C++ is below)
|
|
|
|
#
|
|
# -W<d> display warnings at level d
|
|
# -W4 is for maximum (lint type) warnings
|
|
# -W3 is for production quality warnings
|
|
# -W2 displays significant warnings
|
|
# -W1 is the default and shows severe warnings only
|
|
# -w<d><n> Set warning C<n> to be shown at level <d>
|
|
WARN_CFLAGS_YES = -W3
|
|
WARN_CFLAGS_NO = -W1
|
|
|
|
#
|
|
# -Ox maximum optimizations
|
|
# -GL whole program optimization
|
|
# -Oy- re-enable creation of frame pointers
|
|
OPT_CFLAGS_YES_YES = -Ox -GL -Oy-
|
|
OPT_CFLAGS_YES_NO = -Ox -Oy-
|
|
OPT_CFLAGS_YES = $(OPT_CFLAGS_YES_$(OPT_WHOLE_PROGRAM))
|
|
|
|
#
|
|
# -Z7 generate C7 compatible debugging information (inside .obj)
|
|
# -RTCsu enable run-time error checks
|
|
OPT_CFLAGS_NO = -Z7 -RTCsu
|
|
|
|
# specify object file name and location
|
|
OBJ_CFLAG = -Fo
|
|
|
|
#
|
|
# the following options are required when
|
|
# vis c++ compiles the code (and includes
|
|
# the header files)
|
|
#
|
|
# -MT static multithreaded C RTL
|
|
# -MTd static multithreaded C RTL (debug version)
|
|
# -MD multithreaded C RTL in DLL
|
|
# -MDd multithreaded C RTL in DLL (debug version)
|
|
BUILD_DLL_CFLAGS_NO =
|
|
BUILD_DLL_CFLAGS_YES = -DEPICS_BUILD_DLL
|
|
BUILD_DLL_CFLAGS = $(BUILD_DLL_CFLAGS_$(SHARED_LIBRARIES))
|
|
VISC_CFLAGS_DEBUG_NO = d
|
|
VISC_CFLAGS_DEBUG_YES =
|
|
VISC_CFLAGS_DEBUG = $(VISC_CFLAGS_DEBUG_$(HOST_OPT))
|
|
STATIC_CFLAGS_YES= -MT$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS)
|
|
STATIC_CFLAGS_NO= -MD$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS) -DEPICS_CALL_DLL
|
|
|
|
# Other compiler flags, used for CPP, C and C++
|
|
#
|
|
# -FC - Show absolute path of source file in diagnostics
|
|
# -D__STDC__=0 gives us both:
|
|
# 1) define STDC for code (pretend ANSI conformance)
|
|
# 2) set it to 0 to use MS C "extensions" (open for _open etc.)
|
|
# because MS uses: if __STDC__ ... disable many nice things
|
|
#
|
|
CODE_CPPFLAGS += -nologo -FC -D__STDC__=0
|
|
CODE_CPPFLAGS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
|
|
|
|
# Compiler flags for C++ files
|
|
|
|
#
|
|
# -W<n> disable warnings from levels > n
|
|
# -w<n><m> set warning m to level n
|
|
# -w44355 "'this' used in the base initializer list"
|
|
# -w44344 "behavior change: use of explicit template arguments results in ..."
|
|
# -w44251 "class needs to have dll-interface to be used by clients of ..."
|
|
WARN_CXXFLAGS_YES = -W3 -w44355 -w44344 -w44251
|
|
WARN_CXXFLAGS_NO = -W1
|
|
|
|
# Silence tr1 namespace deprecation warnings
|
|
WARN_CXXFLAGS += -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
|
|
|
|
#
|
|
# -Ox maximum optimizations
|
|
# -GL whole program optimization
|
|
# -Oy- re-enable creation of frame pointers
|
|
OPT_CXXFLAGS_YES_YES = -Ox -GL -Oy-
|
|
OPT_CXXFLAGS_YES_NO = -Ox -Oy-
|
|
OPT_CXXFLAGS_YES = $(OPT_CXXFLAGS_YES_$(OPT_WHOLE_PROGRAM))
|
|
|
|
#
|
|
# -Z7 generate C7 compatible debugging information (inside .obj)
|
|
# -RTCsu enable run-time error checks
|
|
OPT_CXXFLAGS_NO = -RTCsu -Z7
|
|
|
|
# specify object file name and location
|
|
OBJ_CXXFLAG = -Fo
|
|
|
|
#
|
|
# the following options are required when
|
|
# vis c++ compiles the code (and includes
|
|
# the header files)
|
|
#
|
|
# -MT static multithreaded C RTL
|
|
# -MTd static multithreaded C RTL (debug version)
|
|
# -MD multithreaded C RTL in DLL
|
|
# -MDd multithreaded C RTL in DLL (debug version)
|
|
STATIC_CXXFLAGS_YES= -MT$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS)
|
|
STATIC_CXXFLAGS_NO= -MD$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS) -DEPICS_CALL_DLL
|
|
|
|
STATIC_LDLIBS_YES=ws2_32.lib advapi32.lib user32.lib kernel32.lib winmm.lib dbghelp.lib
|
|
STATIC_LDLIBS_NO=
|
|
STATIC_LDFLAGS=
|
|
RANLIB=
|
|
|
|
# add -profile here to run the ms profiler
|
|
# -LTCG whole program optimization
|
|
# -incremental:no full linking
|
|
# -fixed:no generate relocatable code
|
|
# -version:<major>.<minor> - only 2 components allowed, 0-65535 each
|
|
# -debug generate debugging info
|
|
LINK_OPT_FLAGS_WHOLE_YES = -LTCG
|
|
LINK_OPT_FLAGS_YES = $(LINK_OPT_FLAGS_WHOLE_$(OPT_WHOLE_PROGRAM))
|
|
LINK_OPT_FLAGS_YES += -incremental:no -opt:ref
|
|
LINK_OPT_FLAGS_YES += -release $(PROD_VERSION:%=-version:%)
|
|
LINK_OPT_FLAGS_NO = -debug -incremental:no -fixed:no
|
|
OPT_LDFLAGS = $(LINK_OPT_FLAGS_$(HOST_OPT))
|
|
|
|
LIB_OPT_FLAGS_YES = $(LINK_OPT_FLAGS_WHOLE_$(OPT_WHOLE_PROGRAM))
|
|
LIB_OPT_LDFLAGS = $(LIB_OPT_FLAGS_$(HOST_OPT))
|
|
|
|
ARCH_DEP_CFLAGS=
|
|
SHRLIB_CFLAGS=
|
|
|
|
OS_CLASS=WIN32
|
|
POSIX=NO
|
|
|
|
# ifdef WIN32 looks better that ifeq ($(OS_CLASS),WIN32) ??
|
|
WIN32=1
|
|
|
|
EXE=.exe
|
|
OBJ=.obj
|
|
RES=.res
|
|
|
|
# MS Visual C++ doesn't recognize *.cc as a C++ source file,
|
|
# so C++ compiles get the flag -TP
|
|
COMPILER_CXXFLAGS = -TP
|
|
|
|
# Operating system flags
|
|
OP_SYS_CFLAGS =
|
|
OP_SYS_CXXFLAGS = $(COMPILER_CXXFLAGS)
|
|
|
|
# Files and flags needed to link DLLs (used in RULES_BUILD)
|
|
WIN32_DLLFLAGS = -subsystem:windows -dll $(OPT_LDFLAGS) \
|
|
$(USR_LDFLAGS) $(CMD_LDFLAGS) $(TARGET_LDFLAGS) $(LIB_LDFLAGS)
|
|
|
|
# Specify dll .def file only if it exists
|
|
DLL_DEF_FLAG = $(addprefix -def:,$(wildcard ../$(addsuffix .def,$*)))
|
|
|
|
# A WIN32 dll has three parts:
|
|
# x.dll: the real dll (SHRLIBNAME)
|
|
# x.lib: what you link to progs that use the dll (DLLSTUB_LIBNAME)
|
|
# x.exp: what you need to build the dll (in no variable)
|
|
LINK.shrlib = $(WINLINK) -nologo $(WIN32_DLLFLAGS) -out:$@ \
|
|
-implib:$(@:%$(SHRLIB_SUFFIX)=%$(LIB_SUFFIX)) \
|
|
$(DLL_DEF_FLAG) $(LIBRARY_LD_OBJS) $(LIBRARY_LD_RESS) $(SHRLIB_LDLIBS)
|
|
|
|
# Adjust names of libraries to build
|
|
SHRLIB_SUFFIX_BASE = .dll
|
|
SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE)
|
|
SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX))
|
|
LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX))
|
|
TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(SHRLIB_SUFFIX_BASE))
|
|
|
|
# When SHARED_LIBRARIES is YES we are building a DLL shared library.
|
|
# When SHARED_LIBRARIES is NO we are building an object library
|
|
DLLSTUB_SUFFIX = .lib
|
|
DLLSTUB_LIBNAME_YES = $(BUILD_LIBRARY:%=%.lib)
|
|
DLLSTUB_LIBNAME = $(DLLSTUB_LIBNAME_$(SHARED_LIBRARIES))
|
|
TESTDLLSTUB_LIBNAME_YES = $(TESTBUILD_LIBRARY:%=%.lib)
|
|
TESTDLLSTUB_LIBNAME = $(TESTDLLSTUB_LIBNAME_$(SHARED_LIBRARIES))
|
|
|
|
LIB_PREFIX=
|
|
LIB_SUFFIX=.lib
|
|
LIBNAME_NO = $(BUILD_LIBRARY:%=%.lib)
|
|
LIBNAME = $(LIBNAME_$(SHARED_LIBRARIES))
|
|
TESTLIBNAME_NO = $(TESTBUILD_LIBRARY:%=%.lib)
|
|
TESTLIBNAME = $(TESTLIBNAME_$(SHARED_LIBRARIES))
|
|
|
|
# dll install location
|
|
INSTALL_SHRLIB = $(INSTALL_BIN)
|
|
|
|
|
|
#--------------------------------------------------
|
|
# Products dependancy definitions
|
|
|
|
PROD_DEPLIBS = $(foreach lib, $(PROD_LIBS) $(USR_LIBS), \
|
|
$(firstword $(wildcard \
|
|
$(addsuffix /$(DLLSTUB_PREFIX)$(lib)$(DLLSTUB_SUFFIX), \
|
|
$($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \
|
|
$(addsuffix /$(SHRLIB_PREFIX)$(lib)*$(SHRLIB_SUFFIX_BASE)*, \
|
|
$($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \
|
|
$(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \
|
|
$($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \
|
|
) $(addsuffix /$(BUILDLIB_PREFIX)$(lib)$(BUILDLIB_SUFFIX), \
|
|
$(if $(filter $(lib),$(TESTLIBRARY)),.,$(INSTALL_LIB)))))
|
|
|
|
|
|
PROD_LDLIBS += $($*_DEPLIBS) $(PROD_DEPLIBS)
|
|
PROD_LDLIBS += $(addsuffix .lib, \
|
|
$($*_SYS_LIBS) $(PROD_SYS_LIBS) $(USR_SYS_LIBS))
|
|
|
|
LDLIBS_STATIC_YES = LDLIBS
|
|
LDLIBS_SHARED_NO = LDLIBS
|
|
PROD_LDLIBS += $(STATIC_LDLIBS) \
|
|
$($(firstword $(LDLIBS_STATIC_$(STATIC_BUILD)) \
|
|
$(LDLIBS_SHARED_$(SHARED_LIBRARIES))))
|
|
|
|
#--------------------------------------------------
|
|
# Libraries dependancy definitions
|
|
|
|
# libs that we need to link the DLL with
|
|
# (it isnt necessary to rebuild the dll if these change)
|
|
|
|
SHRLIB_DEPLIBS = $(foreach lib, $(LIB_LIBS) $(USR_LIBS), \
|
|
$(firstword $(wildcard \
|
|
$(addsuffix /$(DLLSTUB_PREFIX)$(lib)$(DLLSTUB_SUFFIX), \
|
|
$($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \
|
|
$(addsuffix /$(SHRLIB_PREFIX)$(lib)*$(SHRLIB_SUFFIX_BASE)*, \
|
|
$($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \
|
|
$(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \
|
|
$($(lib)_DIR) $(SHRLIB_SEARCH_DIRS)) \
|
|
) $(addsuffix /$(BUILDLIB_PREFIX)$(lib)$(BUILDLIB_SUFFIX), \
|
|
$(if $(filter $(lib),$(TESTLIBRARY)),.,$(INSTALL_LIB)))))
|
|
|
|
|
|
SHRLIB_LDLIBS += $($*_DLL_DEPLIBS) $($*_DEPLIBS) $(SHRLIB_DEPLIBS)
|
|
SHRLIB_LDLIBS += $(addsuffix .lib, \
|
|
$($*_SYS_DLL_LIBS) \
|
|
$($*_SYS_LIBS) $(LIB_SYS_LIBS) $(USR_SYS_LIBS) )
|
|
|
|
#--------------------------------------------------
|
|
# Linker definition
|
|
LINK.cpp = $(WINLINK) -nologo $(STATIC_LDFLAGS) $(LDFLAGS) $(PROD_LDFLAGS) \
|
|
-out:$@ $(PROD_LD_OBJS) $(PROD_LD_RESS) $(PROD_LDLIBS)
|
|
|
|
#--------------------------------------------------
|
|
# UseManifestTool.pl checks MS Visual c++ compiler version number to
|
|
# decide whether or not to use the Manifest Tool command to embed the
|
|
# linker created .manifest file into a library or product target.
|
|
# useManifestTool.pl returns 0(don't use) or 1(use).
|
|
#
|
|
MT.exe = $(MSVC_PREFIX)mt$(MSVC_SUFFIX) -nologo -manifest $@.manifest
|
|
MT_DLL_COMMAND1 = $(MT.exe) "-outputresource:$@;\#2"
|
|
MT_EXE_COMMAND_YES =
|
|
MT_EXE_COMMAND_NO = $(MT.exe) "-outputresource:$@;\#1"
|
|
MT_EXE_COMMAND1 = $(MT_EXE_COMMAND_$(STATIC_BUILD))
|
|
MT_DLL_COMMAND = $(MT_DLL_COMMAND$(shell $(PERL) $(TOOLS)/useManifestTool.pl))
|
|
MT_EXE_COMMAND = $(MT_EXE_COMMAND$(shell $(PERL) $(TOOLS)/useManifestTool.pl))
|