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