improved Windows makefile build; more makefiles added
authorVictor Kirhenshtein <victor@netxms.org>
Sun, 19 Feb 2017 12:25:04 +0000 (14:25 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Sun, 19 Feb 2017 12:25:04 +0000 (14:25 +0200)
16 files changed:
.gitignore
Makefile.inc.w32
src/Makefile.w32
src/agent/subagents/Makefile.w32
src/agent/subagents/jmx/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/logwatch/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/mysql/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/netsvc/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/odbcquery/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/oracle/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/ping/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/portCheck/Makefile.w32 [new file with mode: 0644]
src/agent/subagents/sms/Makefile.w32 [new file with mode: 0644]
src/server/Makefile.w32 [new file with mode: 0644]
src/server/libnxsrv/Makefile.w32 [new file with mode: 0644]
src/server/libnxsrv/libnxsrv.rc

index aae6816..cfce955 100644 (file)
@@ -16,6 +16,7 @@
 *.plg
 *.rej
 *.suo
+*.res
 *.vcproj.*.user
 *~
 .#*
index 1d3c35c..9ebbb1a 100644 (file)
@@ -1,4 +1,7 @@
 # Common settings for Win32 builds
+# This makefile expects that path to build tools and environment variables
+# LIB and INCLUDE for target architecture set before running make
+# They can be set using build\msvc_setenv_* scripts
 
 CC = cl
 CXX = cl
@@ -22,35 +25,24 @@ ARCH = x64
 
 !if "$(ARCH)" == "x64"
 WINDDK_ARCH = amd64
-WINSDK_LIB = Lib\x64
-WINSDK_BIN = Bin\x64
-VCBUILD_LIB = Lib\amd64
 OBJDIR = amd64
 !endif
 
 !if "$(ARCH)" == "x86"
 WINDDK_ARCH = i386
-WINSDK_LIB = Lib
-WINSDK_BIN = Bin
-VCBUILD_LIB = Lib
 OBJDIR = i386
 !endif
 
 # SDK locations
-#-include ${BASE_PATH}winsdk.inc
-
-!ifndef VCBUILD_BASE
-VCBUILD_BASE = C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
-!endif
-!ifndef WINSDK_BASE
-WINSDK_BASE = C:\SDK\Windows 7 SDK
-!endif
 !ifndef WINDDK_BASE
 WINDDK_BASE = C:\SDK\WinDDK
 !endif
 !ifndef OPENSSL_BASE
 OPENSSL_BASE = C:\SDK\OpenSSL
 !endif
+!ifndef CURL_BASE
+CURL_BASE = C:\SDK\cURL
+!endif
 !ifndef JDK_BASE
 JDK_BASE = C:\Program Files\Java\jdk1.8.0_121
 !endif
@@ -65,12 +57,15 @@ BINFILE = $(BINDIR)\$(TARGET)
 
 # Common C/C++ compiler flags
 CPPFLAGS = $(CPPFLAGS) /O2 /Gd /EHs- /GR- \
-   /I "$(NETXMS_BASE)\include" \
-   /I "$(NETXMS_BASE)\build" \
-   /I "$(WINSDK_BASE)\include" \
-   /I "$(VCBUILD_BASE)\include" \
-   /I "$(OPENSSL_BASE)\$(ARCH)\include" \
+       /I "$(NETXMS_BASE)\include" \
+       /I "$(NETXMS_BASE)\build" \
+       /I "$(CURL_BASE)\$(ARCH)\include" \
+       /I "$(OPENSSL_BASE)\$(ARCH)\include" \
        /D_MT /DUNICODE
+
+!if "$(COMPONENT)" == "server"
+CPPFLAGS = $(CPPFLAGS) /I "$(NETXMS_BASE)\src\server\include"
+!endif
        
 # Common linker flags
 !if "$(TYPE)" == "dll"
@@ -88,11 +83,10 @@ LDFLAGS = $(LDFLAGS) /DLL
 !endif
 MANIFEST = $(TARGET).intermediate.manifest
 LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE /MACHINE:$(ARCH) /MANIFESTFILE:$(MANIFEST) \
-   /LIBPATH:"$(BINDIR)" \
-   /LIBPATH:"$(OPENSSL_BASE)\$(ARCH)\lib" \
-   /LIBPATH:"$(WINDDK_BASE)\lib\wnet\$(WINDDK_ARCH)" \
-   /LIBPATH:"$(WINSDK_BASE)\$(WINSDK_LIB)"  \
-   /LIBPATH:"$(VCBUILD_BASE)\$(VCBUILD_LIB)"
+       /LIBPATH:"$(BINDIR)" \
+       /LIBPATH:"$(CURL_BASE)\$(ARCH)\lib" \
+       /LIBPATH:"$(OPENSSL_BASE)\$(ARCH)\lib" \
+       /LIBPATH:"$(WINDDK_BASE)\lib\wnet\$(WINDDK_ARCH)"
 
 # Common libraries
 LIBS = $(LIBS) ssleay32.lib libeay32.lib uuid.lib kernel32.lib user32.lib advapi32.lib shell32.lib
@@ -140,7 +134,7 @@ objdir:
 
 .rc.res:
    @echo "    RC " $(<F)
-   @$(RC) /nologo /r /i "$(WINSDK_BASE)\include" /i "$(VCBUILD_BASE)\include" $<
+   @$(RC) /nologo /r $<
 
 MSG00001.bin: messages.mc
    @echo "    MC  messages.mc"
index 878409d..144390a 100644 (file)
@@ -1,4 +1,4 @@
 SUBDIRS = jansson libexpat libtre sqlite zlib libnetxms libnxlp libnxmap libnxmb libnxsl libstrophe \
-          nxscript db snmp appagent agent
+          nxscript db snmp appagent agent server
 
 include ..\Makefile.inc.w32
index 791b99c..773ae50 100644 (file)
@@ -1,3 +1,4 @@
-SUBDIRS = db2 dbquery devemu ecs filemgr gps informix java
+SUBDIRS = db2 dbquery devemu ecs filemgr gps informix java jmx logwatch \
+          mysql netsvc odbcquery oracle ping portCheck sms
 
 include ..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/jmx/Makefile.w32 b/src/agent/subagents/jmx/Makefile.w32
new file mode 100644 (file)
index 0000000..d3a0e1a
--- /dev/null
@@ -0,0 +1,4 @@
+TARGET = jmx.jar
+TYPE = jar
+
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/logwatch/Makefile.w32 b/src/agent/subagents/logwatch/Makefile.w32
new file mode 100644 (file)
index 0000000..e72a4a0
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = logwatch.nsm
+TYPE = nsm
+SOURCES = logwatch.cpp
+
+LIBS = libnxagent.lib libnxlp.lib libnetxms.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/mysql/Makefile.w32 b/src/agent/subagents/mysql/Makefile.w32
new file mode 100644 (file)
index 0000000..32a6f0c
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = mysql.nsm
+TYPE = nsm
+SOURCES = db.cpp main.cpp
+
+LIBS = libnxagent.lib libnxdb.lib libnetxms.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/netsvc/Makefile.w32 b/src/agent/subagents/netsvc/Makefile.w32
new file mode 100644 (file)
index 0000000..772fa76
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = netsvc.nsm
+TYPE = nsm
+SOURCES = main.cpp
+
+LIBS = libnxagent.lib libnetxms.lib libtre.lib libcurl.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/odbcquery/Makefile.w32 b/src/agent/subagents/odbcquery/Makefile.w32
new file mode 100644 (file)
index 0000000..237f193
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = odbcquery.nsm
+TYPE = nsm
+SOURCES = odbcquery.cpp odbcsapi.cpp
+
+LIBS = libnxagent.lib libnetxms.lib odbc32.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/oracle/Makefile.w32 b/src/agent/subagents/oracle/Makefile.w32
new file mode 100644 (file)
index 0000000..72f3a71
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = oracle.nsm
+TYPE = nsm
+SOURCES = db.cpp main.cpp
+
+LIBS = libnxagent.lib libnxdb.lib libnetxms.lib libtre.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/ping/Makefile.w32 b/src/agent/subagents/ping/Makefile.w32
new file mode 100644 (file)
index 0000000..057a907
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = ping.nsm
+TYPE = nsm
+SOURCES = ping.cpp
+
+LIBS = libnxagent.lib libnetxms.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/portCheck/Makefile.w32 b/src/agent/subagents/portCheck/Makefile.w32
new file mode 100644 (file)
index 0000000..c496816
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = portcheck.nsm
+TYPE = nsm
+SOURCES = custom.cpp http.cpp main.cpp net.cpp pop3.cpp smtp.cpp ssh.cpp telnet.cpp
+
+LIBS = libnxagent.lib libnetxms.lib libtre.lib ws2_32.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/agent/subagents/sms/Makefile.w32 b/src/agent/subagents/sms/Makefile.w32
new file mode 100644 (file)
index 0000000..e7db17a
--- /dev/null
@@ -0,0 +1,7 @@
+TARGET = sms.nsm
+TYPE = nsm
+SOURCES = main.cpp pdumode.cpp sender.cpp
+
+LIBS = libnxagent.lib libnetxms.lib
+         
+include ..\..\..\..\Makefile.inc.w32
diff --git a/src/server/Makefile.w32 b/src/server/Makefile.w32
new file mode 100644 (file)
index 0000000..30ac69c
--- /dev/null
@@ -0,0 +1,3 @@
+SUBDIRS = libnxsrv
+
+include ..\..\Makefile.inc.w32
diff --git a/src/server/libnxsrv/Makefile.w32 b/src/server/libnxsrv/Makefile.w32
new file mode 100644 (file)
index 0000000..9a2ca0d
--- /dev/null
@@ -0,0 +1,13 @@
+TARGET = libnxsrv.dll
+TYPE = dll
+COMPONENT = server
+SOURCES = agent.cpp apinfo.cpp hdlink.cpp iflist.cpp isc.cpp \
+          main.cpp ndd.cpp snmpproxy.cpp vlan.cpp
+GENERATED = messages.h MSG00001.bin libnxsrv.res
+
+CPPFLAGS = /DLIBNXSRV_EXPORTS
+LIBS = libnxsnmp.lib libnetxms.lib ws2_32.lib
+         
+include ..\..\..\Makefile.inc.w32
+
+libnxsrv.res: MSG00001.bin
index f90bb3b..561a5c8 100644 (file)
@@ -7,7 +7,7 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include <windows.h>
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS