61f979d4eb3693ee5738fd296e91c6ebe5fd0d5b
[platform/upstream/atk.git] / win32 / detectenv-msvc.mak
1 # Common NMake Makefile module for checking the build environment
2 # This can be copied from $(glib_srcroot)\build\win32 for GNOME items
3 # that support MSVC builds and introspection under MSVC, and can be used
4 # for building test programs as well.
5
6 # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
7 # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
8 !if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
9 MSG = ^
10 This Makefile is only for Visual Studio 2008 and later.^
11 You need to ensure that the Visual Studio Environment is properly set up^
12 before running this Makefile.
13 !error $(MSG)
14 !endif
15
16 ERRNUL  = 2>NUL
17 _HASH=^#
18
19 !if ![echo VCVERSION=_MSC_VER > vercl.x] \
20     && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
21     && ![echo PLAT=Win32 >> vercl.x] \
22     && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
23     && ![echo PLAT=x64 >> vercl.x] \
24     && ![echo $(_HASH)endif >> vercl.x] \
25     && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
26 !include vercl.i
27 !if ![echo VCVER= ^\> vercl.vc] \
28     && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
29 !include vercl.vc
30 !endif
31 !endif
32 !if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
33 !endif
34
35 !if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
36 VSVER = 9
37 !elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
38 VSVER = 10
39 !elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
40 VSVER = 11
41 !elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
42 VSVER = 12
43 !elseif $(VCVERSION) > 1899 && $(VCVERSION) < 2000
44 VSVER = 14
45 !else
46 VSVER = 0
47 !endif
48
49 !if "$(VSVER)" == "0"
50 MSG = ^
51 This NMake Makefile set supports Visual Studio^
52 9 (2008) through 14 (2015).  Your Visual Studio^
53 version is not supported.
54 !error $(MSG)
55 !endif
56
57 VALID_CFGSET = FALSE
58 !if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug"
59 VALID_CFGSET = TRUE
60 !endif
61
62 # We want debugging symbols logged for all builds,
63 # using .pdb files for release builds
64 CFLAGS_BASE = /Zi
65
66 !if "$(CFG)" == "release" || "$(CFG)" == "Release"
67 CFLAGS_ADD = /MD /O2 $(CFLAGS_BASE)
68 !else
69 CFLAGS_ADD = /MDd /Od $(CFLAGS_BASE)
70 !endif
71
72 !if "$(PLAT)" == "x64"
73 LDFLAGS_ARCH = /machine:x64
74 !else
75 LDFLAGS_ARCH = /machine:x86
76 !endif