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