fixed bug in housekeeper hook call
[public/netxms.git] / Makefile.inc.w32
CommitLineData
64a055a2 1# Common settings for Win32 builds
bf826019
VK
2# This makefile expects that path to build tools and environment variables
3# LIB and INCLUDE for target architecture set before running make
4# They can be set using build\msvc_setenv_* scripts
64a055a2 5
7cf94f18
VK
6CC = cl
7CXX = cl
8LD = link
9PERL = perl
10LEX = flex
11YACC = bison
12MC = mc
64a055a2
VK
13
14# Source base path
7cf94f18
VK
15# Default location is C:\Source\NetXMS
16# It can be changed by setting NETXMS_BASE environment variable
17!ifndef NETXMS_BASE
18NETXMS_BASE = C:\Source\NetXMS
19!endif
64a055a2
VK
20
21# Architecture
48e08d41 22!ifndef ARCH
7cf94f18 23ARCH = x64
48e08d41
VK
24!endif
25
7cf94f18
VK
26!if "$(ARCH)" == "x64"
27WINDDK_ARCH = amd64
7cf94f18 28OBJDIR = amd64
48e08d41
VK
29!endif
30
7cf94f18
VK
31!if "$(ARCH)" == "x86"
32WINDDK_ARCH = i386
7cf94f18 33OBJDIR = i386
48e08d41 34!endif
64a055a2
VK
35
36# SDK locations
48e08d41 37!ifndef WINDDK_BASE
7cf94f18 38WINDDK_BASE = C:\SDK\WinDDK
48e08d41
VK
39!endif
40!ifndef OPENSSL_BASE
7cf94f18
VK
41OPENSSL_BASE = C:\SDK\OpenSSL
42!endif
bf826019
VK
43!ifndef CURL_BASE
44CURL_BASE = C:\SDK\cURL
45!endif
8b27778f
VK
46!ifndef JDK_BASE
47JDK_BASE = C:\Program Files\Java\jdk1.8.0_121
48!endif
7cf94f18
VK
49
50# Binaries directory
d9654419
VK
51NETXMS_LIBDIR = $(NETXMS_BASE)\bin\$(OBJDIR)
52BINDIR = $(NETXMS_LIBDIR)
bf826019 53
d9654419 54# Component specific settings
bf826019
VK
55!if "$(COMPONENT)" == "server"
56CPPFLAGS = $(CPPFLAGS) /I "$(NETXMS_BASE)\src\server\include"
57!endif
64a055a2 58
d9654419 59# Target specific settings
7cf94f18
VK
60!if "$(TYPE)" == "dll"
61CPPFLAGS = $(CPPFLAGS) /D_USRDLL
62IMPLIB = $(BINFILE:.dll=.lib)
63LDFLAGS = $(LDFLAGS) /DLL /IMPLIB:$(IMPLIB)
64!endif
65!if "$(TYPE)" == "ddr"
66CPPFLAGS = $(CPPFLAGS) /D_USRDLL
67LDFLAGS = $(LDFLAGS) /DLL
48e08d41 68!endif
d9654419
VK
69!if "$(TYPE)" == "ndd"
70BINDIR = $(BINDIR)\ndd
71CPPFLAGS = $(CPPFLAGS) /D_USRDLL
72LDFLAGS = $(LDFLAGS) /DLL
73!endif
7cf94f18
VK
74!if "$(TYPE)" == "nsm"
75CPPFLAGS = $(CPPFLAGS) /D_USRDLL
76LDFLAGS = $(LDFLAGS) /DLL
77!endif
d9654419
VK
78
79# Common C/C++ compiler flags
91c1f188 80CPPFLAGS = $(CPPFLAGS) /MD /O2 /Gd /EHs- /GR- \
d9654419
VK
81 /I "$(NETXMS_BASE)\include" \
82 /I "$(NETXMS_BASE)\build" \
83 /I "$(CURL_BASE)\$(ARCH)\include" \
84 /I "$(OPENSSL_BASE)\$(ARCH)\include" \
85 /D_MT /DUNICODE
86
87# Common linker flags
7cf94f18
VK
88MANIFEST = $(TARGET).intermediate.manifest
89LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE /MACHINE:$(ARCH) /MANIFESTFILE:$(MANIFEST) \
d9654419 90 /LIBPATH:"$(NETXMS_LIBDIR)" \
bf826019
VK
91 /LIBPATH:"$(CURL_BASE)\$(ARCH)\lib" \
92 /LIBPATH:"$(OPENSSL_BASE)\$(ARCH)\lib" \
93 /LIBPATH:"$(WINDDK_BASE)\lib\wnet\$(WINDDK_ARCH)"
64a055a2
VK
94
95# Common libraries
7cf94f18 96LIBS = $(LIBS) ssleay32.lib libeay32.lib uuid.lib kernel32.lib user32.lib advapi32.lib shell32.lib
64a055a2
VK
97
98# Prepare list of object files
7cf94f18
VK
99__sources = $(SOURCES:.cpp=.obj)
100OBJ = $(__sources:.c=.obj)
48e08d41 101
91c1f188
VK
102# Compiled resources
103RESOBJ = $(RESOURCES:.rc=.res)
104
48e08d41 105# Source directory
7cf94f18 106SRCDIR = $(MAKEDIR)
48e08d41 107
d9654419
VK
108# Output files
109!ifdef TARGET
110BINFILE = $(BINDIR)\$(TARGET)
111!endif
112
7cf94f18 113all: Makefile.w32 subdirs $(GENERATED) $(BINFILE)
48e08d41
VK
114
115# Build target
116!ifdef TARGET
64a055a2 117
8b27778f
VK
118!if "$(TYPE)" == "jar"
119
120$(BINFILE): pom.xml
121 mvn clean
122 mvn install
123 mv target/$(TARGET) $(BINFILE)
124
125!else
126
91c1f188 127$(BINFILE): objdir $(OBJ) $(RESOBJ)
7cf94f18
VK
128 @if not exist $(BINDIR) mkdir $(BINDIR)
129 @echo " LD " $(TARGET)
91c1f188 130 $(LD) /NOLOGO $(LDFLAGS) /out:$(BINFILE) $(OBJ) $(RESOBJ) $(LIBS)
7cf94f18 131 @rm -f $(MANIFEST)
64a055a2 132
48e08d41 133.PHONY: objdir
64a055a2 134
48e08d41
VK
135objdir:
136 @if not exist $(OBJDIR) mkdir $(OBJDIR)
137 @cd $(OBJDIR)
64a055a2 138
48e08d41 139{$(SRCDIR)}.c.obj:
7cf94f18
VK
140 @echo " CC " $(<F)
141 @$(CC) /nologo $(CPPFLAGS) $(CFLAGS) /c $< /Fo$@ | tail -n +2
48e08d41
VK
142
143{$(SRCDIR)}.cpp.obj:
7cf94f18
VK
144 @echo " CXX" $(<F)
145 @$(CXX) /nologo $(CPPFLAGS) $(CXXFLAGS) /c $< /Fo$@ | tail -n +2
146
91c1f188 147{$(SRCDIR)}.rc.res:
7cf94f18 148 @echo " RC " $(<F)
bf826019 149 @$(RC) /nologo /r $<
91c1f188 150 @mv $(SRCDIR)\$@ .
7cf94f18
VK
151
152MSG00001.bin: messages.mc
153 @echo " MC messages.mc"
154 @$(MC) messages.mc
9dd277ba 155 @rm -f messages.rc
64a055a2 156
7cf94f18
VK
157messages.h: messages.mc
158 @echo " MC messages.mc"
159 @$(MC) messages.mc
9dd277ba 160 @rm -f messages.rc
48e08d41
VK
161
162!endif
8b27778f 163!endif
64a055a2 164
48e08d41 165# Clean
7cf94f18
VK
166.PHONY: clean
167
64a055a2 168clean:
7cf94f18
VK
169 rm -rf $(OBJ) $(TARGET) $(OBJDIR) $(GENERATED) $(EXTRA_CLEAN)
170 @for %%s in ($(SUBDIRS)) do @( \
171 echo === Entering %%s === && \
172 cd %%s && \
173 @( \
174 $(MAKE) /NOLOGO /F Makefile.w32 clean || \
175 exit 1 \
176 ) && \
177 echo === Leaving %%s === && \
178 cd .. \
179 )
64a055a2
VK
180
181# Sub-directories building rules
48e08d41
VK
182.PHONY: subdirs
183
184subdirs:
7cf94f18
VK
185 @for %%s in ($(SUBDIRS)) do @( \
186 echo === Entering %%s === && \
187 cd %%s && \
188 @( \
189 $(MAKE) /NOLOGO /F Makefile.w32 || \
190 exit 1 \
191 ) && \
192 echo === Leaving %%s === && \
193 cd .. \
48e08d41 194 )