1 # Copyright (C) 1998-2008 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.23+.win32
22 # libxml2 (used by libxslt)
24 LIBXML2_DIR=\libxml2-2.6.32+.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)
210 DEBUG_LNK_OPTIONS= /debug
214 DLL_LINK_OPTIONS= /dll
215 CLIENT_LINK_OPTIONS = /subsystem:console
217 # Final opt variables
219 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
220 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
221 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
222 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
223 TCLOPT= $(COMMON_TCL_OPTIONS)
226 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
227 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
228 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
229 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
230 TCLOPT= $(COMMON_TCL_OPTIONS)
233 # Source and object modules
236 "$(OBJDIR)\yaz-proxy-main.obj"
238 YAZPROXY_DLL_OBJS = \
239 "$(OBJDIR)\yaz-proxy.obj" \
240 "$(OBJDIR)\yaz-proxy-config.obj" \
241 "$(OBJDIR)\yaz-usemarcon.obj" \
242 "$(OBJDIR)\msg-thread.obj" \
243 "$(OBJDIR)\charset-converter.obj" \
244 "$(OBJDIR)\limit-connect.obj" \
245 "$(OBJDIR)\modules.obj" \
246 "$(OBJDIR)\yaz-bw.obj"
248 ###########################################################
249 ############### Compiling
250 ###########################################################
252 # Note: This defines where to look for the necessary
253 # source files. Funny way of doing it, but it works.
255 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
258 ###########################################################
259 ############### Resources
260 ###########################################################
262 ### The RC compiler (resource files)
264 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
265 DEBUG_RC_OPTIONS=/d "_DEBUG"
266 RELEASE_RC_OPTIONS=/d "NDEBUG"
274 ###########################################################
275 ############### Linking
276 ###########################################################
278 $(YAZPROXY_DLL) $(YAZPROXY_IMPLIB): "$(BINDIR)" $(YAZPROXY_DLL_OBJS)
282 $(DLL_LINK_OPTIONS) \
284 $(YAZPROXY_DLL_OBJS) \
285 /out:$(YAZPROXY_DLL) \
286 /implib:"$(YAZPROXY_IMPLIB)" \
288 $(YAZPROXY) : "$(BINDIR)" $(YAZPROXY_OBJS) $(YAZPROXY_IMPLIB)
291 $(CLIENT_LINK_OPTIONS) \
307 ########### check directories and create if needed
308 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
310 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
311 if not exist "$@/$(NUL)" mkdir "$@"