da3ff68cf86abe3cf296ea0981fbfa135a9abd8d
[ir-tcl-moved-to-github.git] / win / makefile
1 # IRTCL makefile for MS NMAKE 
2 # $Id: makefile,v 1.4 2003-03-05 22:06:32 adam Exp $
3 #
4 # Log at the end of the file
5 VERSION=1.4.1
6  
7 ###########################################################
8 ############### Parameters 
9 ###########################################################
10
11 DEBUG=0   # 0 for release, 1 for debug
12
13 default: all
14
15 all: dirs irtcl
16
17 ###########################################################
18 ############### Directories
19 ###########################################################
20 # The current directory is supposed to be something like
21 # ..../IRTCL/Win, everything is relative to that
22 ROOTDIR=..   # The home of IRTCL
23
24 # TCL include files, libraries, etc.
25 TCLINCL="c:\program files\tcl\include"
26 TCLLIB="c:\program files\tcl\lib\tclstub83.lib"
27
28 # YAZ include files, libraries, etc.
29 YAZDIR=$(ROOTDIR)\..\YAZ
30 YAZLIB=$(YAZDIR)\lib\yaz.lib
31 YAZINCL=$(YAZDIR)\include
32
33 # IRTCL Include files, libraries, programs, etc.
34 INCLDIR=$(ROOTDIR)          # our includes
35 LIBDIR=$(ROOTDIR)\lib       # We produce .lib, .exp etc there
36 BINDIR=$(ROOTDIR)\bin       # We produce exes and dlls there
37 WINDIR=$(ROOTDIR)\win       # all these Win make things
38 OBJDIR=$(WINDIR)\obj        # where we store intermediate files
39 UNIXDIR=$(ROOTDIR)\unix     # corresponding unix things
40 SRCDIR=$(ROOTDIR)           # for the case we move them under src
41
42 # Force temp files in a local temp, easier to clean
43 # when nmake crashes and leaves a lot of rubbish behind
44 TMPDIR=$(ROOTDIR)\win\tmp
45 TMP=$(TMPDIR)
46 TEMP=$(TMPDIR)
47
48 ###########################################################
49 ############### Targets - what to make
50 ###########################################################
51
52 IRTCLDLL=$(BINDIR)\irtcl.dll
53 irtcl : $(IRTCLDLL)
54
55 ###########################################################
56 ############### Compiler and linker options 
57 ###########################################################
58
59
60 ### C and CPP compiler  (the same thing)
61 # Note: $(CPP) has already been defined in the environment
62 # (if you set things up right!)
63
64 COMMON_C_OPTIONS=          \
65   /nologo /W3 /GX /FD /c   \
66   /D "WIN32" \
67   /D "IR_TCL_VERSION=\"$(VERSION)\""  \
68   /D USE_TCL_STUBS=1       \
69   /FR"$(OBJDIR)\\"         \
70   /Fo"$(OBJDIR)\\"         \
71   /Fd"$(OBJDIR)\\"
72
73 COMMON_C_INCLUDES= \
74   /I$(SRCDIR) \
75   /I$(YAZINCL) \
76   /I$(TCLINCL) \
77
78 DEBUG_C_OPTIONS=  \
79   /D "_DEBUG"      \
80   /MDd  /Od /YX /Zi /Gm
81
82 RELEASE_C_OPTIONS=  \
83   /D "NDEBUG"        \
84   /MD /O2
85
86 # /W3  = warning level
87 # /GX  = Enable exception handling
88 # /FD  = Generate file dependencies (what ever they are)
89 # /c   = compile without linking
90 # /FR  = Generate browse info (.sbr file that gets combined into .bsc)
91 # /Fo  = object file name (or at least path)
92 # /Fd  = debug database name (or path)
93 # /MD  = Runtime library: Multithread DLL
94 # /MDd = Runtime library: Multithread DLL (debug)
95 # /Od  = Disable optimising (debug)
96 # /O2  = Optimize for speed
97 # /YX  = Automatic use of precomipled headers
98 # /Gm  = Minimal rebuild (some cpp class stuff)
99 # /Zi  = Program database for debuggers
100 # /ZI  = Pgm database with special "edit&continue" stuff - not available in C5
101
102
103 ### Linker options
104 LINK=link.exe
105
106 LINK_LIBS= kernel32.lib user32.lib   gdi32.lib   winspool.lib \
107            comdlg32.lib advapi32.lib shell32.lib ole32.lib    \
108            oleaut32.lib uuid.lib     odbc32.lib  odbccp32.lib \
109            wsock32.lib  advapi32.lib
110
111 COMMON_LNK_OPTIONS= \
112         /nologo \
113         /machine:i386 \
114         /incremental:no
115
116 DEBUG_LNK_OPTIONS= /debug 
117
118 RELEASE_LNK_OPTIONS=  /pdb:none
119
120 IRTCL_LINK_OPTIONS = /dll 
121
122 # Final opt variables
123 !if $(DEBUG)
124 COPT=   $(COMMON_C_OPTIONS)   $(DEBUG_C_OPTIONS)     $(COMMON_C_INCLUDES)
125 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
126 RCOPT=  $(COMMON_RC_OPTIONS)  $(DEBUG_RC_OPTIONS)
127 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS)   $(LNK_LIBS)
128
129 !else
130 COPT=   $(COMMON_C_OPTIONS)   $(RELEASE_C_OPTIONS)   $(COMMON_C_INCLUDES) 
131 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
132 RCOPT=  $(COMMON_RC_OPTIONS)  $(RELEASE_RC_OPTIONS)
133 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
134 !endif
135
136 ###########################################################
137 ###############  Source and object modules
138 ###########################################################
139
140 # Note: Ordinary source files are not specified here at 
141 # all, make finds them in suitable dirs. The object modules
142 # need to be specified, though
143
144 IRTCL_OBJS = \
145         $(OBJDIR)\ir-tcl.obj \
146         $(OBJDIR)\grs.obj \
147         $(OBJDIR)\explain.obj \
148         $(OBJDIR)\marc.obj \
149         $(OBJDIR)\mem.obj \
150         $(OBJDIR)\queue.obj \
151         $(OBJDIR)\select.obj
152
153 ALL_OBJS=$(IRTCL_OBJS)
154
155 ###########################################################
156 ############### Compiling 
157 ###########################################################
158
159 # Note: This defines where to look for the necessary
160 # source files. Funny way of doing it, but it works.
161
162 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
163         @$(CPP) $(COPT) $<
164
165 {$(SRCDIR)}.c{$(OBJDIR)}.obj:
166         @$(CPP) $(COPT) $<
167
168 ###########################################################
169 ############### Resources
170 ###########################################################
171
172 ### The RC compiler (resource files)
173 RSC=rc.exe
174 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)" 
175 DEBUG_RC_OPTIONS=/d "_DEBUG"
176 RELEASE_RC_OPTIONS=/d "NDEBUG"
177
178 RES=$(OBJDIR)\irtcl.res
179 RC=$(WINDIR)\irtcl.rc
180
181 !if $(DEBUG)
182 RSOPT=/d_DEBUG
183 !else
184 RSOPT=/d_NDEBUG
185 !endif
186
187 $(RES): $(RC)
188         $(RSC) $(RSOPT) /fo"$(RES)" $(RC) 
189
190 ###########################################################
191 ############### Linking
192 ###########################################################
193
194 $(IRTCLDLL) : "$(BINDIR)" $(IRTCL_OBJS) $(RES)
195         @echo Linking irtcl DLL $(IRTCLDLL)
196         $(LINK) $(IRTCL_LINK_OPTIONS) @<<
197                 /nologo
198                 $(IRTCL_OBJS) 
199                 $(RES)
200                 /out:$(IRTCLDLL) 
201                 $(YAZLIB)
202                 $(TCLLIB)
203 <<
204
205
206 ###########################################################
207 ############### Special operations
208 ###########################################################
209
210
211 ############## clean
212 clean:
213         -del $(OBJDIR)\*.obj
214         -del $(OBJDIR)\*.sbr
215         -del $(TMPDIR)\*.
216         -del $(IRTCLDLL)
217
218 # Because DOS del will only accept one file name to delete,
219 # the _H_ files work only on sets that have just one file.
220 # Z3950_H_FILES had to be spelled out. One more point for MS!
221
222 ########### check directories and create if needed
223 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
224
225 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
226         if not exist "$@/$(NUL)" mkdir "$@"
227
228 ###########################################################
229 ############### Explicit dependencies
230 ###########################################################
231
232 $(ALL_OBJS): makefile
233
234 # force recompilation of everything, if makefile changed
235
236 ###########################################################
237 ############### Log
238 ###########################################################
239 #
240 # $Log: makefile,v $
241 # Revision 1.4  2003-03-05 22:06:32  adam
242 # TclStubs on WIN32
243 #
244 # Revision 1.3  2003/01/30 13:27:07  adam
245 # Changed version to 1.4.1. Added WIN32 version resource.
246 # IrTcl ignores unexpected PDU's, rather than die.
247 #
248 # Revision 1.2  2001/12/03 00:31:06  adam
249 # Towards 1.4. Configure updates.
250 #
251 # Revision 1.1  1999/09/10 10:02:29  adam
252 # Added MS NMAKE files - removed project files.
253 #
254