1 # Copyright (C) 1993-2006, Index Data ApS
3 # $Id: makefile,v 1.7 2006-04-30 13:20:47 adam Exp $
5 ###########################################################
6 ############### Parameters
7 ###########################################################
9 DEBUG=0 # 0 for release, 1 for debug
15 # iconv charcter conversion utility
17 ICONV_DIR = c:\iconv-1.9.1.win32
21 LIBXSLT_DIR=c:\libxslt-1.1.14.win32
23 # libxml2 (used by libxslt)
25 LIBXML2_DIR=c:\libxml2-2.6.20.win32
27 # zlib compression (used by libxml2)
28 ZLIB_DIR = c:\zlib-1.2.3.win32
30 # get WIN32 binaries for libxslt, libxml, iconv, zlib from here:
31 # http://www.zlatkovic.com/libxml.en.html
35 all: dirs dll proxy iconv libxml2 libxslt yaz yazpp
37 NSIS="c:\program files\nsis\makensis-bz2.exe"
45 ###########################################################
46 ############### Directories
47 ###########################################################
48 # The current directory is supposed to be something like
49 # ..../yaz/win, everything is relative to that
50 ROOTDIR=.. # The home of yaz++
52 INCLDIR=$(ROOTDIR)\include # our includes
53 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
54 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
55 WINDIR=$(ROOTDIR)\win # all these Win make things
56 OBJDIR=$(WINDIR)\obj # where we store intermediate files
57 SRCDIR=$(ROOTDIR)\src # for the case we move them under src
58 PROXYDIR=$(ROOTDIR)\proxy
59 ZOOMDIR=$(ROOTDIR)\zoom
61 TMPDIR=$(ROOTDIR)\win\tmp
64 ###########################################################
65 ############### Targets - what to make
66 ###########################################################
68 YAZPROXY_DLL=$(BINDIR)\yazproxy.dll
69 YAZPROXY_IMPLIB=$(LIBDIR)\yazproxy.lib
71 YAZPROXY=$(BINDIR)\yazproxy.exe
73 # shortcut names defined here
76 ###########################################################
77 ############### Compiler and linker options
78 ###########################################################
89 YAZ_LIB="$(YAZ_DIR)\lib\$(YAZD).lib"
90 YAZ_DEF=/DYAZ_USE_NEW_LOG=1 /I"$(YAZ_DIR)\include"
92 # Copy yaz.dll to our bin
93 yaz: $(BINDIR)\$(YAZD).dll
94 $(BINDIR)\$(YAZD).dll: $(YAZ_DIR)\bin\$(YAZD).dll
95 copy "$(YAZ_DIR)\bin\$(YAZD).dll" $(BINDIR)
97 # YAZ++ includes & libs
98 YAZPP_LIB="$(YAZPP_DIR)\lib\$(YAZPPD).lib"
99 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
101 # Copy yazpp.dll to our bin
102 yazpp: $(BINDIR)\$(YAZPPD).dll
103 $(BINDIR)\$(YAZPPD).dll: $(YAZPP_DIR)\bin\$(YAZPPD).dll
104 copy "$(YAZPP_DIR)\bin\$(YAZPPD).dll" $(BINDIR)
109 /I"$(ICONV_DIR)\include"
111 "$(ICONV_DIR)\lib\iconv.lib"
112 iconv: $(BINDIR)\iconv.dll
115 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
125 LIBXML2_LIB="$(LIBXML2_DIR)\lib\libxml2.lib"
126 LIBXML2_DEF=/D HAVE_XML2=1 /I"$(LIBXML2_DIR)\include"
127 libxml2: $(BINDIR)\libxml2.dll $(BINDIR)\zlib1.dll
129 $(BINDIR)\libxml2.dll:
130 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
133 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
137 LIBXML2_DEF=/D HAVE_XML2=0
143 LIBXSLT_LIB="$(LIBXSLT_DIR)\lib\libxslt.lib"
144 LIBXSLT_DEF=/D HAVE_XSLT=1 /I"$(LIBXSLT_DIR)\include"
145 libxslt: $(BINDIR)\libxslt.dll $(BINDIR)\zlib1.dll
147 $(BINDIR)\libxslt.dll:
148 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
152 LIBXSLT_DEF=/D HAVE_XSLT=0
158 ### C and CPP compiler (the same thing)
159 # Note: $(CPP) has already been defined in the environment
160 # (if you set things up right!)
163 /nologo /W3 /EHsc /FD /c \
164 /D "_CRT_SECURE_NO_DEPRECATE" \
172 /D "HAVE_WCHAR_H=1" \
178 /I"$(ROOTDIR)\include"
188 # /W3 = warning level
189 # /EHsc= Enable exception handling
190 # /FD = Generate file dependencies (what ever they are)
191 # /c = compile without linking
192 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
193 # /Fo = object file name (or at least path)
194 # /Fd = debug database name (or path)
195 # /MD = Runtime library: Multithread DLL
196 # /MDd = Runtime library: Multithread DLL (debug)
197 # /Od = Disable optimising (debug)
198 # /O2 = Optimize for speed
199 # /Gm = Minimal rebuild (some cpp class stuff)
200 # /Zi = Program database for debuggers
201 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
207 LINK_LIBS= kernel32.lib user32.lib gdi32.lib \
208 advapi32.lib uuid.lib \
209 wsock32.lib advapi32.lib \
210 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB)
212 COMMON_LNK_OPTIONS= /nologo \
217 DEBUG_LNK_OPTIONS= /debug
221 DLL_LINK_OPTIONS= /dll
222 CLIENT_LINK_OPTIONS = /subsystem:console
224 # Final opt variables
226 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
227 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
228 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
229 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
230 TCLOPT= $(COMMON_TCL_OPTIONS)
233 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
234 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
235 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
236 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
237 TCLOPT= $(COMMON_TCL_OPTIONS)
240 ###########################################################
241 ############### Source and object modules
242 ###########################################################
245 "$(OBJDIR)\yaz-proxy-main.obj"
247 YAZPROXY_DLL_OBJS = \
248 "$(OBJDIR)\yaz-proxy.obj" \
249 "$(OBJDIR)\yaz-proxy-config.obj" \
250 "$(OBJDIR)\yaz-usemarcon.obj" \
251 "$(OBJDIR)\msg-thread.obj" \
252 "$(OBJDIR)\charset-converter.obj" \
253 "$(OBJDIR)\limit-connect.obj" \
254 "$(OBJDIR)\modules.obj" \
255 "$(OBJDIR)\yaz-bw.obj"
257 ###########################################################
258 ############### Compiling
259 ###########################################################
261 # Note: This defines where to look for the necessary
262 # source files. Funny way of doing it, but it works.
264 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
267 ###########################################################
268 ############### Resources
269 ###########################################################
271 ### The RC compiler (resource files)
273 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
274 DEBUG_RC_OPTIONS=/d "_DEBUG"
275 RELEASE_RC_OPTIONS=/d "NDEBUG"
277 YAZ_RES=$(OBJDIR)\yaz.res
278 YAZ_RC=$(WINDIR)\yaz.rc
286 $(YAZ_RES): $(YAZ_RC)
287 $(RSC) $(RSOPT) /fo"$(YAZ_RES)" $(YAZ_RC)
289 ###########################################################
290 ############### Linking
291 ###########################################################
293 $(YAZPROXY_DLL) $(YAZPROXY_IMPLIB): "$(BINDIR)" $(YAZPROXY_DLL_OBJS)
297 $(DLL_LINK_OPTIONS) \
299 $(YAZPROXY_DLL_OBJS) \
300 /out:$(YAZPROXY_DLL) \
301 /implib:"$(YAZPROXY_IMPLIB)" \
303 $(YAZPROXY) : "$(BINDIR)" $(YAZPROXY_OBJS) $(YAZPROXY_IMPLIB)
306 $(CLIENT_LINK_OPTIONS) \
313 ###########################################################
314 ############### Generated Source files
315 ###########################################################
328 # Because DOS del will only accept one file name to delete,
329 # the _H_ files work only on sets that have just one file.
330 # Z3950_H_FILES had to be spelled out. One more point for MS!
332 ########### check directories and create if needed
333 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
335 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
336 if not exist "$@/$(NUL)" mkdir "$@"