1 # Zebra makefile for MS NMAKE
2 # $Id: makefile,v 1.30 2004-08-25 09:18:49 adam Exp $
4 ###########################################################
5 ############### Parameters
6 ###########################################################
8 DEBUG=0 # 0 for release, 1 for debug
10 # EXPAT is optional. It's required for grs.xml-filters.
12 EXPAT_DIR= c:\Expat-1.95.7
16 ICONV_DIR = c:\iconv-1.9.1.win32
20 all: dirs zebralib zserver zindex
22 ###########################################################
23 ############### Directories
24 ###########################################################
25 # The current directory is supposed to be something like
26 # ..../Zebra/Win, everything is relative to that
27 ROOTDIR=.. # The home of zebra
29 # YAZ include files, libraries, etc.
30 YAZDIR=$(ROOTDIR)\..\YAZ
31 YAZINCL=$(YAZDIR)\include
32 YAZLIB=$(YAZDIR)\lib\yaz.lib
34 YAZBINDIR=$(YAZDIR)\bin
35 YAZ_DLL_SOURCE=$(YAZBINDIR)\yaz.dll
36 YAZ_DLL_TARGET=$(BINDIR)\yaz.dll
38 # BZIP2 settings. Uncomment and specify if you wish to use LIBBZIP2.
39 # (C) 1996-1999 Julian Seward <jseward@acm.org> http://www.bzip2.org
41 #BZIP2INCLUDE=/I"$(ROOTDIR)\..\bzip2-0.9.5d"
42 #BZIP2LIB=$(ROOTDIR)\..\bzip2-0.9.5d\libbz2.lib
43 #BZIP2DEF=/D"HAVE_BZLIB_H=1"
45 # ZEBRA Include files, libraries, programs, etc.
46 INCLDIR=$(ROOTDIR)\include # our includes
47 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
48 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
49 WINDIR=$(ROOTDIR)\win # all these Win make things
50 OBJDIR=$(WINDIR)\obj # where we store intermediate files
51 UNIXDIR=$(ROOTDIR)\unix # corresponding unix things
52 SRCDIR=$(ROOTDIR) # for the case we move them under src
54 INDEXDIR=$(SRCDIR)\INDEX
55 BFILEDIR=$(SRCDIR)\BFILE
57 DICTDIR=$(SRCDIR)\DICT
58 ISAMSDIR=$(SRCDIR)\ISAMS
59 ISAMDIR=$(SRCDIR)\ISAM
60 ISAMCDIR=$(SRCDIR)\ISAMC
61 ISAMBDIR=$(SRCDIR)\ISAMB
62 RECCTRLDIR=$(SRCDIR)\RECCTRL
63 RSETDIR=$(SRCDIR)\RSET
64 UTILDIR=$(SRCDIR)\UTIL
65 DATA1DIR=$(SRCDIR)\DATA1
66 APITESTDIR=$(SRCDIR)\APITEST
68 # Force temp files in a local temp, easier to clean
69 # when nmake crashes and leaves a lot of rubbish behind
70 TMPDIR=$(ROOTDIR)\win\tmp
75 NSIS="c:\program files\nsis\makensis.exe"
86 ###########################################################
87 ############### Targets - what to make
88 ###########################################################
90 ZEBRALIB=$(LIBDIR)\zebra.lib
91 ZSERVER=$(BINDIR)\zebrasrv.exe
92 ZINDEX=$(BINDIR)\zebraidx.exe
93 APITEST=$(BINDIR)\apitest.exe
95 # shortcut names defined here
101 ###########################################################
102 ############### Compiler and linker options
103 ###########################################################
106 EXPAT_DEF= /D HAVE_EXPAT_H=1 /I"$(EXPAT_DIR)\source\lib"
107 EXPAT_LIB= "$(EXPAT_DIR)\libs\libexpat.lib"
108 EXPAT_DLL_SOURCE= "$(EXPAT_DIR)\libs\libexpat.dll"
109 EXPAT_DLL_TARGET="$(BINDIR)\libexpat.dll"
110 $(EXPAT_DLL_TARGET) : $(EXPAT_DLL_SOURCE)
111 copy $(EXPAT_DLL_SOURCE) $(EXPAT_DLL_TARGET)
113 EXPAT_DEF= /D HAVE_EXPAT_H=0
120 ICONV_DEF= /D HAVE_ICONV_H=1 /I"$(ICONV_DIR)\include"
121 ICONV_LIB= $(ICONV_DIR)\lib\iconv.lib
123 ICONV_DEF= /D HAVE_ICONV_H=0
127 ### C and CPP compiler (the same thing)
128 # Note: $(CPP) has already been defined in the environment
129 # (if you set things up right!)
132 /nologo /W3 /GX /FD /c \
134 /D"_CONSOLE" /D"_MBCS" \
140 /DDEFAULT_PROFILE_PATH=0 \
144 /I"$(SRCDIR)\include" \
145 /I"$(YAZDIR)\include" \
156 # /W3 = warning level
157 # /GX = Enable exception handling
158 # /FD = Generate file dependencies (what ever they are)
159 # /c = compile without linking
160 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
161 # /Fo = object file name (or at least path)
162 # /Fd = debug database name (or path)
163 # /MD = Runtime library: Multithread DLL
164 # /MDd = Runtime library: Multithread DLL (debug)
165 # /Od = Disable optimising (debug)
166 # /O2 = Optimize for speed
167 # /YX = Automatic use of precomipled headers
168 # /Gm = Minimal rebuild (some cpp class stuff)
169 # /Zi = Program database for debuggers
170 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
175 LINK_LIBS= kernel32.lib user32.lib gdi32.lib winspool.lib \
176 comdlg32.lib advapi32.lib shell32.lib ole32.lib \
177 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
178 wsock32.lib advapi32.lib $(ICONV_LIB) $(EXPAT_LIB)
180 COMMON_LNK_OPTIONS= /nologo /machine:i386 /incremental:no
182 DEBUG_LNK_OPTIONS= /debug
186 ZEBRALIB_LINK_OPTIONS= -lib
188 ZSERVER_LINK_OPTIONS= /subsystem:console
189 ZINDEX_LINK_OPTIONS= /subsystem:console
190 APITEST_LINK_OPTIONS= /subsystem:console
192 # Final opt variables
194 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
195 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
196 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
197 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
200 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
201 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
202 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
203 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
206 ###########################################################
207 ############### Source and object modules
208 ###########################################################
210 # Note: Ordinary source files are not specified here at
211 # all, make finds them in suitable dirs. The object modules
212 # need to be specified, though
215 $(OBJDIR)\zserver.obj
220 $(OBJDIR)\apitest.obj
223 $(OBJDIR)\isamc.obj \
224 $(OBJDIR)\merge.obj \
225 $(OBJDIR)\zebra-lock.obj \
226 $(OBJDIR)\attribute.obj \
227 $(OBJDIR)\bfile.obj \
229 $(OBJDIR)\cfile.obj \
230 $(OBJDIR)\charmap.obj \
231 $(OBJDIR)\atoi_zn.obj \
232 $(OBJDIR)\close.obj \
233 $(OBJDIR)\commit.obj \
234 $(OBJDIR)\compact.obj \
235 $(OBJDIR)\dclose.obj \
236 $(OBJDIR)\dcompact.obj \
237 $(OBJDIR)\delete.obj \
239 $(OBJDIR)\dirent.obj \
240 $(OBJDIR)\dopen.obj \
241 $(OBJDIR)\drdwr.obj \
242 $(OBJDIR)\imalloc.obj \
243 $(OBJDIR)\insert.obj \
244 $(OBJDIR)\invstat.obj \
245 $(OBJDIR)\kcompare.obj \
246 $(OBJDIR)\lockutil.obj \
247 $(OBJDIR)\lookgrep.obj \
248 $(OBJDIR)\lookup.obj \
249 $(OBJDIR)\lookupec.obj \
250 $(OBJDIR)\marcread.obj \
251 $(OBJDIR)\marcomp.obj \
252 $(OBJDIR)\inline.obj \
253 $(OBJDIR)\mfile.obj \
255 $(OBJDIR)\passwddb.obj \
256 $(OBJDIR)\zvrank.obj \
257 $(OBJDIR)\rank1.obj \
258 $(OBJDIR)\livcode.obj \
259 $(OBJDIR)\readfile.obj \
260 $(OBJDIR)\recctrl.obj \
261 $(OBJDIR)\recgrs.obj \
262 $(OBJDIR)\recindex.obj \
263 $(OBJDIR)\recstat.obj \
264 $(OBJDIR)\rectext.obj \
265 $(OBJDIR)\regxread.obj \
266 $(OBJDIR)\xmlread.obj \
267 $(OBJDIR)\danbibr.obj \
269 $(OBJDIR)\retrieve.obj \
270 $(OBJDIR)\rsbool.obj \
272 $(OBJDIR)\rsisamc.obj \
273 $(OBJDIR)\rsmultior.obj \
274 $(OBJDIR)\rsnull.obj \
275 $(OBJDIR)\rstemp.obj \
278 $(OBJDIR)\sgmlread.obj \
279 $(OBJDIR)\sortidx.obj \
280 $(OBJDIR)\states.obj \
281 $(OBJDIR)\symtab.obj \
282 $(OBJDIR)\trunc.obj \
283 $(OBJDIR)\zebraapi.obj \
284 $(OBJDIR)\zebramap.obj \
285 $(OBJDIR)\zinfo.obj \
287 $(OBJDIR)\zsets.obj \
288 $(OBJDIR)\isams.obj \
289 $(OBJDIR)\isamb.obj \
290 $(OBJDIR)\rsisamb.obj \
291 $(OBJDIR)\rsbetween.obj \
292 $(OBJDIR)\rsprox.obj \
295 $(OBJDIR)\extract.obj \
296 $(OBJDIR)\kinput.obj \
297 $(OBJDIR)\rsisams.obj \
299 $(OBJDIR)\d1_absyn.obj \
300 $(OBJDIR)\d1_attset.obj \
301 $(OBJDIR)\d1_doespec.obj \
302 $(OBJDIR)\d1_espec.obj \
303 $(OBJDIR)\d1_expout.obj \
304 $(OBJDIR)\d1_grs.obj \
305 $(OBJDIR)\d1_handle.obj \
306 $(OBJDIR)\d1_if.obj \
307 $(OBJDIR)\d1_map.obj \
308 $(OBJDIR)\d1_marc.obj \
309 $(OBJDIR)\d1_prtree.obj \
310 $(OBJDIR)\d1_read.obj \
311 $(OBJDIR)\d1_soif.obj \
312 $(OBJDIR)\d1_sumout.obj \
313 $(OBJDIR)\d1_sutrs.obj \
314 $(OBJDIR)\d1_tagset.obj \
315 $(OBJDIR)\d1_varset.obj \
316 $(OBJDIR)\d1_write.obj \
325 ###########################################################
326 ############### Compiling
327 ###########################################################
329 # Note: This defines where to look for the necessary
330 # source files. Funny way of doing it, but it works.
332 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
335 {$(SRCDIR)}.c{$(OBJDIR)}.obj:
339 {$(INDEXDIR)}.c{$(OBJDIR)}.obj:
342 {$(BFILEDIR)}.c{$(OBJDIR)}.obj:
345 {$(DFADIR)}.c{$(OBJDIR)}.obj:
348 {$(DICTDIR)}.c{$(OBJDIR)}.obj:
351 {$(ISAMSDIR)}.c{$(OBJDIR)}.obj:
354 {$(ISAMDIR)}.c{$(OBJDIR)}.obj:
357 {$(ISAMCDIR)}.c{$(OBJDIR)}.obj:
360 {$(ISAMBDIR)}.c{$(OBJDIR)}.obj:
363 {$(RECCTRLDIR)}.c{$(OBJDIR)}.obj:
366 {$(RSETDIR)}.c{$(OBJDIR)}.obj:
369 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
372 {$(DATA1DIR)}.c{$(OBJDIR)}.obj:
375 {$(APITESTDIR)}.c{$(OBJDIR)}.obj:
378 ###########################################################
379 ############### Linking
380 ###########################################################
382 $(ZSERVER) : "$(BINDIR)" $(ZSERVER_OBJS) $(ZEBRALIB) $(YAZLIBS)
383 @echo Linking the server $(ZSERVER)
386 $(ZSERVER_LINK_OPTIONS)
395 $(ZINDEX) : "$(BINDIR)" $(ZEBRAIDX_OBJS) $(ZEBRALIB) $(YAZLIBS)
396 @echo Linking the indexer $(ZINDEX)
399 $(ZINDEX_LINK_OPTIONS)
408 $(APITEST) : "$(BINDIR)" $(APITEST_OBJS) $(ZEBRALIB) $(YAZLIBS)
409 @echo Linking the test program $(APITEST)
412 $(APITEST_LINK_OPTIONS)
421 $(ZEBRALIB) : "$(BINDIR)" $(ZEBRALIB_OBJS)
422 @echo Linking library $(ZEBRALIB)
423 $(LINK) $(ZEBRALIB_LINK_OPTIONS) @<<
429 ###########################################################
430 ############### Special operations
431 ###########################################################
440 ########### check directories and create if needed
441 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR) \
442 $(EXPAT_DLL_TARGET) $(YAZ_DLL_TARGET)
444 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
445 if not exist "$@/$(NUL)" mkdir "$@"
447 $(YAZ_DLL_TARGET) : $(YAZ_DLL_SOURCE)
448 copy $(YAZ_DLL_SOURCE) $(YAZ_DLL_TARGET)
450 ###########################################################
451 ############### Explicit dependencies
452 ###########################################################
454 # $(ALL_OBJS): makefile
456 # force recompilation of everything, if makefile changed
458 ###########################################################