dbemu SMS driver makefile updated
[public/netxms.git] / Makefile.inc.w32
CommitLineData
64a055a2
VK
1# Common settings for Win32 builds
2
7cf94f18
VK
3CC = cl
4CXX = cl
5LD = link
6PERL = perl
7LEX = flex
8YACC = bison
9MC = mc
64a055a2
VK
10
11# Source base path
7cf94f18
VK
12# Default location is C:\Source\NetXMS
13# It can be changed by setting NETXMS_BASE environment variable
14!ifndef NETXMS_BASE
15NETXMS_BASE = C:\Source\NetXMS
16!endif
64a055a2
VK
17
18# Architecture
48e08d41 19!ifndef ARCH
7cf94f18 20ARCH = x64
48e08d41
VK
21!endif
22
7cf94f18
VK
23!if "$(ARCH)" == "x64"
24WINDDK_ARCH = amd64
25WINSDK_LIB = Lib\x64
26WINSDK_BIN = Bin\x64
27VCBUILD_LIB = Lib\amd64
28OBJDIR = amd64
48e08d41
VK
29!endif
30
7cf94f18
VK
31!if "$(ARCH)" == "x86"
32WINDDK_ARCH = i386
33WINSDK_LIB = Lib
34WINSDK_BIN = Bin
35VCBUILD_LIB = Lib
36OBJDIR = i386
48e08d41 37!endif
64a055a2
VK
38
39# SDK locations
48e08d41
VK
40#-include ${BASE_PATH}winsdk.inc
41
42!ifndef VCBUILD_BASE
7cf94f18 43VCBUILD_BASE = C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
48e08d41
VK
44!endif
45!ifndef WINSDK_BASE
7cf94f18 46WINSDK_BASE = C:\SDK\Windows 7 SDK
48e08d41
VK
47!endif
48!ifndef WINDDK_BASE
7cf94f18 49WINDDK_BASE = C:\SDK\WinDDK
48e08d41
VK
50!endif
51!ifndef OPENSSL_BASE
7cf94f18
VK
52OPENSSL_BASE = C:\SDK\OpenSSL
53!endif
54
55# Binaries directory
56BINDIR = $(NETXMS_BASE)\bin\$(OBJDIR)
57
58# Output files
59!ifdef TARGET
60BINFILE = $(BINDIR)\$(TARGET)
48e08d41 61!endif
64a055a2
VK
62
63# Common C/C++ compiler flags
7cf94f18
VK
64CPPFLAGS = $(CPPFLAGS) /O2 /Gd /EHs- /GR- \
65 /I "$(NETXMS_BASE)\include" \
66 /I "$(NETXMS_BASE)\build" \
67 /I "$(WINSDK_BASE)\include" \
68 /I "$(VCBUILD_BASE)\include" \
69 /I "$(OPENSSL_BASE)\$(ARCH)\include" \
70 /D_MT /DUNICODE
64a055a2
VK
71
72# Common linker flags
7cf94f18
VK
73!if "$(TYPE)" == "dll"
74CPPFLAGS = $(CPPFLAGS) /D_USRDLL
75IMPLIB = $(BINFILE:.dll=.lib)
76LDFLAGS = $(LDFLAGS) /DLL /IMPLIB:$(IMPLIB)
77!endif
78!if "$(TYPE)" == "ddr"
79CPPFLAGS = $(CPPFLAGS) /D_USRDLL
80LDFLAGS = $(LDFLAGS) /DLL
48e08d41 81!endif
7cf94f18
VK
82!if "$(TYPE)" == "nsm"
83CPPFLAGS = $(CPPFLAGS) /D_USRDLL
84LDFLAGS = $(LDFLAGS) /DLL
85!endif
86MANIFEST = $(TARGET).intermediate.manifest
87LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE /MACHINE:$(ARCH) /MANIFESTFILE:$(MANIFEST) \
88 /LIBPATH:"$(BINDIR)" \
89 /LIBPATH:"$(OPENSSL_BASE)\$(ARCH)\lib" \
90 /LIBPATH:"$(WINDDK_BASE)\lib\wnet\$(WINDDK_ARCH)" \
91 /LIBPATH:"$(WINSDK_BASE)\$(WINSDK_LIB)" \
92 /LIBPATH:"$(VCBUILD_BASE)\$(VCBUILD_LIB)"
64a055a2
VK
93
94# Common libraries
7cf94f18 95LIBS = $(LIBS) ssleay32.lib libeay32.lib uuid.lib kernel32.lib user32.lib advapi32.lib shell32.lib
64a055a2
VK
96
97# Prepare list of object files
7cf94f18
VK
98__sources = $(SOURCES:.cpp=.obj)
99OBJ = $(__sources:.c=.obj)
48e08d41
VK
100
101# Source directory
7cf94f18 102SRCDIR = $(MAKEDIR)
48e08d41 103
7cf94f18 104all: Makefile.w32 subdirs $(GENERATED) $(BINFILE)
48e08d41
VK
105
106# Build target
107!ifdef TARGET
64a055a2 108
7cf94f18
VK
109$(BINFILE): objdir $(OBJ)
110 @if not exist $(BINDIR) mkdir $(BINDIR)
111 @echo " LD " $(TARGET)
112 @$(LD) /NOLOGO $(LDFLAGS) /out:$(BINFILE) $(OBJ) $(LIBS)
113 @rm -f $(MANIFEST)
64a055a2 114
48e08d41 115.PHONY: objdir
64a055a2 116
48e08d41
VK
117objdir:
118 @if not exist $(OBJDIR) mkdir $(OBJDIR)
119 @cd $(OBJDIR)
64a055a2 120
48e08d41 121{$(SRCDIR)}.c.obj:
7cf94f18
VK
122 @echo " CC " $(<F)
123 @$(CC) /nologo $(CPPFLAGS) $(CFLAGS) /c $< /Fo$@ | tail -n +2
48e08d41
VK
124
125{$(SRCDIR)}.cpp.obj:
7cf94f18
VK
126 @echo " CXX" $(<F)
127 @$(CXX) /nologo $(CPPFLAGS) $(CXXFLAGS) /c $< /Fo$@ | tail -n +2
128
129.rc.res:
130 @echo " RC " $(<F)
131 @$(RC) /nologo /r /i "$(WINSDK_BASE)\include" /i "$(VCBUILD_BASE)\include" $<
132
133MSG00001.bin: messages.mc
134 @echo " MC messages.mc"
135 @$(MC) messages.mc
64a055a2 136
7cf94f18
VK
137messages.h: messages.mc
138 @echo " MC messages.mc"
139 @$(MC) messages.mc
48e08d41
VK
140
141!endif
64a055a2 142
48e08d41 143# Clean
7cf94f18
VK
144.PHONY: clean
145
64a055a2 146clean:
7cf94f18
VK
147 rm -rf $(OBJ) $(TARGET) $(OBJDIR) $(GENERATED) $(EXTRA_CLEAN)
148 @for %%s in ($(SUBDIRS)) do @( \
149 echo === Entering %%s === && \
150 cd %%s && \
151 @( \
152 $(MAKE) /NOLOGO /F Makefile.w32 clean || \
153 exit 1 \
154 ) && \
155 echo === Leaving %%s === && \
156 cd .. \
157 )
64a055a2
VK
158
159# Sub-directories building rules
48e08d41
VK
160.PHONY: subdirs
161
162subdirs:
7cf94f18
VK
163 @for %%s in ($(SUBDIRS)) do @( \
164 echo === Entering %%s === && \
165 cd %%s && \
166 @( \
167 $(MAKE) /NOLOGO /F Makefile.w32 || \
168 exit 1 \
169 ) && \
170 echo === Leaving %%s === && \
171 cd .. \
48e08d41 172 )