Fixed typo
[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 31!if "$(ARCH)" == "x86"
7cf94f18 32OBJDIR = i386
48e08d41 33!endif
64a055a2
VK
34
35# SDK locations
48e08d41 36!ifndef OPENSSL_BASE
7cf94f18
VK
37OPENSSL_BASE = C:\SDK\OpenSSL
38!endif
bf826019
VK
39!ifndef CURL_BASE
40CURL_BASE = C:\SDK\cURL
41!endif
8b27778f
VK
42!ifndef JDK_BASE
43JDK_BASE = C:\Program Files\Java\jdk1.8.0_121
44!endif
7cf94f18
VK
45
46# Binaries directory
d9654419
VK
47NETXMS_LIBDIR = $(NETXMS_BASE)\bin\$(OBJDIR)
48BINDIR = $(NETXMS_LIBDIR)
bf826019 49
d9654419 50# Component specific settings
bf826019
VK
51!if "$(COMPONENT)" == "server"
52CPPFLAGS = $(CPPFLAGS) /I "$(NETXMS_BASE)\src\server\include"
53!endif
64a055a2 54
d9654419 55# Target specific settings
7cf94f18
VK
56!if "$(TYPE)" == "dll"
57CPPFLAGS = $(CPPFLAGS) /D_USRDLL
58IMPLIB = $(BINFILE:.dll=.lib)
59LDFLAGS = $(LDFLAGS) /DLL /IMPLIB:$(IMPLIB)
60!endif
61!if "$(TYPE)" == "ddr"
62CPPFLAGS = $(CPPFLAGS) /D_USRDLL
63LDFLAGS = $(LDFLAGS) /DLL
48e08d41 64!endif
e3738c4b
VK
65!if "$(TYPE)" == "hdlink"
66CPPFLAGS = $(CPPFLAGS) /D_USRDLL
67LDFLAGS = $(LDFLAGS) /DLL
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 91 /LIBPATH:"$(CURL_BASE)\$(ARCH)\lib" \
b85caada 92 /LIBPATH:"$(OPENSSL_BASE)\$(ARCH)\lib"
96259f10
VK
93
94# Common headers
95HEADERS = $(HEADERS) \
96 $(NETXMS_BASE)\include\build.h \
97 $(NETXMS_BASE)\include\geolocation.h \
98 $(NETXMS_BASE)\include\jansson.h \
99 $(NETXMS_BASE)\include\netxms-regex.h \
100 $(NETXMS_BASE)\include\netxms-version.h \
101 $(NETXMS_BASE)\include\netxms_getopt.h \
102 $(NETXMS_BASE)\include\nms_common.h \
103 $(NETXMS_BASE)\include\nms_cscp.h \
104 $(NETXMS_BASE)\include\nms_threads.h \
105 $(NETXMS_BASE)\include\nms_util.h \
106 $(NETXMS_BASE)\include\nxconfig.h \
107 $(NETXMS_BASE)\include\nxcpapi.h \
108 $(NETXMS_BASE)\include\nxcrypto.h \
109 $(NETXMS_BASE)\include\nxqueue.h \
110 $(NETXMS_BASE)\include\nxstat.h \
111 $(NETXMS_BASE)\include\rwlock.h \
112 $(NETXMS_BASE)\include\unicode.h \
113 $(NETXMS_BASE)\include\uthash.h \
114 $(NETXMS_BASE)\include\uuid.h
64a055a2
VK
115
116# Common libraries
7cf94f18 117LIBS = $(LIBS) ssleay32.lib libeay32.lib uuid.lib kernel32.lib user32.lib advapi32.lib shell32.lib
64a055a2
VK
118
119# Prepare list of object files
7cf94f18
VK
120__sources = $(SOURCES:.cpp=.obj)
121OBJ = $(__sources:.c=.obj)
48e08d41 122
91c1f188
VK
123# Compiled resources
124RESOBJ = $(RESOURCES:.rc=.res)
125
48e08d41 126# Source directory
7cf94f18 127SRCDIR = $(MAKEDIR)
48e08d41 128
d9654419
VK
129# Output files
130!ifdef TARGET
131BINFILE = $(BINDIR)\$(TARGET)
132!endif
133
7cf94f18 134all: Makefile.w32 subdirs $(GENERATED) $(BINFILE)
48e08d41
VK
135
136# Build target
137!ifdef TARGET
64a055a2 138
8b27778f
VK
139!if "$(TYPE)" == "jar"
140
7c2fbeea
VK
141!if "$(JAR_BUILD_MODE)" == "install"
142MVNCMD=install
143!else
144MVNCMD=package
145!endif
146
8b27778f
VK
147$(BINFILE): pom.xml
148 mvn clean
7c2fbeea 149 mvn $(MVNCMD) $(MVNFLAGS)
8b27778f
VK
150 mv target/$(TARGET) $(BINFILE)
151
152!else
153
91c1f188 154$(BINFILE): objdir $(OBJ) $(RESOBJ)
7cf94f18
VK
155 @if not exist $(BINDIR) mkdir $(BINDIR)
156 @echo " LD " $(TARGET)
e3738c4b 157 @$(LD) /NOLOGO $(LDFLAGS) /out:$(BINFILE) $(OBJ) $(RESOBJ) $(LIBS)
7cf94f18 158 @rm -f $(MANIFEST)
64a055a2 159
96259f10 160$(OBJ): $(NETXMS_BASE)\build\netxms-build-tag.h $(HEADERS)
55108637 161
48e08d41 162.PHONY: objdir
64a055a2 163
48e08d41
VK
164objdir:
165 @if not exist $(OBJDIR) mkdir $(OBJDIR)
166 @cd $(OBJDIR)
64a055a2 167
48e08d41 168{$(SRCDIR)}.c.obj:
7cf94f18
VK
169 @echo " CC " $(<F)
170 @$(CC) /nologo $(CPPFLAGS) $(CFLAGS) /c $< /Fo$@ | tail -n +2
48e08d41
VK
171
172{$(SRCDIR)}.cpp.obj:
7cf94f18
VK
173 @echo " CXX" $(<F)
174 @$(CXX) /nologo $(CPPFLAGS) $(CXXFLAGS) /c $< /Fo$@ | tail -n +2
175
91c1f188 176{$(SRCDIR)}.rc.res:
7cf94f18 177 @echo " RC " $(<F)
bf826019 178 @$(RC) /nologo /r $<
91c1f188 179 @mv $(SRCDIR)\$@ .
7cf94f18
VK
180
181MSG00001.bin: messages.mc
182 @echo " MC messages.mc"
183 @$(MC) messages.mc
9dd277ba 184 @rm -f messages.rc
64a055a2 185
7cf94f18
VK
186messages.h: messages.mc
187 @echo " MC messages.mc"
188 @$(MC) messages.mc
9dd277ba 189 @rm -f messages.rc
48e08d41
VK
190
191!endif
8b27778f 192!endif
64a055a2 193
48e08d41 194# Clean
7cf94f18
VK
195.PHONY: clean
196
64a055a2 197clean:
7cf94f18
VK
198 rm -rf $(OBJ) $(TARGET) $(OBJDIR) $(GENERATED) $(EXTRA_CLEAN)
199 @for %%s in ($(SUBDIRS)) do @( \
200 echo === Entering %%s === && \
201 cd %%s && \
202 @( \
203 $(MAKE) /NOLOGO /F Makefile.w32 clean || \
204 exit 1 \
205 ) && \
206 echo === Leaving %%s === && \
207 cd .. \
208 )
64a055a2
VK
209
210# Sub-directories building rules
48e08d41
VK
211.PHONY: subdirs
212
213subdirs:
7cf94f18
VK
214 @for %%s in ($(SUBDIRS)) do @( \
215 echo === Entering %%s === && \
216 cd %%s && \
217 @( \
218 $(MAKE) /NOLOGO /F Makefile.w32 || \
219 exit 1 \
220 ) && \
221 echo === Leaving %%s === && \
222 cd .. \
48e08d41 223 )