1 # Makefile.mak - makefile for MS NMAKE
2 # $Id: makefile,v 1.14 2000-03-02 08:48:21 adam 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
62 CLIENTDIR=$(SRCDIR)\CLIENT
63 SERVERDIR=$(SRCDIR)\SERVER
64 ZTESTDIR=$(SRCDIR)\ZTEST
66 TMPDIR=$(ROOTDIR)\win\tmp
69 ###########################################################
70 ############### Targets - what to make
71 ###########################################################
75 IMPLIB=$(LIBDIR)\Yaz.lib
77 CLIENT=$(BINDIR)\yaz-client.exe
78 SERVER=$(LIBDIR)\server.lib
79 ZTEST=$(BINDIR)\yaz-ztest.exe
80 PROTOH=$(INCLDIR)\yaz\proto.h
82 # shortcut names defined here
89 ###########################################################
90 ############### Compiler and linker options
91 ###########################################################
94 ### C and CPP compiler (the same thing)
95 # Note: $(CPP) has already been defined in the environment
96 # (if you set things up right!)
99 /nologo /W3 /GX /FD /c \
100 /D "WIN32" /D "_WINDOWS" \
106 /I"$(SRCDIR)\include"
116 # /W3 = warning level
117 # /GX = Enable exception handling
118 # /FD = Generate file dependencies (what ever they are)
119 # /c = compile without linking
120 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
121 # /Fo = object file name (or at least path)
122 # /Fd = debug database name (or path)
123 # /MD = Runtime library: Multithread DLL
124 # /MDd = Runtime library: Multithread DLL (debug)
125 # /Od = Disable optimising (debug)
126 # /O2 = Optimize for speed
127 # /YX = Automatic use of precomipled headers
128 # /Gm = Minimal rebuild (some cpp class stuff)
129 # /Zi = Program database for debuggers
130 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
136 LINK_LIBS= kernel32.lib user32.lib gdi32.lib winspool.lib \
137 comdlg32.lib advapi32.lib shell32.lib ole32.lib \
138 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
139 wsock32.lib advapi32.lib
141 COMMON_LNK_OPTIONS= /nologo \
146 DEBUG_LNK_OPTIONS= /debug
148 RELEASE_LNK_OPTIONS= /pdb:none
150 DLL_LINK_OPTIONS= /dll
151 CLIENT_LINK_OPTIONS = /subsystem:console
152 SERVER_LINK_OPTIONS = -lib
153 ZTEST_LINK_OPTIONS = /subsystem:console
156 TCL="C:\Program Files\Tcl\bin\tclsh82.exe"
158 COMMON_TCL_OPTIONS= ..\util\yaz-comp -I$(INCLDIR) -i yaz
160 # Final opt variables
162 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
163 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
164 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
165 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
166 TCLOPT= $(COMMON_TCL_OPTIONS)
169 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
170 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
171 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
172 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
173 TCLOPT= $(COMMON_TCL_OPTIONS)
178 ###########################################################
179 ############### Source and object modules
180 ###########################################################
182 # Note: Ordinary source files are not specified here at
183 # all, make finds them in suitable dirs. The object modules
184 # need to be specified, though
190 "$(OBJDIR)\eventl.obj" \
191 "$(OBJDIR)\requestq.obj" \
192 "$(OBJDIR)\service.obj" \
193 "$(OBJDIR)\seshigh.obj" \
194 "$(OBJDIR)\statserv.obj" \
195 "$(OBJDIR)\tcpdchk.obj"
198 "$(OBJDIR)\read-grs.obj" \
199 "$(OBJDIR)\ztest.obj"
203 $(OBJDIR)\proto.obj \
204 $(OBJDIR)\prt-acc.obj \
205 $(OBJDIR)\prt-add.obj \
206 $(OBJDIR)\prt-arc.obj \
207 $(OBJDIR)\prt-dat.obj \
208 $(OBJDIR)\prt-dia.obj \
209 $(OBJDIR)\prt-esp.obj \
210 $(OBJDIR)\prt-exd.obj \
211 $(OBJDIR)\prt-exp.obj \
212 $(OBJDIR)\prt-grs.obj \
213 $(OBJDIR)\prt-rsc.obj \
214 $(OBJDIR)\prt-univ.obj
217 $(OBJDIR)\comstack.obj \
218 $(OBJDIR)\tcpip.obj \
219 $(OBJDIR)\waislen.obj
222 $(OBJDIR)\ber_any.obj \
223 $(OBJDIR)\ber_bit.obj \
224 $(OBJDIR)\ber_bool.obj \
225 $(OBJDIR)\ber_int.obj \
226 $(OBJDIR)\ber_len.obj \
227 $(OBJDIR)\ber_null.obj \
228 $(OBJDIR)\ber_oct.obj \
229 $(OBJDIR)\ber_oid.obj \
230 $(OBJDIR)\ber_tag.obj \
231 $(OBJDIR)\dumpber.obj \
233 $(OBJDIR)\odr_any.obj \
234 $(OBJDIR)\odr_bit.obj \
235 $(OBJDIR)\odr_bool.obj \
236 $(OBJDIR)\odr_choice.obj \
237 $(OBJDIR)\odr_cons.obj \
238 $(OBJDIR)\odr_enum.obj \
239 $(OBJDIR)\odr_int.obj \
240 $(OBJDIR)\odr_mem.obj \
241 $(OBJDIR)\odr_null.obj \
242 $(OBJDIR)\odr_oct.obj \
243 $(OBJDIR)\odr_oid.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 $(OBJDIR)\ill-get.obj\
321 $(OBJDIR)\ill-core.obj\
322 $(OBJDIR)\item-req.obj
325 $(YAZ_COMSTACK_OBJS) \
342 DLL_OBJS= $(YAZ_OBJS)
351 ##########################################################
352 ############## proto.h
353 ##########################################################
356 $(PROTOH): makefile $(INCLDIR)\yaz\z-proto.h
357 type $(INCLDIR)\yaz\z-proto.h > $(PROTOH)
359 $(PROTOH): makefile $(INCLDIR)\yaz\prt-proto.h
360 type $(INCLDIR)\yaz\prt-proto.h > $(PROTOH)
364 ###########################################################
365 ############### Generated C and H files
366 ###########################################################
368 Z3950_C_DIR=$(Z3950DIR)
370 #!!! Should be moved to OBJ, but that requires too much trickery
372 # Files generated from datetime.asn
373 DATETIME_H_FILES = $(INCLDIR)\yaz\z-date.h
374 DATETIME_C_FILES = $(Z3950_C_DIR)\z-date.c
376 # Files generated from univres.asn
377 UNIVRES_H_FILES = $(INCLDIR)\yaz\z-univ.h
378 UNIVRES_C_FILES = $(Z3950_C_DIR)\z-univ.c
380 # Files generated from esupdate.asn
381 ESUPDATE_H_FILES = $(INCLDIR)\yaz\zes-update.h
382 ESUPDATE_C_FILES = $(Z3950_C_DIR)\zes-update.c
384 # Files created from z3950v3.asn
386 $(INCLDIR)\yaz\z-accdes1.h \
387 $(INCLDIR)\yaz\z-core.h
390 $(Z3950_C_DIR)\z-accdes1.c \
391 $(Z3950_C_DIR)\z-accform1.c \
392 $(Z3950_C_DIR)\z-acckrb1.c \
393 $(Z3950_C_DIR)\z-core.c \
394 $(Z3950_C_DIR)\z-diag1.c \
395 $(Z3950_C_DIR)\z-espec1.c \
396 $(Z3950_C_DIR)\z-estask.c \
397 $(Z3950_C_DIR)\z-exp.c \
398 $(Z3950_C_DIR)\z-grs.c \
399 $(Z3950_C_DIR)\z-opac.c \
400 $(Z3950_C_DIR)\z-uifr1.c \
401 $(Z3950_C_DIR)\z-rrf1.c \
402 $(Z3950_C_DIR)\z-rrf2.c \
403 $(Z3950_C_DIR)\z-sum.c \
404 $(Z3950_C_DIR)\z-sutrs.c \
405 $(Z3950_C_DIR)\zes-expi.c \
406 $(Z3950_C_DIR)\zes-exps.c \
407 $(Z3950_C_DIR)\zes-order.c \
408 $(Z3950_C_DIR)\zes-pquery.c \
409 $(Z3950_C_DIR)\zes-psched.c \
410 $(Z3950_C_DIR)\zes-pset.c \
411 $(Z3950_C_DIR)\zes-update0.c
414 $(INCLDIR)\yaz\ill-core.h
417 $(ILL_C_DIR)\ill-core.c
420 $(INCLDIR)\yaz\item-req.h
423 $(ILL_C_DIR)\item-req.c
425 DATETIME_FILES = $(DATETIME_H_FILES) $(DATETIME_C_FILES)
426 UNIVRES_FILES = $(UNIVRES_H_FILES) $(UNIVRES_C_FILES)
427 ESUPDATE_FILES = $(ESUPDATE_H_FILES) $(ESUPDATE_C_FILES)
428 Z3950V3_FILES= $(Z3950V3_C_FILES) $(Z3950V3_H_FILES)
429 ILL_CORE_FILES= $(ILL_CORE_C_FILES) $(ILL_CORE_H_FILES)
430 ITEM_REQ_FILES= $(ITEM_REQ_C_FILES) $(ITEM_REQ_H_FILES)
434 $(ESUPDATE_C_FILES) \
440 $(ESUPDATE_H_FILES) \
445 $(GENERATED_H_FILES) \
446 $(GENERATED_C_FILES) \
449 ###########################################################
450 ############### Compiling
451 ###########################################################
453 # Note: This defines where to look for the necessary
454 # source files. Funny way of doing it, but it works.
457 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
461 {$(CLIENTDIR)}.c{$(OBJDIR)}.obj:
462 @$(CPP) $(COPT) $< /D"_CONSOLE"
465 {$(ZTESTDIR)}.c{$(OBJDIR)}.obj:
466 @$(CPP) $(COPT) $< /D"_CONSOLE"
469 {$(SERVERDIR)}.c{$(OBJDIR)}.obj:
472 # Various YAZ source directories
473 {$(ASNDIR)}.c{$(OBJDIR)}.obj:
476 {$(COMSTACKDIR)}.c{$(OBJDIR)}.obj:
479 {$(ODRDIR)}.c{$(OBJDIR)}.obj:
482 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
485 {$(ZUTILDIR)}.c{$(OBJDIR)}.obj:
488 {$(RETDIR)}.c{$(OBJDIR)}.obj:
491 {$(Z3950_C_DIR)}.c{$(OBJDIR)}.obj:
494 {$(ILL_C_DIR)}.c{$(OBJDIR)}.obj:
497 ############### ASN-generated files
499 $(Z3950V3_FILES): $(Z3950DIR)\z3950v3.asn
501 $(TCL) $(TCLOPT) -d z.tcl z3950v3.asn
504 $(DATETIME_FILES): $(Z3950DIR)\datetime.asn
506 $(TCL) $(TCLOPT) -d z.tcl datetime.asn
509 $(UNIVRES_FILES): $(Z3950DIR)\univres.asn
511 $(TCL) $(TCLOPT) -d z.tcl univres.asn
514 $(ESUPDATE_FILES): $(Z3950DIR)\esupdate.asn
516 $(TCL) $(TCLOPT) -d z.tcl esupdate.asn
519 $(ILL_CORE_FILES): $(ILLDIR)\ill9702.asn
521 $(TCL) $(TCLOPT) -d ill.tcl ill9702.asn
524 $(ITEM_REQ_FILES): $(ILLDIR)\item-req.asn
526 $(TCL) $(TCLOPT) -d ill.tcl item-req.asn
529 ###########################################################
530 ############### Linking
531 ###########################################################
533 $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS)
534 @echo Linking the dll $(DLL)
541 /implib:"$(LIBDIR)/yaz.lib"
542 /pdb:"$(LIBDIR)/yaz.pdb"
543 /map:"$(LIBDIR)/yaz.map"
546 $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS)
547 @echo Linking the client $(CLIENT)
550 $(CLIENT_LINK_OPTIONS)
555 /pdb:"$(LIBDIR)/yaz-client.pdb"
557 /map:"$(LIBDIR)/yaz-client.map"
561 $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(SERVER) $(DLL)
562 @echo Linking the ztest $(ZTEST)
565 $(ZTEST_LINK_OPTIONS)
572 /implib:"$(LIBDIR)/yaz-ztest.lib"
574 /pdb:"$(LIBDIR)/yaz-ztest.pdb"
576 /map:"$(LIBDIR)/yaz-ztest.map"
581 $(SERVER) : "$(BINDIR)" $(YAZ_SERVER_OBJS)
582 @echo Linking the server $(SERVER)
583 $(LINK) $(SERVER_LINK_OPTIONS) @<<
590 # note that this links a lib, so it uses completely different options.
594 ###########################################################
595 ############### Special operations
596 ###########################################################
615 del $(Z3950_C_DIR)\*.c
616 del $(Z3950_C_DIR)\*.h
617 del $(INCLDIR)\yaz\z-accdes1.h
618 del $(INCLDIR)\yaz\z-core.h
619 del $(DATETIME_H_FILES)
620 del $(UNIVRES_H_FILES)
621 del $(ESUPDATE_H_FILES)
623 # Because DOS del will only accept one file name to delete,
624 # the _H_ files work only on sets that have just one file.
625 # Z3950_H_FILES had to be spelled out. One more point for MS!
627 ########### check directories and create if needed
628 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
630 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
631 if not exist "$@/$(NUL)" mkdir "$@"
634 ###########################################################
635 ############### Explicit dependencies
636 ###########################################################
638 $(ALL_OBJS): makefile $(PROTOH)
640 # force recompilation of everything, if makefile changed
642 $(Z3950_OBJS): $(GENERATED_C_FILES) $(GENERATED_H_FILES)
644 $(ILL_OBJS): $(ILL_CORE_FILES) $(ITEM_REQ_FILES)
647 $(PROTOH): $(GENERATED_C_FILES) $(GENERATED_H_FILES)
649 # makes sure we generate before compiling anything, as the
650 # new proto.h refers to the generated files, and is included
653 ###########################################################
655 ###########################################################
658 # Revision 1.14 2000-03-02 08:48:21 adam
659 # Renamed ASN.1 compiler to yaz-comp (used to be yc.tcl).
661 # Revision 1.13 2000/02/28 11:13:03 adam
662 # Removed odr_priv.obj.
664 # Revision 1.12 2000/01/06 11:27:16 adam
667 # Revision 1.11 1999/12/21 14:16:20 ian
668 # Changed retrieval module to allow data1 trees with no associated absyn.
669 # Also added a simple interface for extracting values from data1 trees using
670 # a string based tagpath.
672 # Revision 1.10 1999/12/08 13:10:48 adam
675 # Revision 1.9 1999/11/30 13:47:12 adam
676 # Improved installation. Moved header files to include/yaz.
678 # Revision 1.8 1999/07/21 08:48:02 adam
679 # Removed dmalloc.obj.
681 # Revision 1.7 1999/06/09 15:10:08 heikki
682 # Cleaning up. Seems to work all right
684 # Revision 1.6 1999/06/09 13:33:32 heikki
685 # Compiles and links both old and new type stuff all right
687 # Revision 1.5 1999/06/09 11:05:30 heikki
688 # At least it can compile
690 # Revision 1.4 1999/06/09 09:41:09 heikki
691 # More work on the ASN-generated files.
693 # Revision 1.3 1999/06/08 14:32:30 heikki
694 # Proto.h works all right, removed linker warnings from server.lib
696 # Revision 1.2 1999/06/08 14:07:24 heikki
697 # Renamed a pile of files
698 # Tmpdir (to get around Ms leaving temp files around, and crashing
699 # when too many with same number...)
701 # Revision 1.1 1999/06/08 12:15:41 heikki
702 # Renamed to makefile (.nothing) (from .mak)
703 # Working on the proto.h problems and alternative confiigurations
705 # Revision 1.5 1999/06/04 10:04:28 heikki
708 # Revision 1.4 1999/06/02 13:23:29 heikki
709 # Debug options for C compiler
711 # Revision 1.3 1999/05/19 08:26:22 heikki