# -*- mode: makefile -*-
#
# Makefile of ROOT for Windows with MS Visual C++ compiler in Cygwin environment

PLATFORM      = win32

DEBUGFLAGS    = -Z7
OPTFLAGS      = -O2
ifeq (debug,$(findstring debug,$(ROOTBUILD)))
OPT           = $(DEBUGFLAGS)
LDOPT         = -debug -pdb:none
F77OPT        = -debug -nopdbfile
NOOPT         =
else
OPT           = $(OPTFLAGS)
LDOPT         = -pdb:none
#LDOPT         = -opt:ref -pdb:none
F77OPT        = -optimize:0 -nopdbfile -recursive
NOOPT         =
endif

# Compiler:
CXX           = build/win/cxx.sh
CC            = build/win/cc.sh
CXXFLAGS      = -G5 -GR -GX -MD -DWIN32 -D_WINDOWS -DWINVER=0x0400 \
                -nologo -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -FIw32pragma.h \
                -D_X86_=1 -D_DLL -DVISUAL_CPLUSPLUS $(EXTRA_CXXFLAGS)
CFLAGS        = -G5 -MD -DWIN32 -D_WINDOWS -DWINVER=0x0400 -FIsehmap.h \
                -nologo -D_X86_=1 -D_DLL -DVISUAL_CPLUSPLUS $(EXTRA_CFLAGS)
CINTCXXFLAGS  = -G5 -GR -GX -MD -DWIN32 -D_WIN32 -D_WINDOWS \
                -DWINVER=0x0400 -nologo -DCRTAPI1=_cdecl \
                -DCRTAPI2=_cdecl -D_X86_=1 -D_DLL -DVISUAL_CPLUSPLUS -DG__REDIRECTIO \
                -DG__SHAREDLIB -DG__UNIX -DG__ROOT -DG__WIN32 $(EXTRA_CXXFLAGS)
CINTCFLAGS    = -G5 -MD -DWIN32 -D_WIN32 -D_WINDOWS -DWINVER=0x0400 \
                -FIsehmap.h -nologo -D_X86_=1 -D_DLL -DVISUAL_CPLUSPLUS -DG__REDIRECTIO \
                -DG__SHAREDLIB -DG__UNIX -DG__ROOT -DG__WIN32 $(EXTRA_CXXFLAGS)

# Compiler version:
VC_MAJOR     := $(shell $(CXX) 2>&1 | awk '{ if (NR==1) print $$8 }' | \
                cut -d'.' -f1)
VC_MINOR     := $(shell $(CXX) 2>&1 | awk '{ if (NR==1) print $$8 }' | \
                cut -d'.' -f2)

# 1310 is VC++.NET
ifeq ($(VC_MAJOR),13)
ifeq ($(VC_MINOR),10)
CINTCXXFLAGS += -DG__NEWSTDHEADER
CINTCFLAGS   += -DG__NEWSTDHEADER
endif
endif

# Linker:
LD            = build/win/ld.sh
LDFLAGS       = -nologo -incremental:no $(LDOPT) $(EXTRA_LDFLAGS) $(LDNODEF)
LDNODEF       = -nodefaultlib:libc.lib -nodefaultlib:dfor.lib
SOFLAGS       = -DLL
SOEXT         = dll
EXEEXT        = .exe

# System libraries:
SYSLIBS       = advapi32.lib
XLIBS         =
CILIBS        =
CRYPTLIBS     =

# Fortran:
F77           = build/win/f77.sh
F77FLAGS      = -nologo -4Nportlib -G5 -MD -recursive
F77LD         = $(F77)
F77LDFLAGS    = $(F77FLAGS) $(F77OPT) -link $(LDFLAGS)
F77LIBS       =

# Extras
