1 # Copyright (C) 1999-2006, Index Data ApS
3 # $Id: makefile,v 1.8 2006-04-30 14:09:31 adam Exp $
5 ###########################################################
6 ############### Parameters
7 ###########################################################
9 DEBUG=1 # 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 # The current directory is supposed to be something like
46 # ..../yaz/win, everything is relative to that
47 ROOTDIR=.. # The home of yaz++
49 INCLDIR=$(ROOTDIR)\include # our includes
50 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
51 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
52 WINDIR=$(ROOTDIR)\win # all these Win make things
53 SRCDIR=$(ROOTDIR)\src # for the case we move them under src
54 PROXYDIR=$(ROOTDIR)\proxy
55 ZOOMDIR=$(ROOTDIR)\zoom
58 OBJDIR=$(WINDIR)\dobj # where we store intermediate files
60 OBJDIR=$(WINDIR)\obj # where we store intermediate files
63 TMPDIR=$(ROOTDIR)\win\tmp
66 YAZPROXY_DLL=$(BINDIR)\yazproxy.dll
67 YAZPROXY_IMPLIB=$(LIBDIR)\yazproxy.lib
69 YAZPROXY=$(BINDIR)\yazproxy.exe
71 # shortcut names defined here
84 YAZ_LIB="$(YAZ_DIR)\lib\$(YAZD).lib"
85 YAZ_DEF=/DYAZ_USE_NEW_LOG=1 /I"$(YAZ_DIR)\include"
87 # Copy yaz.dll to our bin
88 yaz: $(BINDIR)\$(YAZD).dll
89 $(BINDIR)\$(YAZD).dll: $(YAZ_DIR)\bin\$(YAZD).dll
90 copy "$(YAZ_DIR)\bin\$(YAZD).dll" $(BINDIR)
92 # YAZ++ includes & libs
93 YAZPP_LIB="$(YAZPP_DIR)\lib\$(YAZPPD).lib"
94 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
96 # Copy yazpp.dll to our bin
97 yazpp: $(BINDIR)\$(YAZPPD).dll
98 $(BINDIR)\$(YAZPPD).dll: $(YAZPP_DIR)\bin\$(YAZPPD).dll
99 copy "$(YAZPP_DIR)\bin\$(YAZPPD).dll" $(BINDIR)
104 /I"$(ICONV_DIR)\include"
106 "$(ICONV_DIR)\lib\iconv.lib"
107 iconv: $(BINDIR)\iconv.dll
110 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
120 LIBXML2_LIB="$(LIBXML2_DIR)\lib\libxml2.lib"
121 LIBXML2_DEF=/D HAVE_XML2=1 /I"$(LIBXML2_DIR)\include"
122 libxml2: $(BINDIR)\libxml2.dll $(BINDIR)\zlib1.dll
124 $(BINDIR)\libxml2.dll:
125 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
128 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
132 LIBXML2_DEF=/D HAVE_XML2=0
138 LIBXSLT_LIB="$(LIBXSLT_DIR)\lib\libxslt.lib"
139 LIBXSLT_DEF=/D HAVE_XSLT=1 /I"$(LIBXSLT_DIR)\include"
140 libxslt: $(BINDIR)\libxslt.dll $(BINDIR)\zlib1.dll
142 $(BINDIR)\libxslt.dll:
143 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
147 LIBXSLT_DEF=/D HAVE_XSLT=0
153 ### C and CPP compiler (the same thing)
154 # Note: $(CPP) has already been defined in the environment
155 # (if you set things up right!)
158 /nologo /W3 /EHsc /FD /c \
159 /D "_CRT_SECURE_NO_DEPRECATE" \
167 /D "HAVE_WCHAR_H=1" \
173 /I"$(ROOTDIR)\include"
183 # /W3 = warning level
184 # /EHsc= Enable exception handling
185 # /FD = Generate file dependencies (what ever they are)
186 # /c = compile without linking
187 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
188 # /Fo = object file name (or at least path)
189 # /Fd = debug database name (or path)
190 # /MD = Runtime library: Multithread DLL
191 # /MDd = Runtime library: Multithread DLL (debug)
192 # /Od = Disable optimising (debug)
193 # /O2 = Optimize for speed
194 # /Gm = Minimal rebuild (some cpp class stuff)
195 # /Zi = Program database for debuggers
196 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
202 LINK_LIBS=kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib \
203 wsock32.lib advapi32.lib \
204 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB)
212 DEBUG_LNK_OPTIONS= /debug
216 DLL_LINK_OPTIONS= /dll
217 CLIENT_LINK_OPTIONS = /subsystem:console
219 # Final opt variables
221 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
222 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
223 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
224 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
225 TCLOPT= $(COMMON_TCL_OPTIONS)
228 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
229 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
230 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
231 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
232 TCLOPT= $(COMMON_TCL_OPTIONS)
235 # Source and object modules
238 "$(OBJDIR)\yaz-proxy-main.obj"
240 YAZPROXY_DLL_OBJS = \
241 "$(OBJDIR)\yaz-proxy.obj" \
242 "$(OBJDIR)\yaz-proxy-config.obj" \
243 "$(OBJDIR)\yaz-usemarcon.obj" \
244 "$(OBJDIR)\msg-thread.obj" \
245 "$(OBJDIR)\charset-converter.obj" \
246 "$(OBJDIR)\limit-connect.obj" \
247 "$(OBJDIR)\modules.obj" \
248 "$(OBJDIR)\yaz-bw.obj"
250 ###########################################################
251 ############### Compiling
252 ###########################################################
254 # Note: This defines where to look for the necessary
255 # source files. Funny way of doing it, but it works.
257 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
260 ###########################################################
261 ############### Resources
262 ###########################################################
264 ### The RC compiler (resource files)
266 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
267 DEBUG_RC_OPTIONS=/d "_DEBUG"
268 RELEASE_RC_OPTIONS=/d "NDEBUG"
276 ###########################################################
277 ############### Linking
278 ###########################################################
280 $(YAZPROXY_DLL) $(YAZPROXY_IMPLIB): "$(BINDIR)" $(YAZPROXY_DLL_OBJS)
284 $(DLL_LINK_OPTIONS) \
286 $(YAZPROXY_DLL_OBJS) \
287 /out:$(YAZPROXY_DLL) \
288 /implib:"$(YAZPROXY_IMPLIB)" \
290 $(YAZPROXY) : "$(BINDIR)" $(YAZPROXY_OBJS) $(YAZPROXY_IMPLIB)
293 $(CLIENT_LINK_OPTIONS) \
309 ########### check directories and create if needed
310 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
312 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
313 if not exist "$@/$(NUL)" mkdir "$@"