minor changes
[public/netxms.git] / Makefile.inc.w32
CommitLineData
64a055a2
VK
1# Common settings for Win32 builds
2
48e08d41
VK
3CC=cl
4CXX=cl
5LD=link
6MAKE=nmake
64a055a2
VK
7
8# Source base path
48e08d41 9#BASE_PATH := $(dir $(lastword $(MAKEFILE_LIST)))
64a055a2
VK
10
11# Architecture
48e08d41
VK
12!ifndef ARCH
13ARCH=x64
14!endif
15
16!if "$(ARCH)"=="x64"
17WINDDK_ARCH=amd64
18WINSDK_LIB=Lib\x64
19WINSDK_BIN=Bin\x64
20OBJDIR=amd64
21!endif
22
23!if "$(ARCH)"=="x86"
24WINDDK_ARCH=i386
25WINSDK_LIB=Lib
26WINSDK_BIN=Bin
27OBJDIR=i386
28!endif
64a055a2
VK
29
30# SDK locations
48e08d41
VK
31#-include ${BASE_PATH}winsdk.inc
32
33!ifndef VCBUILD_BASE
34VCBUILD_BASE=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
35!endif
36!ifndef WINSDK_BASE
37WINSDK_BASE=C:\SDK\Windows 7 SDK
38!endif
39!ifndef WINDDK_BASE
40WINDDK_BASE=C:\SDK\WinDDK
41!endif
42!ifndef OPENSSL_BASE
43OPENSSL_BASE=C:\SDK\OpenSSL
44!endif
64a055a2
VK
45
46# Common C/C++ compiler flags
48e08d41
VK
47CPPFLAGS=$(CPPFLAGS) /O2 /Gd -I "$(BASE_PATH)include" -I "$(WINSDK_BASE)\include" -I "$(VCBUILD_BASE)\include" \
48 -I "$(OPENSSL_BASE)\$(ARCH)\include" \
64a055a2 49 -D_MT -DUNICODE
64a055a2
VK
50
51# Common linker flags
48e08d41
VK
52!if "$(TYPE)"=="dll"
53IMPLIB=$(TARGET:.dll=.lib)
54LDFLAGS=$(LDFLAGS) -dll -implib:$(IMPLIB)
55!endif
56MANIFEST=$(TARGET).intermediate.manifest
57LDFLAGS=$(LDFLAGS) -subsystem:windows -machine:$(ARCH) -manifestfile:$(MANIFEST) -libpath:"$(OPENSSL_BASE)\$(ARCH)\lib" -libpath:"$(WINDDK_BASE)\lib\wnet\$(WINDDK_ARCH)" -libpath:"$(WINSDK_BASE)\$(WINSDK_LIB)"
64a055a2
VK
58
59# Common libraries
48e08d41 60LIBS=$(LIBS) ssleay32.lib libeay32.lib uuid.lib kernel32.lib user32.lib advapi32.lib shell32.lib
64a055a2
VK
61
62# Prepare list of object files
48e08d41
VK
63__sources=$(SOURCES:.cpp=.obj)
64OBJ=$(__sources:.c=.obj)
65
66# Source directory
67SRCDIR=$(MAKEDIR)
68
69all: subdirs $(GENERATED) $(TARGET)
70
71# Build target
72!ifdef TARGET
64a055a2 73
48e08d41
VK
74$(TARGET): objdir $(OBJ)
75 $(LD) $(LDFLAGS) /out:$(TARGET) $(OBJ) $(LIBS)
76 rm -f $(MANIFEST)
64a055a2 77
48e08d41 78.PHONY: objdir
64a055a2 79
48e08d41
VK
80objdir:
81 @if not exist $(OBJDIR) mkdir $(OBJDIR)
82 @cd $(OBJDIR)
64a055a2 83
48e08d41
VK
84{$(SRCDIR)}.c.obj:
85 $(CC) $(CPPFLAGS) $(CFLAGS) /c $< /Fo$@
86
87{$(SRCDIR)}.cpp.obj:
88 $(CXX) $(CPPFLAGS) $(CXXFLAGS) /c $< /Fo$@
64a055a2
VK
89
90messages.cpp: messages.mc
48e08d41
VK
91 $(MC) $< -cpp
92
93!endif
64a055a2 94
48e08d41 95# Clean
64a055a2 96clean:
48e08d41 97 rm -f $(OBJ) $(TARGET) $(GENERATED) $(EXTRA_CLEAN)
64a055a2
VK
98
99# Sub-directories building rules
48e08d41
VK
100.PHONY: subdirs
101
102subdirs:
103 @for %%s in ($(SUBDIRS)) do @( \
104 echo === Entering %%s === && \
105 cd %%s && \
106 $(MAKE) /NOLOGO /F Makefile.w32 && \
107 echo === Leaving %%s === \
108 )