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