1 # Copyright (C) 1998-2011 Index Data
4 ###########################################################
5 ############### Parameters
6 ###########################################################
8 DEBUG=0 # 0 for release, 1 for debug
14 # iconv charcter conversion utility
16 ICONV_DIR=\iconv-1.9.2.win32
20 LIBXSLT_DIR=\libxslt-1.1.26.win32
22 # libxml2 (used by libxslt)
24 LIBXML2_DIR=\libxml2-2.7.6.win32
26 # zlib compression (used by libxml2)
27 ZLIB_DIR=\zlib-1.2.3.win32
29 # get WIN32 binaries for libxslt, libxml, iconv, zlib from here:
30 # http://www.zlatkovic.com/libxml.en.html
34 all: dirs dll proxy iconv libxml2 libxslt yaz yazpp
36 NSIS="c:\program files\nsis\makensis-bz2.exe"
44 # The current directory is supposed to be something like
45 # ..../yaz/win, everything is relative to that
46 ROOTDIR=.. # The home of yaz++
48 INCLDIR=$(ROOTDIR)\include # our includes
49 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
50 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
51 WINDIR=$(ROOTDIR)\win # all these Win make things
52 SRCDIR=$(ROOTDIR)\src # for the case we move them under src
53 PROXYDIR=$(ROOTDIR)\proxy
54 ZOOMDIR=$(ROOTDIR)\zoom
57 OBJDIR=$(WINDIR)\dobj # where we store intermediate files
59 OBJDIR=$(WINDIR)\obj # where we store intermediate files
62 TMPDIR=$(ROOTDIR)\win\tmp
65 YAZPROXY_DLL=$(BINDIR)\yazproxy2.dll
66 YAZPROXY_IMPLIB=$(LIBDIR)\yazproxy2.lib
68 YAZPROXY=$(BINDIR)\yazproxy.exe
70 # shortcut names defined here
83 YAZ_LIB="$(YAZ_DIR)\lib\$(YAZD).lib"
84 YAZ_DEF=/DYAZ_HAVE_XML2=1 /DYAZ_USE_NEW_LOG=1 /I"$(YAZ_DIR)\include"
86 # Copy yaz.dll to our bin
87 yaz: $(BINDIR)\$(YAZD).dll
88 $(BINDIR)\$(YAZD).dll: "$(YAZ_DIR)\bin\$(YAZD).dll"
89 copy "$(YAZ_DIR)\bin\$(YAZD).dll" $(BINDIR)
91 # YAZ++ includes & libs
92 YAZPP_LIB="$(YAZPP_DIR)\lib\$(YAZPPD).lib"
93 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
95 # Copy yazpp.dll to our bin
96 yazpp: $(BINDIR)\$(YAZPPD).dll
97 $(BINDIR)\$(YAZPPD).dll: "$(YAZPP_DIR)\bin\$(YAZPPD).dll"
98 copy "$(YAZPP_DIR)\bin\$(YAZPPD).dll" $(BINDIR)
103 /I"$(ICONV_DIR)\include"
105 "$(ICONV_DIR)\lib\iconv.lib"
106 iconv: $(BINDIR)\iconv.dll
109 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
119 LIBXML2_LIB="$(LIBXML2_DIR)\lib\libxml2.lib"
120 LIBXML2_DEF=/D HAVE_XML2=1 /I"$(LIBXML2_DIR)\include"
121 libxml2: $(BINDIR)\libxml2.dll $(BINDIR)\zlib1.dll
123 $(BINDIR)\libxml2.dll:
124 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
127 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
131 LIBXML2_DEF=/D HAVE_XML2=0
137 LIBXSLT_LIB="$(LIBXSLT_DIR)\lib\libxslt.lib"
138 LIBXSLT_DEF=/D YAZ_HAVE_XSLT=1 /I"$(LIBXSLT_DIR)\include"
139 libxslt: $(BINDIR)\libxslt.dll $(BINDIR)\zlib1.dll
141 $(BINDIR)\libxslt.dll:
142 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
146 LIBXSLT_DEF=/D YAZ_HAVE_XSLT=0
152 ### C and CPP compiler (the same thing)
153 # Note: $(CPP) has already been defined in the environment
154 # (if you set things up right!)
157 /nologo /W3 /EHsc /FD /c \
158 /D "_CRT_SECURE_NO_DEPRECATE" \
166 /D "HAVE_WCHAR_H=1" \
172 /I"$(ROOTDIR)\include"
182 # /W3 = warning level
183 # /EHsc= Enable exception handling
184 # /FD = Generate file dependencies (what ever they are)
185 # /c = compile without linking
186 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
187 # /Fo = object file name (or at least path)
188 # /Fd = debug database name (or path)
189 # /MD = Runtime library: Multithread DLL
190 # /MDd = Runtime library: Multithread DLL (debug)
191 # /Od = Disable optimising (debug)
192 # /O2 = Optimize for speed
193 # /Gm = Minimal rebuild (some cpp class stuff)
194 # /Zi = Program database for debuggers
195 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
201 LINK_LIBS=kernel32.lib advapi32.lib ws2_32.lib \
202 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB)
204 COMMON_LNK_OPTIONS= /nologo /subsystem:windows /incremental:no
206 DEBUG_LNK_OPTIONS= /debug
210 DLL_LINK_OPTIONS= /dll
211 CLIENT_LINK_OPTIONS = /subsystem:console
213 # Final opt variables
215 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
216 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
217 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
218 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
219 TCLOPT= $(COMMON_TCL_OPTIONS)
222 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
223 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
224 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
225 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
226 TCLOPT= $(COMMON_TCL_OPTIONS)
229 # Source and object modules
232 "$(OBJDIR)\yaz-proxy-main.obj"
234 YAZPROXY_DLL_OBJS = \
235 "$(OBJDIR)\yaz-proxy.obj" \
236 "$(OBJDIR)\yaz-proxy-config.obj" \
237 "$(OBJDIR)\yaz-usemarcon.obj" \
238 "$(OBJDIR)\msg-thread.obj" \
239 "$(OBJDIR)\charset-converter.obj" \
240 "$(OBJDIR)\limit-connect.obj" \
241 "$(OBJDIR)\modules.obj" \
242 "$(OBJDIR)\yaz-bw.obj"
244 ###########################################################
245 ############### Compiling
246 ###########################################################
248 # Note: This defines where to look for the necessary
249 # source files. Funny way of doing it, but it works.
251 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
254 ###########################################################
255 ############### Resources
256 ###########################################################
258 ### The RC compiler (resource files)
260 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
261 DEBUG_RC_OPTIONS=/d "_DEBUG"
262 RELEASE_RC_OPTIONS=/d "NDEBUG"
270 ###########################################################
271 ############### Linking
272 ###########################################################
274 $(YAZPROXY_DLL) $(YAZPROXY_IMPLIB): "$(BINDIR)" $(YAZPROXY_DLL_OBJS)
278 $(DLL_LINK_OPTIONS) \
280 $(YAZPROXY_DLL_OBJS) \
281 /out:$(YAZPROXY_DLL) \
282 /implib:"$(YAZPROXY_IMPLIB)" \
284 $(YAZPROXY) : "$(BINDIR)" $(YAZPROXY_OBJS) $(YAZPROXY_IMPLIB)
287 $(CLIENT_LINK_OPTIONS) \
303 ########### check directories and create if needed
304 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
306 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
307 if not exist "$@/$(NUL)" mkdir "$@"