1 # Zebra makefile for MS NMAKE
2 # $Id: makefile,v 1.24 2003-09-22 12:35:58 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.4
16 ICONV_DIR = c:\iconv-1.8.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-2.0.4
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
74 ###########################################################
75 ############### Targets - what to make
76 ###########################################################
78 ZEBRALIB=$(LIBDIR)\zebra.lib
79 ZSERVER=$(BINDIR)\zebrasrv.exe
80 ZINDEX=$(BINDIR)\zebraidx.exe
81 APITEST=$(BINDIR)\apitest.exe
83 # shortcut names defined here
89 ###########################################################
90 ############### Compiler and linker options
91 ###########################################################
94 EXPAT_DEF= /D HAVE_EXPAT_H=1 /I"$(EXPAT_DIR)\source\lib"
95 EXPAT_LIB= "$(EXPAT_DIR)\libs\libexpat.lib"
96 EXPAT_DLL_SOURCE= "$(EXPAT_DIR)\libs\libexpat.dll"
97 EXPAT_DLL_TARGET="$(BINDIR)\libexpat.dll"
98 $(EXPAT_DLL_TARGET) : $(EXPAT_DLL_SOURCE)
99 copy $(EXPAT_DLL_SOURCE) $(EXPAT_DLL_TARGET)
101 EXPAT_DEF= /D HAVE_EXPAT_H=0
108 ICONV_DEF= /D HAVE_ICONV_H=1 /I"$(ICONV_DIR)\include"
109 ICONV_LIB= $(ICONV_DIR)\lib\iconv.lib
111 ICONV_DEF= /D HAVE_ICONV_H=0
115 ### C and CPP compiler (the same thing)
116 # Note: $(CPP) has already been defined in the environment
117 # (if you set things up right!)
120 /nologo /W3 /GX /FD /c \
122 /D"_CONSOLE" /D"_MBCS" \
128 /DDEFAULT_PROFILE_PATH=0 \
132 /I"$(SRCDIR)\include" \
133 /I"$(YAZDIR)\include" \
144 # /W3 = warning level
145 # /GX = Enable exception handling
146 # /FD = Generate file dependencies (what ever they are)
147 # /c = compile without linking
148 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
149 # /Fo = object file name (or at least path)
150 # /Fd = debug database name (or path)
151 # /MD = Runtime library: Multithread DLL
152 # /MDd = Runtime library: Multithread DLL (debug)
153 # /Od = Disable optimising (debug)
154 # /O2 = Optimize for speed
155 # /YX = Automatic use of precomipled headers
156 # /Gm = Minimal rebuild (some cpp class stuff)
157 # /Zi = Program database for debuggers
158 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
163 LINK_LIBS= kernel32.lib user32.lib gdi32.lib winspool.lib \
164 comdlg32.lib advapi32.lib shell32.lib ole32.lib \
165 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
166 wsock32.lib advapi32.lib $(ICONV_LIB) $(EXPAT_LIB)
168 COMMON_LNK_OPTIONS= /nologo \
172 # /subsystem:windows \
174 DEBUG_LNK_OPTIONS= /debug
176 RELEASE_LNK_OPTIONS= /pdb:none
178 ZEBRALIB_LINK_OPTIONS = -lib
180 ZSERVER_LINK_OPTIONS = /subsystem:console
181 ZINDEX_LINK_OPTIONS = /subsystem:console
182 APITEST_LINK_OPTIONS = /subsystem:console
184 # Final opt variables
186 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
187 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
188 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
189 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
192 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
193 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
194 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
195 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
198 ###########################################################
199 ############### Source and object modules
200 ###########################################################
202 # Note: Ordinary source files are not specified here at
203 # all, make finds them in suitable dirs. The object modules
204 # need to be specified, though
207 $(OBJDIR)\zserver.obj
212 $(OBJDIR)\apitest.obj
216 $(OBJDIR)\isamc.obj \
217 $(OBJDIR)\isamd.obj \
218 $(OBJDIR)\isutil.obj \
219 $(OBJDIR)\memory.obj \
220 $(OBJDIR)\merge.obj \
221 $(OBJDIR)\merge-d.obj \
222 $(OBJDIR)\physical.obj \
223 $(OBJDIR)\rootblk.obj \
224 $(OBJDIR)\zebra-lock.obj \
225 $(OBJDIR)\attribute.obj \
226 $(OBJDIR)\bfile.obj \
228 $(OBJDIR)\cfile.obj \
229 $(OBJDIR)\charmap.obj \
230 $(OBJDIR)\close.obj \
231 $(OBJDIR)\commit.obj \
232 $(OBJDIR)\compact.obj \
233 $(OBJDIR)\dclose.obj \
234 $(OBJDIR)\dcompact.obj \
235 $(OBJDIR)\delete.obj \
237 $(OBJDIR)\dirent.obj \
238 $(OBJDIR)\dopen.obj \
239 $(OBJDIR)\drdwr.obj \
240 $(OBJDIR)\imalloc.obj \
241 $(OBJDIR)\insert.obj \
242 $(OBJDIR)\invstat.obj \
243 $(OBJDIR)\kcompare.obj \
244 $(OBJDIR)\lockutil.obj \
245 $(OBJDIR)\lookgrep.obj \
246 $(OBJDIR)\lookup.obj \
247 $(OBJDIR)\lookupec.obj \
248 $(OBJDIR)\marcread.obj \
249 $(OBJDIR)\marcomp.obj \
250 $(OBJDIR)\inline.obj \
251 $(OBJDIR)\mfile.obj \
253 $(OBJDIR)\passwddb.obj \
254 $(OBJDIR)\zvrank.obj \
255 $(OBJDIR)\rank1.obj \
256 $(OBJDIR)\livcode.obj \
257 $(OBJDIR)\readfile.obj \
258 $(OBJDIR)\recctrl.obj \
259 $(OBJDIR)\recgrs.obj \
260 $(OBJDIR)\recindex.obj \
261 $(OBJDIR)\recstat.obj \
262 $(OBJDIR)\rectext.obj \
263 $(OBJDIR)\regxread.obj \
264 $(OBJDIR)\xmlread.obj \
266 $(OBJDIR)\retrieve.obj \
267 $(OBJDIR)\rsbool.obj \
269 $(OBJDIR)\rsisam.obj \
270 $(OBJDIR)\rsisamc.obj \
271 $(OBJDIR)\rsm_or.obj \
272 $(OBJDIR)\rsnull.obj \
273 $(OBJDIR)\rstemp.obj \
276 $(OBJDIR)\sgmlread.obj \
277 $(OBJDIR)\sortidx.obj \
278 $(OBJDIR)\states.obj \
279 $(OBJDIR)\symtab.obj \
280 $(OBJDIR)\trunc.obj \
281 $(OBJDIR)\zebraapi.obj \
282 $(OBJDIR)\zebramap.obj \
283 $(OBJDIR)\zinfo.obj \
285 $(OBJDIR)\zsets.obj \
286 $(OBJDIR)\isams.obj \
287 $(OBJDIR)\isamb.obj \
288 $(OBJDIR)\rsisamd.obj \
289 $(OBJDIR)\rsisamb.obj \
290 $(OBJDIR)\rsbetween.obj \
293 $(OBJDIR)\extract.obj \
294 $(OBJDIR)\kinput.obj \
295 $(OBJDIR)\rsisams.obj \
297 $(OBJDIR)\d1_absyn.obj \
298 $(OBJDIR)\d1_attset.obj \
299 $(OBJDIR)\d1_doespec.obj \
300 $(OBJDIR)\d1_espec.obj \
301 $(OBJDIR)\d1_expout.obj \
302 $(OBJDIR)\d1_grs.obj \
303 $(OBJDIR)\d1_handle.obj \
304 $(OBJDIR)\d1_if.obj \
305 $(OBJDIR)\d1_map.obj \
306 $(OBJDIR)\d1_marc.obj \
307 $(OBJDIR)\d1_prtree.obj \
308 $(OBJDIR)\d1_read.obj \
309 $(OBJDIR)\d1_soif.obj \
310 $(OBJDIR)\d1_sumout.obj \
311 $(OBJDIR)\d1_sutrs.obj \
312 $(OBJDIR)\d1_tagset.obj \
313 $(OBJDIR)\d1_varset.obj \
314 $(OBJDIR)\d1_write.obj \
323 ###########################################################
324 ############### Compiling
325 ###########################################################
327 # Note: This defines where to look for the necessary
328 # source files. Funny way of doing it, but it works.
330 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
333 {$(SRCDIR)}.c{$(OBJDIR)}.obj:
337 {$(INDEXDIR)}.c{$(OBJDIR)}.obj:
340 {$(BFILEDIR)}.c{$(OBJDIR)}.obj:
343 {$(DFADIR)}.c{$(OBJDIR)}.obj:
346 {$(DICTDIR)}.c{$(OBJDIR)}.obj:
349 {$(ISAMSDIR)}.c{$(OBJDIR)}.obj:
352 {$(ISAMDIR)}.c{$(OBJDIR)}.obj:
355 {$(ISAMCDIR)}.c{$(OBJDIR)}.obj:
358 {$(ISAMBDIR)}.c{$(OBJDIR)}.obj:
361 {$(RECCTRLDIR)}.c{$(OBJDIR)}.obj:
364 {$(RSETDIR)}.c{$(OBJDIR)}.obj:
367 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
370 {$(DATA1DIR)}.c{$(OBJDIR)}.obj:
373 {$(APITESTDIR)}.c{$(OBJDIR)}.obj:
376 ###########################################################
377 ############### Linking
378 ###########################################################
380 $(ZSERVER) : "$(BINDIR)" $(ZSERVER_OBJS) $(ZEBRALIB) $(YAZLIBS)
381 @echo Linking the server $(ZSERVER)
384 $(ZSERVER_LINK_OPTIONS)
393 $(ZINDEX) : "$(BINDIR)" $(ZEBRAIDX_OBJS) $(ZEBRALIB) $(YAZLIBS)
394 @echo Linking the indexer $(ZINDEX)
397 $(ZINDEX_LINK_OPTIONS)
406 $(APITEST) : "$(BINDIR)" $(APITEST_OBJS) $(ZEBRALIB) $(YAZLIBS)
407 @echo Linking the test program $(APITEST)
410 $(APITEST_LINK_OPTIONS)
419 $(ZEBRALIB) : "$(BINDIR)" $(ZEBRALIB_OBJS)
420 @echo Linking library $(ZEBRALIB)
421 $(LINK) $(ZEBRALIB_LINK_OPTIONS) @<<
427 ###########################################################
428 ############### Special operations
429 ###########################################################
439 ########### check directories and create if needed
440 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR) \
441 $(EXPAT_DLL_TARGET) $(YAZ_DLL_TARGET)
443 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
444 if not exist "$@/$(NUL)" mkdir "$@"
446 $(YAZ_DLL_TARGET) : $(YAZ_DLL_SOURCE)
447 copy $(YAZ_DLL_SOURCE) $(YAZ_DLL_TARGET)
449 ###########################################################
450 ############### Explicit dependencies
451 ###########################################################
453 # $(ALL_OBJS): makefile
455 # force recompilation of everything, if makefile changed
457 ###########################################################