1 # Copyright (C) 1993-2004, Index Data ApS
3 # $Id: makefile,v 1.3 2005-02-07 13:29:38 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.12.win32
23 # libxml2 (used by libxslt)
25 LIBXML2_DIR=c:\libxml2-2.6.15.win32
27 # zlib compression (used by libxml2)
28 ZLIB_DIR = c:\zlib-1.2.1.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 ###########################################################
81 YAZ_LIB="$(YAZ_DIR)\lib\yaz.lib"
82 YAZ_DEF=/I"$(YAZ_DIR)\include"
83 yaz: $(BINDIR)\yaz.dll $(BINDIR)\yaz.dll
85 $(BINDIR)\yaz.dll: $(YAZ_DIR)\bin\yaz.dll
86 copy "$(YAZ_DIR)\bin\yaz.dll" $(BINDIR)
89 YAZPP_LIB="$(YAZPP_DIR)\lib\yazpp.lib"
90 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
91 yazpp: $(BINDIR)\yazpp.dll $(BINDIR)\yazpp.dll
93 $(BINDIR)\yazpp.dll: $(YAZPP_DIR)\bin\yazpp.dll
94 copy "$(YAZPP_DIR)\bin\yazpp.dll" $(BINDIR)
99 /I"$(ICONV_DIR)\include"
101 "$(ICONV_DIR)\lib\iconv.lib"
102 iconv: $(BINDIR)\iconv.dll
105 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
115 LIBXML2_LIB="$(LIBXML2_DIR)\lib\libxml2.lib"
116 LIBXML2_DEF=/D HAVE_XML2=1 /I"$(LIBXML2_DIR)\include"
117 libxml2: $(BINDIR)\libxml2.dll $(BINDIR)\zlib1.dll
119 $(BINDIR)\libxml2.dll:
120 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
123 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
127 LIBXML2_DEF=/D HAVE_XML2=0
133 LIBXSLT_LIB="$(LIBXSLT_DIR)\bin\libxslt.lib"
134 LIBXSLT_DEF=/D HAVE_XSLT=1 /I"$(LIBXSLT_DIR)\include"
135 libxslt: $(BINDIR)\libxslt.dll $(BINDIR)\zlib1.dll
137 $(BINDIR)\libxslt.dll:
138 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
142 LIBXSLT_DEF=/D HAVE_XSLT=0
148 ### C and CPP compiler (the same thing)
149 # Note: $(CPP) has already been defined in the environment
150 # (if you set things up right!)
153 /nologo /W3 /GX /FD /c \
161 /D "HAVE_WCHAR_H=1" \
167 /I"$(ROOTDIR)\include"
177 # /W3 = warning level
178 # /GX = Enable exception handling
179 # /FD = Generate file dependencies (what ever they are)
180 # /c = compile without linking
181 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
182 # /Fo = object file name (or at least path)
183 # /Fd = debug database name (or path)
184 # /MD = Runtime library: Multithread DLL
185 # /MDd = Runtime library: Multithread DLL (debug)
186 # /Od = Disable optimising (debug)
187 # /O2 = Optimize for speed
188 # /YX = Automatic use of precomipled headers
189 # /Gm = Minimal rebuild (some cpp class stuff)
190 # /Zi = Program database for debuggers
191 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
197 LINK_LIBS= kernel32.lib user32.lib gdi32.lib \
198 advapi32.lib uuid.lib \
199 wsock32.lib advapi32.lib \
200 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB)
202 COMMON_LNK_OPTIONS= /nologo \
207 DEBUG_LNK_OPTIONS= /debug
211 DLL_LINK_OPTIONS= /dll
212 CLIENT_LINK_OPTIONS = /subsystem:console
214 # Final opt variables
216 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
217 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
218 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
219 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
220 TCLOPT= $(COMMON_TCL_OPTIONS)
223 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
224 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
225 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
226 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
227 TCLOPT= $(COMMON_TCL_OPTIONS)
230 ###########################################################
231 ############### Source and object modules
232 ###########################################################
235 "$(OBJDIR)\yaz-proxy-main.obj"
237 YAZPROXY_DLL_OBJS = \
238 "$(OBJDIR)\yaz-proxy.obj" \
239 "$(OBJDIR)\yaz-proxy-config.obj" \
240 "$(OBJDIR)\yaz-usemarcon.obj" \
241 "$(OBJDIR)\yaz-bw.obj"
243 ###########################################################
244 ############### Compiling
245 ###########################################################
247 # Note: This defines where to look for the necessary
248 # source files. Funny way of doing it, but it works.
250 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
253 ###########################################################
254 ############### Resources
255 ###########################################################
257 ### The RC compiler (resource files)
259 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
260 DEBUG_RC_OPTIONS=/d "_DEBUG"
261 RELEASE_RC_OPTIONS=/d "NDEBUG"
263 YAZ_RES=$(OBJDIR)\yaz.res
264 YAZ_RC=$(WINDIR)\yaz.rc
272 $(YAZ_RES): $(YAZ_RC)
273 $(RSC) $(RSOPT) /fo"$(YAZ_RES)" $(YAZ_RC)
275 ###########################################################
276 ############### Linking
277 ###########################################################
279 $(YAZPROXY_DLL) $(YAZPROXY_IMPLIB): "$(BINDIR)" $(YAZPROXY_DLL_OBJS)
280 @echo Linking $(YAZPROXY_DLL)
288 /implib:"$(YAZPROXY_IMPLIB)"
289 /map:"$(LIBDIR)\yazproxy.map"
292 $(YAZPROXY) : "$(BINDIR)" $(YAZPROXY_OBJS) $(YAZPROXY_IMPLIB)
293 @echo Linking $(YAZPROXY)
296 $(CLIENT_LINK_OPTIONS)
301 /map:"$(LIBDIR)\yazproxy.map"
305 ###########################################################
306 ############### Generated Source files
307 ###########################################################
320 # Because DOS del will only accept one file name to delete,
321 # the _H_ files work only on sets that have just one file.
322 # Z3950_H_FILES had to be spelled out. One more point for MS!
324 ########### check directories and create if needed
325 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
327 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
328 if not exist "$@/$(NUL)" mkdir "$@"