1 # Makefile.mak - makefile for MS NMAKE
2 # $Id: makefile,v 1.3 1999-06-08 14:32: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
12 # Envoronment problems
13 # - You need to have the proper path and environment for VC set
14 # up. There is a bat file VCVARS32.BAT that sets most of it up
15 # for you. You can find this somewhere near DevStudio\VC\BIN
16 # - RegSvr32 must also be along the path, often in WINDOWS\SYSTEM
17 # - TCL has to be available too, if compiling for NEW_Z3950
19 ###########################################################
20 ############### Parameters
21 ###########################################################
23 DEBUG=0 # 0 for release, 1 for debug
25 NEW_Z3950=0 # 0= use old asn files
26 # 1= generate files from *.asn (needs tcl)
31 all: dirs proto_h dll client server ztest
34 ###########################################################
35 ############### Directories
36 ###########################################################
37 # The current directory is supposed to be something like
38 # ..../Yaz/Win, everything is relative to that
39 ROOTDIR=.. # The home of Yaz
41 INCLDIR=$(ROOTDIR)\include # our includes
42 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
43 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
44 WINDIR=$(ROOTDIR)\win # all these Win make things
45 OBJDIR=$(WINDIR)\obj # where we store intermediate files
46 UNIXDIR=$(ROOTDIR)\unix # corresponding unix things
47 SRCDIR=$(ROOTDIR) # for the case we move them under src
50 COMSTACKDIR=$(SRCDIR)\COMSTACK
52 UTILDIR=$(SRCDIR)\UTIL
53 ZUTILDIR=$(SRCDIR)\ZUTIL
54 RETDIR=$(SRCDIR)\RETRIEVAL
56 CLIENTDIR=$(SRCDIR)\CLIENT
57 SERVERDIR=$(SRCDIR)\SERVER
58 ZTESTDIR=$(SRCDIR)\ZTEST
60 TMPDIR=$(ROOTDIR)\win\tmp
63 ###########################################################
64 ############### Targets - what to make
65 ###########################################################
69 IMPLIB=$(LIBDIR)\Yaz.lib
71 CLIENT=$(BINDIR)\client.exe
72 SERVER=$(LIBDIR)\server.lib
73 ZTEST=$(BINDIR)\ztest.exe
74 PROTOH=$(INCLDIR)\proto.h
76 # shortcut names defined here
83 ###########################################################
84 ############### Compiler and linker options
85 ###########################################################
88 ### C and CPP compiler (the same thing)
89 # Note: $(CPP) has already been defined in the environment
90 # (if you set things up right!)
93 /nologo /W3 /GX /FD /c \
94 /D "WIN32" /D "_WINDOWS" \
100 /I"$(SRCDIR)\include"
110 # /W3 = warning level
111 # /GX = Enable exception handling
112 # /FD = Generate file dependencies (what ever they are)
113 # /c = compile without linking
114 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
115 # /Fo = object file name (or at least path)
116 # /Fd = debug database name (or path)
117 # /MD = Runtime library: Multithread DLL
118 # /MDd = Runtime library: Multithread DLL (debug)
119 # /Od = Disable optimising (debug)
120 # /O2 = Optimize for speed
121 # /YX = Automatic use of precomipled headers
122 # /Gm = Minimal rebuild (some cpp class stuff)
123 # /Zi = Program database for debuggers
124 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
126 ### The RC compiler (resource files)
128 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
129 DEBUG_RC_OPTIONS=/d "_DEBUG"
130 RELEASE_RC_OPTIONS=/d "NDEBUG"
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 # Final opt variables
158 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
159 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
160 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
161 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
164 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
165 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
166 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
167 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
172 ###########################################################
173 ############### Source and object modules
174 ###########################################################
178 RCFILE=$(SRCDIR)\compmak.rc
179 # Horrible Hack: The resfile contains just one line, pointing
180 # to the component.tlb file (which is created by the idl compiler)
181 # Devstudio wants that file to live in YazX3950, this makefile in
182 # win/obj. So we need to RC files!
184 RESFILE=$(OBJDIR)\component.res
188 #DEF_FILE= $(ROOTDIR)\component.def
192 # Note: Ordinary source files are not specified here at
193 # all, make finds them in suitable dirs. The object modules
194 # need to be specified, though
200 "$(OBJDIR)\eventl.obj" \
201 "$(OBJDIR)\requestq.obj" \
202 "$(OBJDIR)\service.obj" \
203 "$(OBJDIR)\seshigh.obj" \
204 "$(OBJDIR)\statserv.obj" \
205 "$(OBJDIR)\tcpdchk.obj"
208 "$(OBJDIR)\read-grs.obj" \
209 "$(OBJDIR)\ztest.obj"
213 $(OBJDIR)\proto.obj \
214 $(OBJDIR)\prt-acc.obj \
215 $(OBJDIR)\prt-add.obj \
216 $(OBJDIR)\prt-arc.obj \
217 $(OBJDIR)\prt-dat.obj \
218 $(OBJDIR)\prt-dia.obj \
219 $(OBJDIR)\prt-esp.obj \
220 $(OBJDIR)\prt-exd.obj \
221 $(OBJDIR)\prt-exp.obj \
222 $(OBJDIR)\prt-grs.obj \
223 $(OBJDIR)\prt-rsc.obj \
224 $(OBJDIR)\prt-univ.obj
227 $(OBJDIR)\comstack.obj \
228 $(OBJDIR)\tcpip.obj \
229 $(OBJDIR)\waislen.obj
232 $(OBJDIR)\ber_any.obj \
233 $(OBJDIR)\ber_bit.obj \
234 $(OBJDIR)\ber_bool.obj \
235 $(OBJDIR)\ber_int.obj \
236 $(OBJDIR)\ber_len.obj \
237 $(OBJDIR)\ber_null.obj \
238 $(OBJDIR)\ber_oct.obj \
239 $(OBJDIR)\ber_oid.obj \
240 $(OBJDIR)\ber_tag.obj \
241 $(OBJDIR)\dumpber.obj \
243 $(OBJDIR)\odr_any.obj \
244 $(OBJDIR)\odr_bit.obj \
245 $(OBJDIR)\odr_bool.obj \
246 $(OBJDIR)\odr_choice.obj \
247 $(OBJDIR)\odr_cons.obj \
248 $(OBJDIR)\odr_enum.obj \
249 $(OBJDIR)\odr_int.obj \
250 $(OBJDIR)\odr_mem.obj \
251 $(OBJDIR)\odr_null.obj \
252 $(OBJDIR)\odr_oct.obj \
253 $(OBJDIR)\odr_oid.obj \
254 $(OBJDIR)\odr_priv.obj \
255 $(OBJDIR)\odr_seq.obj \
256 $(OBJDIR)\odr_tag.obj \
257 $(OBJDIR)\odr_use.obj \
258 $(OBJDIR)\odr_util.obj
261 $(OBJDIR)\atoin.obj \
262 $(OBJDIR)\dmalloc.obj \
264 $(OBJDIR)\marcdisp.obj \
266 $(OBJDIR)\nmemsdup.obj \
268 $(OBJDIR)\options.obj \
269 $(OBJDIR)\readconf.obj \
270 $(OBJDIR)\tpath.obj \
271 $(OBJDIR)\wrbuf.obj \
272 $(OBJDIR)\xmalloc.obj \
273 $(OBJDIR)\matchstr.obj
276 $(OBJDIR)\diagbib1.obj \
278 $(OBJDIR)\prt-ext.obj \
279 $(OBJDIR)\logrpn.obj \
280 $(OBJDIR)\pquery.obj \
281 $(OBJDIR)\query.obj \
282 $(OBJDIR)\yaz-ccl.obj \
283 $(OBJDIR)\otherinfo.obj
286 $(OBJDIR)\d1_absyn.obj\
287 $(OBJDIR)\d1_attset.obj\
288 $(OBJDIR)\d1_doespec.obj\
289 $(OBJDIR)\d1_espec.obj\
290 $(OBJDIR)\d1_expout.obj\
291 $(OBJDIR)\d1_grs.obj\
292 $(OBJDIR)\d1_handle.obj\
293 $(OBJDIR)\d1_map.obj\
294 $(OBJDIR)\d1_marc.obj\
295 $(OBJDIR)\d1_prtree.obj\
296 $(OBJDIR)\d1_read.obj\
297 $(OBJDIR)\d1_soif.obj\
298 $(OBJDIR)\d1_sumout.obj\
299 $(OBJDIR)\d1_sutrs.obj\
300 $(OBJDIR)\d1_tagset.obj\
301 $(OBJDIR)\d1_varset.obj\
302 $(OBJDIR)\d1_write.obj
306 $(YAZ_COMSTACK_OBJS) \
312 DLL_OBJS= $(YAZ_OBJS)
315 ##########################################################
316 ############## proto.h
317 ##########################################################
321 copy $(INCLDIR)\z-proto.h $(INCLDIR)\proto.h
324 copy $(INCLDIR)\prt-proto.h $(INCLDIR)\proto.h
329 ###########################################################
330 ############### Compiling
331 ###########################################################
333 # Note: This defines where to look for the necessary
334 # source files. Funny way of doing it, but it works.
337 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
343 {$(CLIENTDIR)}.c{$(OBJDIR)}.obj:
350 {$(ZTESTDIR)}.c{$(OBJDIR)}.obj:
359 {$(SERVERDIR)}.c{$(OBJDIR)}.obj:
364 # Various YAZ source directories
365 {$(ASNDIR)}.c{$(OBJDIR)}.obj:
370 {$(COMSTACKDIR)}.c{$(OBJDIR)}.obj:
375 {$(ODRDIR)}.c{$(OBJDIR)}.obj:
380 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
385 {$(ZUTILDIR)}.c{$(OBJDIR)}.obj:
390 {$(RETDIR)}.c{$(OBJDIR)}.obj:
397 $(RESFILE): $(RCFILE) $(IDLGENERATED)
398 $(RSC) $(RCOPT) /fo"$(RESFILE)" $(RCFILE)
401 ###########################################################
402 ############### Linking
403 ###########################################################
406 $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS)
407 @echo Linking the dll $(DLL)
415 /pdb:"$(LIBDIR)/yaz.pdb"
416 /map:"$(LIBDIR)/yaz.map"
419 $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS) #####$(IMPLIB)
420 @echo Linking the client $(CLIENT)
423 $(CLIENT_LINK_OPTIONS)
430 $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(SERVER) $(DLL)
431 @echo Linking the ztest $(ZTEST)
434 $(ZTEST_LINK_OPTIONS)
444 $(SERVER) : "$(BINDIR)" $(YAZ_SERVER_OBJS)
445 @echo Linking the server $(SERVER)
446 $(LINK) $(SERVER_LINK_OPTIONS) @<<
455 # note that this links a lib, so it uses completely different options.
459 ###########################################################
460 ############### Special operations
461 ###########################################################
474 ########### check directories and create if needed
475 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
477 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
478 if not exist "$@/$(NUL)" mkdir "$@"
481 ###########################################################
482 ############### Explicit dependencies
483 ###########################################################
485 $(OBJDIR)/client.obj: $(IDLGENERATED)
487 $(DLL_OBJS): makefile $(PROTOH)
491 foo: $(OBJDIR)\ztest.obj
493 ###########################################################
495 ###########################################################
498 # Revision 1.3 1999-06-08 14:32:30 heikki
499 # Proto.h works all right, removed linker warnings from server.lib
501 # Revision 1.2 1999/06/08 14:07:24 heikki
502 # Renamed a pile of files
503 # Tmpdir (to get around Ms leaving temp files around, and crashing
504 # when too many with same number...)
506 # Revision 1.1 1999/06/08 12:15:41 heikki
507 # Renamed to makefile (.nothing) (from .mak)
508 # Working on the proto.h problems and alternative confiigurations
510 # Revision 1.5 1999/06/04 10:04:28 heikki
513 # Revision 1.4 1999/06/02 13:23:29 heikki
514 # Debug options for C compiler
516 # Revision 1.3 1999/05/19 08:26:22 heikki