1 # Makefile.mak - makefile for MS NMAKE
2 # $Id: makefile,v 1.6 1999-06-09 13:33:32 heikki 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
37 ###########################################################
38 ############### Directories
39 ###########################################################
40 # The current directory is supposed to be something like
41 # ..../Yaz/Win, everything is relative to that
42 ROOTDIR=.. # The home of Yaz
44 INCLDIR=$(ROOTDIR)\include # our includes
45 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
46 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
47 WINDIR=$(ROOTDIR)\win # all these Win make things
48 OBJDIR=$(WINDIR)\obj # where we store intermediate files
49 UNIXDIR=$(ROOTDIR)\unix # corresponding unix things
50 SRCDIR=$(ROOTDIR) # for the case we move them under src
53 COMSTACKDIR=$(SRCDIR)\COMSTACK
55 UTILDIR=$(SRCDIR)\UTIL
56 ZUTILDIR=$(SRCDIR)\ZUTIL
57 RETDIR=$(SRCDIR)\RETRIEVAL
58 Z3950DIR=$(SRCDIR)\Z39.50
60 CLIENTDIR=$(SRCDIR)\CLIENT
61 SERVERDIR=$(SRCDIR)\SERVER
62 ZTESTDIR=$(SRCDIR)\ZTEST
64 TMPDIR=$(ROOTDIR)\win\tmp
67 ###########################################################
68 ############### Targets - what to make
69 ###########################################################
73 IMPLIB=$(LIBDIR)\Yaz.lib
75 CLIENT=$(BINDIR)\client.exe
76 SERVER=$(LIBDIR)\server.lib
77 ZTEST=$(BINDIR)\ztest.exe
78 PROTOH=$(INCLDIR)\proto.h
80 # shortcut names defined here
87 ###########################################################
88 ############### Compiler and linker options
89 ###########################################################
92 ### C and CPP compiler (the same thing)
93 # Note: $(CPP) has already been defined in the environment
94 # (if you set things up right!)
97 /nologo /W3 /GX /FD /c \
98 /D "WIN32" /D "_WINDOWS" \
104 /I"$(SRCDIR)\include"
114 # /W3 = warning level
115 # /GX = Enable exception handling
116 # /FD = Generate file dependencies (what ever they are)
117 # /c = compile without linking
118 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
119 # /Fo = object file name (or at least path)
120 # /Fd = debug database name (or path)
121 # /MD = Runtime library: Multithread DLL
122 # /MDd = Runtime library: Multithread DLL (debug)
123 # /Od = Disable optimising (debug)
124 # /O2 = Optimize for speed
125 # /YX = Automatic use of precomipled headers
126 # /Gm = Minimal rebuild (some cpp class stuff)
127 # /Zi = Program database for debuggers
128 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
130 ### The RC compiler (resource files)
132 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
133 DEBUG_RC_OPTIONS=/d "_DEBUG"
134 RELEASE_RC_OPTIONS=/d "NDEBUG"
140 LINK_LIBS= kernel32.lib user32.lib gdi32.lib winspool.lib \
141 comdlg32.lib advapi32.lib shell32.lib ole32.lib \
142 oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
143 wsock32.lib advapi32.lib
145 COMMON_LNK_OPTIONS= /nologo \
150 DEBUG_LNK_OPTIONS= /debug
152 RELEASE_LNK_OPTIONS= /pdb:none
154 DLL_LINK_OPTIONS= /dll
155 CLIENT_LINK_OPTIONS = /subsystem:console
156 SERVER_LINK_OPTIONS = -lib
157 ZTEST_LINK_OPTIONS = /subsystem:console
160 TCL="C:\Program Files\Tcl\bin\tclsh80.exe"
162 COMMON_TCL_OPTIONS= ..\util\yc.tcl -d z.tcl -I$(INCLDIR)
167 # Final opt variables
169 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
170 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
171 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
172 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
173 TCLOPT= $(COMMON_TCL_OPTIONS)
176 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
177 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
178 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
179 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
180 TCLOPT= $(COMMON_TCL_OPTIONS)
185 ###########################################################
186 ############### Source and object modules
187 ###########################################################
190 #RCFILE=$(SRCDIR)\compmak.rc
191 # Horrible Hack: The resfile contains just one line, pointing
192 # to the component.tlb file (which is created by the idl compiler)
193 # Devstudio wants that file to live in YazX3950, this makefile in
194 # win/obj. So we need to RC files!
196 #RESFILE=$(OBJDIR)\component.res
199 #DEF_FILE= $(ROOTDIR)\component.def
201 ### !!! Delete the stuff above !!!
203 # Note: Ordinary source files are not specified here at
204 # all, make finds them in suitable dirs. The object modules
205 # need to be specified, though
211 "$(OBJDIR)\eventl.obj" \
212 "$(OBJDIR)\requestq.obj" \
213 "$(OBJDIR)\service.obj" \
214 "$(OBJDIR)\seshigh.obj" \
215 "$(OBJDIR)\statserv.obj" \
216 "$(OBJDIR)\tcpdchk.obj"
219 "$(OBJDIR)\read-grs.obj" \
220 "$(OBJDIR)\ztest.obj"
224 $(OBJDIR)\proto.obj \
225 $(OBJDIR)\prt-acc.obj \
226 $(OBJDIR)\prt-add.obj \
227 $(OBJDIR)\prt-arc.obj \
228 $(OBJDIR)\prt-dat.obj \
229 $(OBJDIR)\prt-dia.obj \
230 $(OBJDIR)\prt-esp.obj \
231 $(OBJDIR)\prt-exd.obj \
232 $(OBJDIR)\prt-exp.obj \
233 $(OBJDIR)\prt-grs.obj \
234 $(OBJDIR)\prt-rsc.obj \
235 $(OBJDIR)\prt-univ.obj
238 $(OBJDIR)\comstack.obj \
239 $(OBJDIR)\tcpip.obj \
240 $(OBJDIR)\waislen.obj
243 $(OBJDIR)\ber_any.obj \
244 $(OBJDIR)\ber_bit.obj \
245 $(OBJDIR)\ber_bool.obj \
246 $(OBJDIR)\ber_int.obj \
247 $(OBJDIR)\ber_len.obj \
248 $(OBJDIR)\ber_null.obj \
249 $(OBJDIR)\ber_oct.obj \
250 $(OBJDIR)\ber_oid.obj \
251 $(OBJDIR)\ber_tag.obj \
252 $(OBJDIR)\dumpber.obj \
254 $(OBJDIR)\odr_any.obj \
255 $(OBJDIR)\odr_bit.obj \
256 $(OBJDIR)\odr_bool.obj \
257 $(OBJDIR)\odr_choice.obj \
258 $(OBJDIR)\odr_cons.obj \
259 $(OBJDIR)\odr_enum.obj \
260 $(OBJDIR)\odr_int.obj \
261 $(OBJDIR)\odr_mem.obj \
262 $(OBJDIR)\odr_null.obj \
263 $(OBJDIR)\odr_oct.obj \
264 $(OBJDIR)\odr_oid.obj \
265 $(OBJDIR)\odr_priv.obj \
266 $(OBJDIR)\odr_seq.obj \
267 $(OBJDIR)\odr_tag.obj \
268 $(OBJDIR)\odr_use.obj \
269 $(OBJDIR)\odr_util.obj
272 $(OBJDIR)\atoin.obj \
273 $(OBJDIR)\dmalloc.obj \
275 $(OBJDIR)\marcdisp.obj \
277 $(OBJDIR)\nmemsdup.obj \
279 $(OBJDIR)\options.obj \
280 $(OBJDIR)\readconf.obj \
281 $(OBJDIR)\tpath.obj \
282 $(OBJDIR)\wrbuf.obj \
283 $(OBJDIR)\xmalloc.obj \
284 $(OBJDIR)\matchstr.obj
287 $(OBJDIR)\diagbib1.obj \
289 $(OBJDIR)\prt-ext.obj \
290 $(OBJDIR)\logrpn.obj \
291 $(OBJDIR)\pquery.obj \
292 $(OBJDIR)\yaz-ccl.obj \
293 $(OBJDIR)\otherinfo.obj
295 # $(OBJDIR)\query.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_map.obj\
307 $(OBJDIR)\d1_marc.obj\
308 $(OBJDIR)\d1_prtree.obj\
309 $(OBJDIR)\d1_read.obj\
310 $(OBJDIR)\d1_soif.obj\
311 $(OBJDIR)\d1_sumout.obj\
312 $(OBJDIR)\d1_sutrs.obj\
313 $(OBJDIR)\d1_tagset.obj\
314 $(OBJDIR)\d1_varset.obj\
315 $(OBJDIR)\d1_write.obj
319 $(OBJDIR)\z-date.obj\
320 $(OBJDIR)\z-univ.obj\
321 $(OBJDIR)\zes-update.obj\
322 $(OBJDIR)\z-accdes1.obj \
323 $(OBJDIR)\z-accform1.obj \
324 $(OBJDIR)\z-acckrb1.obj \
325 $(OBJDIR)\z-core.obj \
326 $(OBJDIR)\z-diag1.obj \
327 $(OBJDIR)\z-espec1.obj \
328 $(OBJDIR)\z-estask.obj \
329 $(OBJDIR)\z-exp.obj \
330 $(OBJDIR)\z-grs.obj \
331 $(OBJDIR)\z-opac.obj \
332 $(OBJDIR)\z-uifr1.obj \
333 $(OBJDIR)\z-rrf1.obj \
334 $(OBJDIR)\z-rrf2.obj \
335 $(OBJDIR)\z-sum.obj \
336 $(OBJDIR)\z-sutrs.obj \
337 $(OBJDIR)\zes-expi.obj \
338 $(OBJDIR)\zes-exps.obj \
339 $(OBJDIR)\zes-order.obj \
340 $(OBJDIR)\zes-pquery.obj \
341 $(OBJDIR)\zes-psched.obj \
342 $(OBJDIR)\zes-pset.obj \
343 $(OBJDIR)\zes-update0.obj
346 $(YAZ_COMSTACK_OBJS) \
362 DLL_OBJS= $(YAZ_OBJS)
366 ##########################################################
367 ############## proto.h
368 ##########################################################
371 $(PROTOH): makefile $(INCLDIR)\z-proto.h
372 type $(INCLDIR)\z-proto.h > $(INCLDIR)\proto.h
374 $(PROTOH): makefile $(INCLDIR)\prt-proto.h
375 type $(INCLDIR)\prt-proto.h > $(INCLDIR)\proto.h
379 ###########################################################
380 ############### Generated C and H files
381 ###########################################################
383 Z3950_C_DIR=$(Z3950DIR) #!!! Should be moved to OBJ
385 # Files generated from datetime.asn
386 DATETIME_H_FILES = $(INCLDIR)\z-date.h
387 DATETIME_C_FILES = $(Z3950_C_DIR)\z-date.c
389 # Files generated from univres.asn
390 UNIVRES_H_FILES = $(INCLDIR)\z-univ.h
391 UNIVRES_C_FILES = $(Z3950_C_DIR)\z-univ.c
393 # Files generated from esupdate.asn
394 ESUPDATE_H_FILES = $(INCLDIR)\zes-update.h
395 ESUPDATE_C_FILES = $(Z3950_C_DIR)\zes-update.c
397 # Files created from z3950v3.asn
399 $(INCLDIR)\z-accdes1.h \
403 $(Z3950_C_DIR)\z-accdes1.c \
404 $(Z3950_C_DIR)\z-accform1.c \
405 $(Z3950_C_DIR)\z-acckrb1.c \
406 $(Z3950_C_DIR)\z-core.c \
407 $(Z3950_C_DIR)\z-diag1.c \
408 $(Z3950_C_DIR)\z-espec1.c \
409 $(Z3950_C_DIR)\z-estask.c \
410 $(Z3950_C_DIR)\z-exp.c \
411 $(Z3950_C_DIR)\z-grs.c \
412 $(Z3950_C_DIR)\z-opac.c \
413 $(Z3950_C_DIR)\z-uifr1.c \
414 $(Z3950_C_DIR)\z-rrf1.c \
415 $(Z3950_C_DIR)\z-rrf2.c \
416 $(Z3950_C_DIR)\z-sum.c \
417 $(Z3950_C_DIR)\z-sutrs.c \
418 $(Z3950_C_DIR)\zes-expi.c \
419 $(Z3950_C_DIR)\zes-exps.c \
420 $(Z3950_C_DIR)\zes-order.c \
421 $(Z3950_C_DIR)\zes-pquery.c \
422 $(Z3950_C_DIR)\zes-psched.c \
423 $(Z3950_C_DIR)\zes-pset.c \
424 $(Z3950_C_DIR)\zes-update0.c
426 DATETIME_FILES = $(DATETIME_H_FILES) $(DATETIME_C_FILES)
427 UNIVRES_FILES = $(UNIVRES_H_FILES) $(UNIVRES_C_FILES)
428 ESUPDATE_FILES = $(ESUPDATE_H_FILES) $(ESUPDATE_C_FILES)
429 Z3950V3_FILES= $(Z3950V3_C_FILES) $(Z3950V3_H_FILES)
433 $(ESUPDATE_C_FILES) \
439 $(ESUPDATE_H_FILES) \
444 ###########################################################
445 ############### Compiling
446 ###########################################################
448 # Note: This defines where to look for the necessary
449 # source files. Funny way of doing it, but it works.
452 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
458 {$(CLIENTDIR)}.c{$(OBJDIR)}.obj:
465 {$(ZTESTDIR)}.c{$(OBJDIR)}.obj:
474 {$(SERVERDIR)}.c{$(OBJDIR)}.obj:
479 # Various YAZ source directories
480 {$(ASNDIR)}.c{$(OBJDIR)}.obj:
485 {$(COMSTACKDIR)}.c{$(OBJDIR)}.obj:
490 {$(ODRDIR)}.c{$(OBJDIR)}.obj:
495 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
500 {$(ZUTILDIR)}.c{$(OBJDIR)}.obj:
505 {$(RETDIR)}.c{$(OBJDIR)}.obj:
511 {$(Z3950_C_DIR)}.c{$(OBJDIR)}.obj:
517 #$(RESFILE): $(RCFILE) $(IDLGENERATED)
518 # $(RSC) $(RCOPT) /fo"$(RESFILE)" $(RCFILE)
520 ############### ASN-generated files
523 $(Z3950V3_FILES): $(Z3950DIR)\z3950v3.asn
525 $(TCL) $(TCLOPT) z3950v3.asn
527 $(DATETIME_FILES): $(Z3950DIR)\datetime.asn
529 $(TCL) $(TCLOPT) datetime.asn
531 $(UNIVRES_FILES): $(Z3950DIR)\univres.asn
533 $(TCL) $(TCLOPT) univres.asn
535 $(ESUPDATE_FILES): $(Z3950DIR)\esupdate.asn
537 dir esupdate.asn | find "-"
538 dir $(ESUPDATE_C_FILES) | find "-"
539 dir $(ESUPDATE_H_FILES) | find "-"
540 $(TCL) $(TCLOPT) esupdate.asn
543 ###########################################################
544 ############### Linking
545 ###########################################################
547 ###$(DLL) $(IMPLIB): "$(BINDIR)" $(Z3950_OBJS)
549 $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS)
550 @echo Linking the dll $(DLL)
558 /pdb:"$(LIBDIR)/yaz.pdb"
559 /map:"$(LIBDIR)/yaz.map"
567 #foo: $(ESUPDATE_FILES)
568 # dir $(INCLDIR)\zes-update.*
569 # dir $(Z3950DIR)\zes-update.*
571 $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS)
572 @echo Linking the client $(CLIENT)
575 $(CLIENT_LINK_OPTIONS)
582 $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(SERVER) $(DLL)
583 @echo Linking the ztest $(ZTEST)
586 $(ZTEST_LINK_OPTIONS)
596 $(SERVER) : "$(BINDIR)" $(YAZ_SERVER_OBJS)
597 @echo Linking the server $(SERVER)
598 $(LINK) $(SERVER_LINK_OPTIONS) @<<
607 # note that this links a lib, so it uses completely different options.
611 ###########################################################
612 ############### Special operations
613 ###########################################################
626 del $(Z3950_C_DIR)\*.c
628 ########### check directories and create if needed
629 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
631 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
632 if not exist "$@/$(NUL)" mkdir "$@"
635 ###########################################################
636 ############### Explicit dependencies
637 ###########################################################
639 $(DLL_OBJS): makefile $(PROTOH)
641 $(Z3950_OBJS): $(GENERATED_C_FILES) $(GENERATED_H_FILES)
644 ###########################################################
646 ###########################################################
649 # Revision 1.6 1999-06-09 13:33:32 heikki
650 # Compiles and links both old and new type stuff all right
652 # Revision 1.5 1999/06/09 11:05:30 heikki
653 # At least it can compile
655 # Revision 1.4 1999/06/09 09:41:09 heikki
656 # More work on the ASN-generated files.
658 # Revision 1.3 1999/06/08 14:32:30 heikki
659 # Proto.h works all right, removed linker warnings from server.lib
661 # Revision 1.2 1999/06/08 14:07:24 heikki
662 # Renamed a pile of files
663 # Tmpdir (to get around Ms leaving temp files around, and crashing
664 # when too many with same number...)
666 # Revision 1.1 1999/06/08 12:15:41 heikki
667 # Renamed to makefile (.nothing) (from .mak)
668 # Working on the proto.h problems and alternative confiigurations
670 # Revision 1.5 1999/06/04 10:04:28 heikki
673 # Revision 1.4 1999/06/02 13:23:29 heikki
674 # Debug options for C compiler
676 # Revision 1.3 1999/05/19 08:26:22 heikki