1 # Makefile.mak - makefile for MS NMAKE
2 # $Id: makefile,v 1.2 1999-06-08 14:07:24 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=$(BINDIR)\Yaz.lib
71 CLIENT=$(BINDIR)\client.exe
72 SERVER=$(BINDIR)\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 ############### Compiling
317 ###########################################################
319 # Note: This defines where to look for the necessary
320 # source files. Funny way of doing it, but it works.
323 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
329 {$(CLIENTDIR)}.c{$(OBJDIR)}.obj:
330 echo MAKING IN CLIENT !!!!!
337 {$(ZTESTDIR)}.c{$(OBJDIR)}.obj:
346 {$(SERVERDIR)}.c{$(OBJDIR)}.obj:
351 # Various YAZ source directories
352 {$(ASNDIR)}.c{$(OBJDIR)}.obj:
357 {$(COMSTACKDIR)}.c{$(OBJDIR)}.obj:
362 {$(ODRDIR)}.c{$(OBJDIR)}.obj:
367 {$(UTILDIR)}.c{$(OBJDIR)}.obj:
372 {$(ZUTILDIR)}.c{$(OBJDIR)}.obj:
377 {$(RETDIR)}.c{$(OBJDIR)}.obj:
384 $(RESFILE): $(RCFILE) $(IDLGENERATED)
385 $(RSC) $(RCOPT) /fo"$(RESFILE)" $(RCFILE)
388 ###########################################################
389 ############### Linking
390 ###########################################################
393 $(DLL) $(IMPLIB): "$(BINDIR)" $(DLL_OBJS)
394 @echo Linking the dll $(DLL)
402 /pdb:"$(LIBDIR)/yaz.pdb"
403 /map:"$(LIBDIR)/yaz.map"
406 $(CLIENT) : "$(BINDIR)" $(YAZ_CLIENT_OBJS) #####$(IMPLIB)
407 @echo Linking the client $(CLIENT)
410 $(CLIENT_LINK_OPTIONS)
417 $(ZTEST) : "$(BINDIR)" $(ZTEST_OBJS) $(SERVER) $(DLL)
418 @echo Linking the ztest $(ZTEST)
421 $(ZTEST_LINK_OPTIONS)
431 $(SERVER) : "$(BINDIR)" $(YAZ_SERVER_OBJS)
432 @echo Linking the server $(SERVER)
433 $(LINK) $(SERVER_LINK_OPTIONS) @<<
441 # note that this links a lib, so it uses completely different options.
445 ###########################################################
446 ############### Special operations
447 ###########################################################
460 ########### check directories and create if needed
461 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
463 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
464 if not exist "$@/$(NUL)" mkdir "$@"
467 ###########################################################
468 ############### Explicit dependencies
469 ###########################################################
471 $(OBJDIR)/client.obj: $(IDLGENERATED)
473 $(DLL_OBJS): makefile $(PROTOH)
477 foo: $(OBJDIR)\ztest.obj
479 ###########################################################
481 ###########################################################
484 # Revision 1.2 1999-06-08 14:07:24 heikki
485 # Renamed a pile of files
486 # Tmpdir (to get around Ms leaving temp files around, and crashing
487 # when too many with same number...)
489 # Revision 1.1 1999/06/08 12:15:41 heikki
490 # Renamed to makefile (.nothing) (from .mak)
491 # Working on the proto.h problems and alternative confiigurations
493 # Revision 1.5 1999/06/04 10:04:28 heikki
496 # Revision 1.4 1999/06/02 13:23:29 heikki
497 # Debug options for C compiler
499 # Revision 1.3 1999/05/19 08:26:22 heikki