#ident "@(#)cc-msc.rul	1.26 14/04/03 "
###########################################################################
# Written 2006-2014 by J. Schilling
###########################################################################
#
# Platform dependent MACROS for CYGWIN32_NT using MSVC
#
###########################################################################
# Copyright (c) J. Schilling
###########################################################################
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# See the file CDDL.Schily.txt in this distribution for details.
# A copy of the CDDL is also available via the Internet at
# http://www.opensource.org/licenses/cddl1.txt
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file CDDL.Schily.txt from this distribution.
###########################################################################

CPPFLAGS=	-DSCHILY_BUILD $(CPPOPTS) $(CPPOPTX) $(OSINCDIRS:%=-I%) $(OSDEFS) $(OSDEFSX)
CFLAGS=		$(COPTS) $(CWARNOPTS) $(COPTOPT) $(MSCOPTOPT) $(COPTX)
C++FLAGS=	$(C++OPTS) $(C++WARNOPTS) $(C++OPTOPT) $(MSC++OPTOPT) $(C++OPTX)

CPPOPTS=	-I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(INCDIRSX:%=-I%)
COPTS=
CWOPTS=		-W3
COPTOPT=	-O2
COPTDYN=
#COPTGPROF=	-pg
#
# /EHs C++-EH aktivieren (ohne SEH-Ausnahmen)
# /EHa C++-EH aktivieren (mit SEH-Ausnahmen)
# /EHc nothrow als Standard fr externes "C"
# MS seems to need -EHsc in order to create useful code with exceptions
#
C++OPTS=	-EHsc
C++WOPTS=	-W3
C++OPTOPT=	-O2
C++OPTDYN=
#C++OPTGPROF=	-pg


LIB_PREFIX=
LIB_SUFFIX=	.lib
SHL_SUFFIX=	.dll

#LIBS_PATH=	-libpath:$(OLIBSDIR)
#LIBS_PATH_STATIC= -libpath:$(OLIBSDIR_STATIC) 
LIBS_PATH=	-L$(OLIBSDIR)
LIBS_PATH_STATIC= -L$(OLIBSDIR_STATIC) 

WIN_LIBS=	$(WIN32_LIBS)

LDFLAGS=	$(LDOPTS) $(LDOPTX)
LDLIBS=		$(LIBS:-l%=%.lib) $(LIBX:-l%=%.lib) $(WIN_LIBS:-l%=%.lib)

#LDOPTS=		$(LIBS_PATH) $(LDPATH) $(RUNPATH)
#LDOPTS=		-link $(LIBS_PATH) $(LDPATH)
LDOPTS=		-link $(LIBS_PATH:-L%=-libpath:%) $(LDPATH:-L%=-libpath:%)
#LDOPTDYN=	-shared -Wl,-soname,$(TARGET)
LDOPTDYN=	-dll -def:$(TARGETLIB).def
LNDYNLIB=	@

FLOAT_OPTIONS=	

__CC_COM=	$(_UNIQ)$(CC)
___CC_COM=	$(__CC_COM:$(_UNIQ)=$(CC_COM_DEF))
CC_COM=		$(___CC_COM:$(_UNIQ)%=%)

__CC++_COM=	$(_UNIQ)$(CCC)
___CC++_COM=	$(__CC++_COM:$(_UNIQ)=$(CC++_COM_DEF))
CC++_COM=	$(___CC++_COM:$(_UNIQ)%=%)

CC_COM_DEF=	cl.exe
CC++_COM_DEF=	$(CC_COM_DEF)
CC=		$(CC_COM_DEF)
CCC=		$(CC++_COM_DEF)

CCCC=		@echo "	==> COMPILING \"$@\""; $(CC_COM) -nologo
CC++ =		@echo "	==> COMPILING \"$@\""; $(CC++_COM) -nologo
OUTPUT_OPTION=	-Fo$(O:%=%/)$@
CC_OUTPUT_FILTER= | tail -n +2	# Filter cl.exe filename echo
LD_OUTPUT_OPTION= -Fe$@
LDCC=		@echo "	==> LINKING \"$@\""; $(CC_COM) -nologo
LDCC++ =	@echo "	==> LINKING \"$@\""; $(CC++_COM) -nologo
DYNLD=		@echo "	==> LINKING dynamic library \"$@\""; $(CC_COM) -nologo
DYNLDC++ =	@echo "	==> LINKING dynamic library \"$@\""; $(CC++_COM) -nologo
DYNLD.o=	$(DYNLD) `$(LORDER) $(POFILES) | $(TSORT)` $(LDFLAGS) -out:$@ $(LDLIBS)

RANLIB=		@echo "	==> RANDOMIZING ARCHIVE \"$@\""; true
AR=		@echo "	==> ARCHIVING  \"$@\""; lib.exe -nologo
ARFLAGS=
AR.o=		$(AR) $(ARFLAGS) -out:$@

RMDEP=		:
MKDEP=		@echo "	==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); sh $(SRCROOT)/conf/mkdep-msc.sh
MKDEP_OUT=
MKC++DEP=	@echo "	==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); sh $(SRCROOT)/conf/mkdep-msc.sh
MKC++DEP_OUT=

VC=7

_VC_SETUP=	$(_UNIQ)$(VC_SETUP)
__VC_SETUP=	$(_VC_SETUP:$(_UNIQ)=vc$(VC)$(_PLATFORM:%=-%)-setup)
VCSETUP=	$(__VC_SETUP:$(_UNIQ)%=%)

###########################################################################
# IMPORTANT Note:
# We also include $(DEFLTSROOT)/$(DEFLTSDIR)/$(VCSETUP) from Defaults.*
# in order to be able to test for the existence of "cl.exe" early.
###########################################################################
include		$(DEFLTSROOT)/$(DEFLTSDIR)/$(VCSETUP)

OSDEFS	+=	$(WINNTDEFS)

#
# Tell MKLINKS to copy files instead of linking them
#
MKLINKS_COPY=	true
export		MKLINKS_COPY
