1 # Makefile.mak - makefile for MS NMAKE
2 # $Id: makefile,v 1.4 1999-06-09 09:41:09 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
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)\query.obj \
293 $(OBJDIR)\yaz-ccl.obj \
294 $(OBJDIR)\otherinfo.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_map.obj\
305 $(OBJDIR)\d1_marc.obj\
306 $(OBJDIR)\d1_prtree.obj\
307 $(OBJDIR)\d1_read.obj\
308 $(OBJDIR)\d1_soif.obj\
309 $(OBJDIR)\d1_sumout.obj\
310 $(OBJDIR)\d1_sutrs.obj\
311 $(OBJDIR)\d1_tagset.obj\
312 $(OBJDIR)\d1_varset.obj\
313 $(OBJDIR)\d1_write.obj
317 $(OBJDIR)\z-accdes1.obj \
318 $(OBJDIR)\z-accform1.obj \
319 $(OBJDIR)\z-acckrb1.obj \
320 $(OBJDIR)\z-core.obj \
321 $(OBJDIR)\z-diag1.obj \
322 $(OBJDIR)\z-espec1.obj \
323 $(OBJDIR)\z-estask.obj \
324 $(OBJDIR)\z-exp.obj \
325 $(OBJDIR)\z-grs.obj \
326 $(OBJDIR)\z-opac.obj \
327 $(OBJDIR)\z-uifr1.obj \
328 $(OBJDIR)\z-rrf1.obj \
329 $(OBJDIR)\z-rrf2.obj \
330 $(OBJDIR)\z-sum.obj \
331 $(OBJDIR)\z-sutrs.obj \
332 $(OBJDIR)\zes-expi.obj \
333 $(OBJDIR)\zes-exps.obj \
334 $(OBJDIR)\zes-order.obj \
335 $(OBJDIR)\zes-pquery.obj \
336 $(OBJDIR)\zes-psched.obj \
337 $(OBJDIR)\zes-pset.obj \
338 $(OBJDIR)\zes-update0.obj
341 $(YAZ_COMSTACK_OBJS) \
357 DLL_OBJS= $(YAZ_OBJS)
361 ##########################################################
362 ############## proto.h
363 ##########################################################
366 $(PROTOH): makefile $(INCLDIR)\z-proto.h $(Z3950V3_H_FILES)
367 copy $(INCLDIR)\z-proto.h $(INCLDIR)\proto.h
369 $(PROTOH): makefile $(INCLDIR)\prt-proto.h
370 copy $(INCLDIR)\prt-proto.h $(INCLDIR)\proto.h
375 ###########################################################
376 ############### Generated C and H files
377 ###########################################################
379 Z3950_C_DIR=$(Z3950DIR) #!!! Should be moved to OBJ
381 # Files generated from datetime.asn
382 DATETIME_H_FILES = z-date.h
383 DATETIME_C_FILES = z-date.c
384 DATETIME_FILES = $(DATETIME_H_FILES) $(DATETIME_C_FILES)
385 $(DATETIME_C_FILES): $(DATETIME_H_FILES)
388 # Files generated from univres.asn
389 UNIVRES_H_FILES = z-univ.h
390 UNIVRES_C_FILES = z-univ.c
391 UNIVRES_FILES = $(UNIVRES_H_FILES) $(UNIVRES_C_FILES)
392 $(UNIVRES_C_FILES): $(UNIVRES_H_FILES)
394 # Files generated from esupdate.asn
395 ESUPDATE_H_FILES = zes-update.h
396 ESUPDATE_C_FILES = zes-update.c
397 ESUPDATE_FILES = $(ESUPDATE_H_FILES) $(ESUPDATE_C_FILES)
398 $(ESUPDATE_C_FILES): $(ESUPDATE_H_FILES)
401 # Files created from z3950v3.asn
403 $(INCLDIR)\z-accdes1.h \
407 $(Z3950_C_DIR)\z-accdes1.c \
408 $(Z3950_C_DIR)\z-accform1.c \
409 $(Z3950_C_DIR)\z-acckrb1.c \
410 $(Z3950_C_DIR)\z-core.c \
411 $(Z3950_C_DIR)\z-diag1.c \
412 $(Z3950_C_DIR)\z-espec1.c \
413 $(Z3950_C_DIR)\z-estask.c \
414 $(Z3950_C_DIR)\z-exp.c \
415 $(Z3950_C_DIR)\z-grs.c \
416 $(Z3950_C_DIR)\z-opac.c \
417 $(Z3950_C_DIR)\z-uifr1.c \
418 $(Z3950_C_DIR)\z-rrf1.c \
419 $(Z3950_C_DIR)\z-rrf2.c \
420 $(Z3950_C_DIR)\z-sum.c \
421 $(Z3950_C_DIR)\z-sutrs.c \
422 $(Z3950_C_DIR)\zes-expi.c \
423 $(Z3950_C_DIR)\zes-exps.c \
424 $(Z3950_C_DIR)\zes-order.c \
425 $(Z3950_C_DIR)\zes-pquery.c \
426 $(Z3950_C_DIR)\zes-psched.c \
427 $(Z3950_C_DIR)\zes-pset.c \
428 $(Z3950_C_DIR)\zes-update0.c
430 Z3950V3_FILES= $(Z3950V3_C_FILES) $(Z3950V3_H_FILES)
432 $(Z3950V3_C_FILES): $(Z3950V3_H_FILES)
436 $(ESUPDATE_C_FILES) \
442 $(ESUPDATE_H_FILES) \
447 ###########################################################
448 ############### Compiling
449 ###########################################################
451 # Note: This defines where to look for the necessary
452 # source files. Funny way of doing it, but it works.
455 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
461 {$(CLIENTDIR)}.c{$(OBJDIR)}.obj:
468 {$(ZTESTDIR)}.c{$(OBJDIR)}.obj:
477 {$(SERVERDIR)}.c{$(OBJDIR)}.obj:
482 # Various YAZ source directories
483 {$(ASNDIR)}.c{$(OBJDIR)}.obj:
488 {$(COMSTACKDIR)}.c{$(OBJDIR)}.obj:
493 {$(ODRDIR)}.c{$(OBJDIR)}.obj:
498 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
503 {$(ZUTILDIR)}.c{$(OBJDIR)}.obj:
508 {$(RETDIR)}.c{$(OBJDIR)}.obj:
514 {$(Z3950_C_DIR)}.c{$(OBJDIR)}.obj:
520 $(RESFILE): $(RCFILE) $(IDLGENERATED)
521 $(RSC) $(RCOPT) /fo"$(RESFILE)" $(RCFILE)
523 ############### ASN-generated files
526 $(Z3950V3_FILES): $(Z3950DIR)\z3950v3.asn
528 $(TCL) $(TCLOPT) z3950v3.asn
529 copy *.h $(INCLDIR) >NUL
531 $(DATETIME_FILES): $(Z3950DIR)\datetime.asn
533 $(TCL) $(TCLOPT) datetime.asn
534 copy *.h $(INCLDIR) >NUL
536 $(UNIVRES_FILES): $(Z3950DIR)\univres.asn
538 $(TCL) $(TCLOPT) univres.asn
539 copy *.h $(INCLDIR) >NUL
541 $(ESUPDATE_FILES): $(Z3950DIR)\esupdate.asn
543 $(TCL) $(TCLOPT) esupdate.asn
544 copy *.h $(INCLDIR) >NUL
547 ###########################################################
548 ############### Linking
549 ###########################################################
551 ###$(DLL) $(IMPLIB): "$(BINDIR)" $(Z3950_OBJS)
553 $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS)
554 @echo Linking the dll $(DLL)
562 /pdb:"$(LIBDIR)/yaz.pdb"
563 /map:"$(LIBDIR)/yaz.map"
571 foo: $(OBJDIR)\comstack.obj
575 $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS)
576 @echo Linking the client $(CLIENT)
579 $(CLIENT_LINK_OPTIONS)
586 $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(SERVER) $(DLL)
587 @echo Linking the ztest $(ZTEST)
590 $(ZTEST_LINK_OPTIONS)
600 $(SERVER) : "$(BINDIR)" $(YAZ_SERVER_OBJS)
601 @echo Linking the server $(SERVER)
602 $(LINK) $(SERVER_LINK_OPTIONS) @<<
611 # note that this links a lib, so it uses completely different options.
615 ###########################################################
616 ############### Special operations
617 ###########################################################
630 del $(Z3950_C_DIR)\*.c
632 ########### check directories and create if needed
633 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
635 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
636 if not exist "$@/$(NUL)" mkdir "$@"
639 ###########################################################
640 ############### Explicit dependencies
641 ###########################################################
643 $(DLL_OBJS): makefile $(PROTOH) $(GENERATED_C_FILES)
645 # Note: The objects depend on their own C file already, the
646 # dependency here is actually to make sure we get the
647 # proper H files generated before trying to compile anything
648 # Unfortunately make clean can not delete the H files so
649 # easily. This hack assures that if the C's are deleted
650 # (as make clean does), the H's will be generated anew...
654 ###########################################################
656 ###########################################################
659 # Revision 1.4 1999-06-09 09:41:09 heikki
660 # More work on the ASN-generated files.
662 # Revision 1.3 1999/06/08 14:32:30 heikki
663 # Proto.h works all right, removed linker warnings from server.lib
665 # Revision 1.2 1999/06/08 14:07:24 heikki
666 # Renamed a pile of files
667 # Tmpdir (to get around Ms leaving temp files around, and crashing
668 # when too many with same number...)
670 # Revision 1.1 1999/06/08 12:15:41 heikki
671 # Renamed to makefile (.nothing) (from .mak)
672 # Working on the proto.h problems and alternative confiigurations
674 # Revision 1.5 1999/06/04 10:04:28 heikki
677 # Revision 1.4 1999/06/02 13:23:29 heikki
678 # Debug options for C compiler
680 # Revision 1.3 1999/05/19 08:26:22 heikki