1 # Makefile.mak - makefile for MS NMAKE
2 # $Id: makefile,v 1.11 1999-12-21 14:16:20 ian Exp $
5 # HL: Heikki Levanto, Index Data
7 # Log at the end of the file
10 # - Move MS-C's whatnots into win direcotry
11 # - The TCL script produces C and H files in the same dir as the
12 # ASN files. H's are copied to INCL, C's are left there.
13 # They should be produced into OBJ...
15 # Envoronment problems
16 # - You need to have the proper path and environment for VC set
17 # up. There is a bat file VCVARS32.BAT that sets most of it up
18 # for you. You can find this somewhere near DevStudio\VC\BIN
19 # - RegSvr32 must also be along the path, often in WINDOWS\SYSTEM
20 # - TCL has to be available too, if compiling for NEW_Z3950
22 ###########################################################
23 ############### Parameters
24 ###########################################################
26 DEBUG=0 # 0 for release, 1 for debug
28 NEW_Z3950=1 # 0= use old asn files
29 # 1= generate files from *.asn (needs tcl)
34 all: dirs proto_h dll client server ztest
36 generate: generated_files
38 ###########################################################
39 ############### Directories
40 ###########################################################
41 # The current directory is supposed to be something like
42 # ..../Yaz/Win, everything is relative to that
43 ROOTDIR=.. # The home of Yaz
45 INCLDIR=$(ROOTDIR)\include # our includes
46 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
47 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
48 WINDIR=$(ROOTDIR)\win # all these Win make things
49 OBJDIR=$(WINDIR)\obj # where we store intermediate files
50 UNIXDIR=$(ROOTDIR)\unix # corresponding unix things
51 SRCDIR=$(ROOTDIR) # for the case we move them under src
54 COMSTACKDIR=$(SRCDIR)\COMSTACK
56 UTILDIR=$(SRCDIR)\UTIL
57 ZUTILDIR=$(SRCDIR)\ZUTIL
58 RETDIR=$(SRCDIR)\RETRIEVAL
59 Z3950DIR=$(SRCDIR)\Z39.50
61 CLIENTDIR=$(SRCDIR)\CLIENT
62 SERVERDIR=$(SRCDIR)\SERVER
63 ZTESTDIR=$(SRCDIR)\ZTEST
65 TMPDIR=$(ROOTDIR)\win\tmp
68 ###########################################################
69 ############### Targets - what to make
70 ###########################################################
74 IMPLIB=$(LIBDIR)\Yaz.lib
76 CLIENT=$(BINDIR)\yaz-client.exe
77 SERVER=$(LIBDIR)\server.lib
78 ZTEST=$(BINDIR)\yaz-ztest.exe
79 PROTOH=$(INCLDIR)\yaz\proto.h
81 # shortcut names defined here
88 ###########################################################
89 ############### Compiler and linker options
90 ###########################################################
93 ### C and CPP compiler (the same thing)
94 # Note: $(CPP) has already been defined in the environment
95 # (if you set things up right!)
98 /nologo /W3 /GX /FD /c \
99 /D "WIN32" /D "_WINDOWS" \
105 /I"$(SRCDIR)\include"
115 # /W3 = warning level
116 # /GX = Enable exception handling
117 # /FD = Generate file dependencies (what ever they are)
118 # /c = compile without linking
119 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
120 # /Fo = object file name (or at least path)
121 # /Fd = debug database name (or path)
122 # /MD = Runtime library: Multithread DLL
123 # /MDd = Runtime library: Multithread DLL (debug)
124 # /Od = Disable optimising (debug)
125 # /O2 = Optimize for speed
126 # /YX = Automatic use of precomipled headers
127 # /Gm = Minimal rebuild (some cpp class stuff)
128 # /Zi = Program database for debuggers
129 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
135 LINK_LIBS= kernel32.lib user32.lib gdi32.lib winspool.lib \
136 comdlg32.lib advapi32.lib shell32.lib ole32.lib \
137 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
138 wsock32.lib advapi32.lib
140 COMMON_LNK_OPTIONS= /nologo \
145 DEBUG_LNK_OPTIONS= /debug
147 RELEASE_LNK_OPTIONS= /pdb:none
149 DLL_LINK_OPTIONS= /dll
150 CLIENT_LINK_OPTIONS = /subsystem:console
151 SERVER_LINK_OPTIONS = -lib
152 ZTEST_LINK_OPTIONS = /subsystem:console
155 TCL="C:\Program Files\Tcl\bin\tclsh80.exe"
157 COMMON_TCL_OPTIONS= ..\util\yc.tcl -d z.tcl -I$(INCLDIR) -i yaz
159 # Final opt variables
161 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
162 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
163 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
164 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
165 TCLOPT= $(COMMON_TCL_OPTIONS)
168 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
169 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
170 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
171 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
172 TCLOPT= $(COMMON_TCL_OPTIONS)
177 ###########################################################
178 ############### Source and object modules
179 ###########################################################
181 # Note: Ordinary source files are not specified here at
182 # all, make finds them in suitable dirs. The object modules
183 # need to be specified, though
189 "$(OBJDIR)\eventl.obj" \
190 "$(OBJDIR)\requestq.obj" \
191 "$(OBJDIR)\service.obj" \
192 "$(OBJDIR)\seshigh.obj" \
193 "$(OBJDIR)\statserv.obj" \
194 "$(OBJDIR)\tcpdchk.obj"
197 "$(OBJDIR)\read-grs.obj" \
198 "$(OBJDIR)\ztest.obj"
202 $(OBJDIR)\proto.obj \
203 $(OBJDIR)\prt-acc.obj \
204 $(OBJDIR)\prt-add.obj \
205 $(OBJDIR)\prt-arc.obj \
206 $(OBJDIR)\prt-dat.obj \
207 $(OBJDIR)\prt-dia.obj \
208 $(OBJDIR)\prt-esp.obj \
209 $(OBJDIR)\prt-exd.obj \
210 $(OBJDIR)\prt-exp.obj \
211 $(OBJDIR)\prt-grs.obj \
212 $(OBJDIR)\prt-rsc.obj \
213 $(OBJDIR)\prt-univ.obj
216 $(OBJDIR)\comstack.obj \
217 $(OBJDIR)\tcpip.obj \
218 $(OBJDIR)\waislen.obj
221 $(OBJDIR)\ber_any.obj \
222 $(OBJDIR)\ber_bit.obj \
223 $(OBJDIR)\ber_bool.obj \
224 $(OBJDIR)\ber_int.obj \
225 $(OBJDIR)\ber_len.obj \
226 $(OBJDIR)\ber_null.obj \
227 $(OBJDIR)\ber_oct.obj \
228 $(OBJDIR)\ber_oid.obj \
229 $(OBJDIR)\ber_tag.obj \
230 $(OBJDIR)\dumpber.obj \
232 $(OBJDIR)\odr_any.obj \
233 $(OBJDIR)\odr_bit.obj \
234 $(OBJDIR)\odr_bool.obj \
235 $(OBJDIR)\odr_choice.obj \
236 $(OBJDIR)\odr_cons.obj \
237 $(OBJDIR)\odr_enum.obj \
238 $(OBJDIR)\odr_int.obj \
239 $(OBJDIR)\odr_mem.obj \
240 $(OBJDIR)\odr_null.obj \
241 $(OBJDIR)\odr_oct.obj \
242 $(OBJDIR)\odr_oid.obj \
243 $(OBJDIR)\odr_priv.obj \
244 $(OBJDIR)\odr_seq.obj \
245 $(OBJDIR)\odr_tag.obj \
246 $(OBJDIR)\odr_use.obj \
247 $(OBJDIR)\odr_util.obj
250 $(OBJDIR)\atoin.obj \
252 $(OBJDIR)\marcdisp.obj \
254 $(OBJDIR)\nmemsdup.obj \
256 $(OBJDIR)\options.obj \
257 $(OBJDIR)\readconf.obj \
258 $(OBJDIR)\tpath.obj \
259 $(OBJDIR)\wrbuf.obj \
260 $(OBJDIR)\xmalloc.obj \
261 $(OBJDIR)\matchstr.obj
264 $(OBJDIR)\diagbib1.obj \
266 $(OBJDIR)\prt-ext.obj \
267 $(OBJDIR)\logrpn.obj \
268 $(OBJDIR)\pquery.obj \
269 $(OBJDIR)\yaz-ccl.obj \
270 $(OBJDIR)\otherinfo.obj
273 $(OBJDIR)\d1_absyn.obj\
274 $(OBJDIR)\d1_attset.obj\
275 $(OBJDIR)\d1_doespec.obj\
276 $(OBJDIR)\d1_espec.obj\
277 $(OBJDIR)\d1_expout.obj\
278 $(OBJDIR)\d1_grs.obj\
279 $(OBJDIR)\d1_handle.obj\
280 $(OBJDIR)\d1_map.obj\
281 $(OBJDIR)\d1_marc.obj\
282 $(OBJDIR)\d1_prtree.obj\
283 $(OBJDIR)\d1_read.obj\
284 $(OBJDIR)\d1_soif.obj\
285 $(OBJDIR)\d1_sumout.obj\
286 $(OBJDIR)\d1_sutrs.obj\
287 $(OBJDIR)\d1_tagset.obj\
288 $(OBJDIR)\d1_varset.obj\
289 $(OBJDIR)\d1_write.obj\
293 $(OBJDIR)\z-date.obj\
294 $(OBJDIR)\z-univ.obj\
295 $(OBJDIR)\zes-update.obj\
296 $(OBJDIR)\z-accdes1.obj \
297 $(OBJDIR)\z-accform1.obj \
298 $(OBJDIR)\z-acckrb1.obj \
299 $(OBJDIR)\z-core.obj \
300 $(OBJDIR)\z-diag1.obj \
301 $(OBJDIR)\z-espec1.obj \
302 $(OBJDIR)\z-estask.obj \
303 $(OBJDIR)\z-exp.obj \
304 $(OBJDIR)\z-grs.obj \
305 $(OBJDIR)\z-opac.obj \
306 $(OBJDIR)\z-uifr1.obj \
307 $(OBJDIR)\z-rrf1.obj \
308 $(OBJDIR)\z-rrf2.obj \
309 $(OBJDIR)\z-sum.obj \
310 $(OBJDIR)\z-sutrs.obj \
311 $(OBJDIR)\zes-expi.obj \
312 $(OBJDIR)\zes-exps.obj \
313 $(OBJDIR)\zes-order.obj \
314 $(OBJDIR)\zes-pquery.obj \
315 $(OBJDIR)\zes-psched.obj \
316 $(OBJDIR)\zes-pset.obj \
317 $(OBJDIR)\zes-update0.obj
320 $(YAZ_COMSTACK_OBJS) \
336 DLL_OBJS= $(YAZ_OBJS)
345 ##########################################################
346 ############## proto.h
347 ##########################################################
350 $(PROTOH): makefile $(INCLDIR)\yaz\z-proto.h
351 type $(INCLDIR)\yaz\z-proto.h > $(PROTOH)
353 $(PROTOH): makefile $(INCLDIR)\yaz\prt-proto.h
354 type $(INCLDIR)\yaz\prt-proto.h > $(PROTOH)
358 ###########################################################
359 ############### Generated C and H files
360 ###########################################################
362 Z3950_C_DIR=$(Z3950DIR)
363 #!!! Should be moved to OBJ, but that requires too much trickery
365 # Files generated from datetime.asn
366 DATETIME_H_FILES = $(INCLDIR)\yaz\z-date.h
367 DATETIME_C_FILES = $(Z3950_C_DIR)\z-date.c
369 # Files generated from univres.asn
370 UNIVRES_H_FILES = $(INCLDIR)\yaz\z-univ.h
371 UNIVRES_C_FILES = $(Z3950_C_DIR)\z-univ.c
373 # Files generated from esupdate.asn
374 ESUPDATE_H_FILES = $(INCLDIR)\yaz\zes-update.h
375 ESUPDATE_C_FILES = $(Z3950_C_DIR)\zes-update.c
377 # Files created from z3950v3.asn
379 $(INCLDIR)\yaz\z-accdes1.h \
380 $(INCLDIR)\yaz\z-core.h
383 $(Z3950_C_DIR)\z-accdes1.c \
384 $(Z3950_C_DIR)\z-accform1.c \
385 $(Z3950_C_DIR)\z-acckrb1.c \
386 $(Z3950_C_DIR)\z-core.c \
387 $(Z3950_C_DIR)\z-diag1.c \
388 $(Z3950_C_DIR)\z-espec1.c \
389 $(Z3950_C_DIR)\z-estask.c \
390 $(Z3950_C_DIR)\z-exp.c \
391 $(Z3950_C_DIR)\z-grs.c \
392 $(Z3950_C_DIR)\z-opac.c \
393 $(Z3950_C_DIR)\z-uifr1.c \
394 $(Z3950_C_DIR)\z-rrf1.c \
395 $(Z3950_C_DIR)\z-rrf2.c \
396 $(Z3950_C_DIR)\z-sum.c \
397 $(Z3950_C_DIR)\z-sutrs.c \
398 $(Z3950_C_DIR)\zes-expi.c \
399 $(Z3950_C_DIR)\zes-exps.c \
400 $(Z3950_C_DIR)\zes-order.c \
401 $(Z3950_C_DIR)\zes-pquery.c \
402 $(Z3950_C_DIR)\zes-psched.c \
403 $(Z3950_C_DIR)\zes-pset.c \
404 $(Z3950_C_DIR)\zes-update0.c
406 DATETIME_FILES = $(DATETIME_H_FILES) $(DATETIME_C_FILES)
407 UNIVRES_FILES = $(UNIVRES_H_FILES) $(UNIVRES_C_FILES)
408 ESUPDATE_FILES = $(ESUPDATE_H_FILES) $(ESUPDATE_C_FILES)
409 Z3950V3_FILES= $(Z3950V3_C_FILES) $(Z3950V3_H_FILES)
413 $(ESUPDATE_C_FILES) \
419 $(ESUPDATE_H_FILES) \
424 $(GENERATED_H_FILES) \
425 $(GENERATED_C_FILES) \
428 ###########################################################
429 ############### Compiling
430 ###########################################################
432 # Note: This defines where to look for the necessary
433 # source files. Funny way of doing it, but it works.
436 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
440 {$(CLIENTDIR)}.c{$(OBJDIR)}.obj:
441 @$(CPP) $(COPT) $< /D"_CONSOLE"
444 {$(ZTESTDIR)}.c{$(OBJDIR)}.obj:
445 @$(CPP) $(COPT) $< /D"_CONSOLE"
448 {$(SERVERDIR)}.c{$(OBJDIR)}.obj:
451 # Various YAZ source directories
452 {$(ASNDIR)}.c{$(OBJDIR)}.obj:
455 {$(COMSTACKDIR)}.c{$(OBJDIR)}.obj:
458 {$(ODRDIR)}.c{$(OBJDIR)}.obj:
461 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
464 {$(ZUTILDIR)}.c{$(OBJDIR)}.obj:
467 {$(RETDIR)}.c{$(OBJDIR)}.obj:
470 {$(Z3950_C_DIR)}.c{$(OBJDIR)}.obj:
474 ############### ASN-generated files
476 $(Z3950V3_FILES): $(Z3950DIR)\z3950v3.asn
478 $(TCL) $(TCLOPT) z3950v3.asn
481 $(DATETIME_FILES): $(Z3950DIR)\datetime.asn
483 $(TCL) $(TCLOPT) datetime.asn
486 $(UNIVRES_FILES): $(Z3950DIR)\univres.asn
488 $(TCL) $(TCLOPT) univres.asn
491 $(ESUPDATE_FILES): $(Z3950DIR)\esupdate.asn
493 $(TCL) $(TCLOPT) esupdate.asn
496 ###########################################################
497 ############### Linking
498 ###########################################################
500 $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS)
501 @echo Linking the dll $(DLL)
508 /implib:"$(LIBDIR)/yaz.lib"
509 /pdb:"$(LIBDIR)/yaz.pdb"
510 /map:"$(LIBDIR)/yaz.map"
513 $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS)
514 @echo Linking the client $(CLIENT)
517 $(CLIENT_LINK_OPTIONS)
521 /pdb:"$(LIBDIR)/yaz-client.pdb"
\r
522 /map:"$(LIBDIR)/yaz-client.map"
526 $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(SERVER) $(DLL)
527 @echo Linking the ztest $(ZTEST)
530 $(ZTEST_LINK_OPTIONS)
536 /implib:"$(LIBDIR)/yaz-ztest.lib"
\r
537 /pdb:"$(LIBDIR)/yaz-ztest.pdb"
\r
538 /map:"$(LIBDIR)/yaz-ztest.map"
543 $(SERVER) : "$(BINDIR)" $(YAZ_SERVER_OBJS)
544 @echo Linking the server $(SERVER)
545 $(LINK) $(SERVER_LINK_OPTIONS) @<<
552 # note that this links a lib, so it uses completely different options.
556 ###########################################################
557 ############### Special operations
558 ###########################################################
568 del $(LIBDIR)\*.MAP
\r
570 del $(OBJDIR)\*.OBJ
\r
574 del $(Z3950_C_DIR)\*.c
575 del $(Z3950_C_DIR)\*.h
576 del $(INCLDIR)\yaz\z-accdes1.h
577 del $(INCLDIR)\yaz\z-core.h
578 del $(DATETIME_H_FILES)
579 del $(UNIVRES_H_FILES)
580 del $(ESUPDATE_H_FILES)
582 # Because DOS del will only accept one file name to delete,
583 # the _H_ files work only on sets that have just one file.
584 # Z3950_H_FILES had to be spelled out. One more point for MS!
586 ########### check directories and create if needed
587 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
589 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
590 if not exist "$@/$(NUL)" mkdir "$@"
593 ###########################################################
594 ############### Explicit dependencies
595 ###########################################################
597 $(ALL_OBJS): makefile $(PROTOH)
599 # force recompilation of everything, if makefile changed
601 $(Z3950_OBJS): $(GENERATED_C_FILES) $(GENERATED_H_FILES)
604 $(PROTOH): $(GENERATED_C_FILES) $(GENERATED_H_FILES)
606 # makes sure we generate before compiling anything, as the
607 # new proto.h refers to the generated files, and is included
610 ###########################################################
612 ###########################################################
615 # Revision 1.11 1999-12-21 14:16:20 ian
616 # Changed retrieval module to allow data1 trees with no associated absyn.
617 # Also added a simple interface for extracting values from data1 trees using
618 # a string based tagpath.
620 # Revision 1.10 1999/12/08 13:10:48 adam
623 # Revision 1.9 1999/11/30 13:47:12 adam
624 # Improved installation. Moved header files to include/yaz.
626 # Revision 1.8 1999/07/21 08:48:02 adam
627 # Removed dmalloc.obj.
629 # Revision 1.7 1999/06/09 15:10:08 heikki
630 # Cleaning up. Seems to work all right
632 # Revision 1.6 1999/06/09 13:33:32 heikki
633 # Compiles and links both old and new type stuff all right
635 # Revision 1.5 1999/06/09 11:05:30 heikki
636 # At least it can compile
638 # Revision 1.4 1999/06/09 09:41:09 heikki
639 # More work on the ASN-generated files.
641 # Revision 1.3 1999/06/08 14:32:30 heikki
642 # Proto.h works all right, removed linker warnings from server.lib
644 # Revision 1.2 1999/06/08 14:07:24 heikki
645 # Renamed a pile of files
646 # Tmpdir (to get around Ms leaving temp files around, and crashing
647 # when too many with same number...)
649 # Revision 1.1 1999/06/08 12:15:41 heikki
650 # Renamed to makefile (.nothing) (from .mak)
651 # Working on the proto.h problems and alternative confiigurations
653 # Revision 1.5 1999/06/04 10:04:28 heikki
656 # Revision 1.4 1999/06/02 13:23:29 heikki
657 # Debug options for C compiler
659 # Revision 1.3 1999/05/19 08:26:22 heikki