1 # Makefile.mak - makefile for MS NMAKE
2 # $Id: makefile,v 1.5 1999-06-09 11:05:30 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=0 # 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)
165 # Final opt variables
167 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
168 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
169 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
170 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
171 TCLOPT= $(COMMON_TCL_OPTIONS)
174 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
175 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
176 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
177 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
178 TCLOPT= $(COMMON_TCL_OPTIONS)
183 ###########################################################
184 ############### Source and object modules
185 ###########################################################
189 RCFILE=$(SRCDIR)\compmak.rc
190 # Horrible Hack: The resfile contains just one line, pointing
191 # to the component.tlb file (which is created by the idl compiler)
192 # Devstudio wants that file to live in YazX3950, this makefile in
193 # win/obj. So we need to RC files!
195 RESFILE=$(OBJDIR)\component.res
199 #DEF_FILE= $(ROOTDIR)\component.def
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 copy $(INCLDIR)\z-proto.h $(INCLDIR)\proto.h
374 $(PROTOH): makefile $(INCLDIR)\prt-proto.h
375 copy $(INCLDIR)\prt-proto.h $(INCLDIR)\proto.h
380 ###########################################################
381 ############### Generated C and H files
382 ###########################################################
384 Z3950_C_DIR=$(Z3950DIR) #!!! Should be moved to OBJ
386 # Files generated from datetime.asn
387 DATETIME_H_FILES = z-date.h
388 DATETIME_C_FILES = z-date.c
389 DATETIME_FILES = $(DATETIME_H_FILES) $(DATETIME_C_FILES)
390 $(DATETIME_C_FILES): $(DATETIME_H_FILES)
393 # Files generated from univres.asn
394 UNIVRES_H_FILES = z-univ.h
395 UNIVRES_C_FILES = z-univ.c
396 UNIVRES_FILES = $(UNIVRES_H_FILES) $(UNIVRES_C_FILES)
397 $(UNIVRES_C_FILES): $(UNIVRES_H_FILES)
399 # Files generated from esupdate.asn
400 ESUPDATE_H_FILES = zes-update.h
401 ESUPDATE_C_FILES = zes-update.c
402 ESUPDATE_FILES = $(ESUPDATE_H_FILES) $(ESUPDATE_C_FILES)
403 $(ESUPDATE_C_FILES): $(ESUPDATE_H_FILES)
406 # Files created from z3950v3.asn
408 $(INCLDIR)\z-accdes1.h \
412 $(Z3950_C_DIR)\z-accdes1.c \
413 $(Z3950_C_DIR)\z-accform1.c \
414 $(Z3950_C_DIR)\z-acckrb1.c \
415 $(Z3950_C_DIR)\z-core.c \
416 $(Z3950_C_DIR)\z-diag1.c \
417 $(Z3950_C_DIR)\z-espec1.c \
418 $(Z3950_C_DIR)\z-estask.c \
419 $(Z3950_C_DIR)\z-exp.c \
420 $(Z3950_C_DIR)\z-grs.c \
421 $(Z3950_C_DIR)\z-opac.c \
422 $(Z3950_C_DIR)\z-uifr1.c \
423 $(Z3950_C_DIR)\z-rrf1.c \
424 $(Z3950_C_DIR)\z-rrf2.c \
425 $(Z3950_C_DIR)\z-sum.c \
426 $(Z3950_C_DIR)\z-sutrs.c \
427 $(Z3950_C_DIR)\zes-expi.c \
428 $(Z3950_C_DIR)\zes-exps.c \
429 $(Z3950_C_DIR)\zes-order.c \
430 $(Z3950_C_DIR)\zes-pquery.c \
431 $(Z3950_C_DIR)\zes-psched.c \
432 $(Z3950_C_DIR)\zes-pset.c \
433 $(Z3950_C_DIR)\zes-update0.c
435 Z3950V3_FILES= $(Z3950V3_C_FILES) $(Z3950V3_H_FILES)
437 $(Z3950V3_C_FILES): $(Z3950V3_H_FILES)
441 $(ESUPDATE_C_FILES) \
447 $(ESUPDATE_H_FILES) \
452 ###########################################################
453 ############### Compiling
454 ###########################################################
456 # Note: This defines where to look for the necessary
457 # source files. Funny way of doing it, but it works.
460 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
466 {$(CLIENTDIR)}.c{$(OBJDIR)}.obj:
473 {$(ZTESTDIR)}.c{$(OBJDIR)}.obj:
482 {$(SERVERDIR)}.c{$(OBJDIR)}.obj:
487 # Various YAZ source directories
488 {$(ASNDIR)}.c{$(OBJDIR)}.obj:
493 {$(COMSTACKDIR)}.c{$(OBJDIR)}.obj:
498 {$(ODRDIR)}.c{$(OBJDIR)}.obj:
503 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
508 {$(ZUTILDIR)}.c{$(OBJDIR)}.obj:
513 {$(RETDIR)}.c{$(OBJDIR)}.obj:
519 {$(Z3950_C_DIR)}.c{$(OBJDIR)}.obj:
525 $(RESFILE): $(RCFILE) $(IDLGENERATED)
526 $(RSC) $(RCOPT) /fo"$(RESFILE)" $(RCFILE)
528 ############### ASN-generated files
531 $(Z3950V3_FILES): $(Z3950DIR)\z3950v3.asn
533 $(TCL) $(TCLOPT) z3950v3.asn
535 $(DATETIME_FILES): $(Z3950DIR)\datetime.asn
537 $(TCL) $(TCLOPT) datetime.asn
539 $(UNIVRES_FILES): $(Z3950DIR)\univres.asn
541 $(TCL) $(TCLOPT) univres.asn
543 $(ESUPDATE_FILES): $(Z3950DIR)\esupdate.asn
545 $(TCL) $(TCLOPT) esupdate.asn
548 ###########################################################
549 ############### Linking
550 ###########################################################
552 ###$(DLL) $(IMPLIB): "$(BINDIR)" $(Z3950_OBJS)
554 $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS)
555 @echo Linking the dll $(DLL)
563 /pdb:"$(LIBDIR)/yaz.pdb"
564 /map:"$(LIBDIR)/yaz.map"
572 foo: $(OBJDIR)\comstack.obj
576 $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS)
577 @echo Linking the client $(CLIENT)
580 $(CLIENT_LINK_OPTIONS)
587 $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(SERVER) $(DLL)
588 @echo Linking the ztest $(ZTEST)
591 $(ZTEST_LINK_OPTIONS)
601 $(SERVER) : "$(BINDIR)" $(YAZ_SERVER_OBJS)
602 @echo Linking the server $(SERVER)
603 $(LINK) $(SERVER_LINK_OPTIONS) @<<
612 # note that this links a lib, so it uses completely different options.
616 ###########################################################
617 ############### Special operations
618 ###########################################################
631 del $(Z3950_C_DIR)\*.c
633 ########### check directories and create if needed
634 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
636 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
637 if not exist "$@/$(NUL)" mkdir "$@"
640 ###########################################################
641 ############### Explicit dependencies
642 ###########################################################
644 $(DLL_OBJS): makefile $(PROTOH) $(GENERATED_C_FILES)
646 # Note: The objects depend on their own C file already, the
647 # dependency here is actually to make sure we get the
648 # proper H files generated before trying to compile anything
649 # Unfortunately make clean can not delete the H files so
650 # easily. This hack assures that if the C's are deleted
651 # (as make clean does), the H's will be generated anew...
655 ###########################################################
657 ###########################################################
660 # Revision 1.5 1999-06-09 11:05:30 heikki
661 # At least it can compile
663 # Revision 1.4 1999/06/09 09:41:09 heikki
664 # More work on the ASN-generated files.
666 # Revision 1.3 1999/06/08 14:32:30 heikki
667 # Proto.h works all right, removed linker warnings from server.lib
669 # Revision 1.2 1999/06/08 14:07:24 heikki
670 # Renamed a pile of files
671 # Tmpdir (to get around Ms leaving temp files around, and crashing
672 # when too many with same number...)
674 # Revision 1.1 1999/06/08 12:15:41 heikki
675 # Renamed to makefile (.nothing) (from .mak)
676 # Working on the proto.h problems and alternative confiigurations
678 # Revision 1.5 1999/06/04 10:04:28 heikki
681 # Revision 1.4 1999/06/02 13:23:29 heikki
682 # Debug options for C compiler
684 # Revision 1.3 1999/05/19 08:26:22 heikki