Added MS NMAKE files - removed project files.
[ir-tcl-moved-to-github.git] / win / makefile
1 # IRTCL makefile for MS NMAKE 
2 # $Id: makefile,v 1.1 1999-09-10 10:02:29 adam Exp $
3 #
4 # Log at the end of the file
5 VERSION=1.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 TCLINCL="c:\program files\tcl\include"
26 TCLLIB="c:\program files\tcl\lib\tcl82.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 ############### Linking
168 ###########################################################
169
170 $(IRTCLDLL) : "$(BINDIR)" $(IRTCL_OBJS) 
171         @echo Linking irtcl DLL $(IRTCLDLL)
172         $(LINK) $(IRTCL_LINK_OPTIONS) @<<
173                 /nologo
174                 $(IRTCL_OBJS) 
175                 /out:$(IRTCLDLL) 
176                 $(YAZLIB)
177                 $(TCLLIB)
178 <<
179
180
181 ###########################################################
182 ############### Special operations
183 ###########################################################
184
185
186 ############## clean
187 clean:
188         del $(OBJDIR)\*.obj
189         del $(OBJDIR)\*.sbr
190         del $(TMPDIR)\*.
191         del $(IRTCLDLL)
192
193 # Because DOS del will only accept one file name to delete,
194 # the _H_ files work only on sets that have just one file.
195 # Z3950_H_FILES had to be spelled out. One more point for MS!
196
197 ########### check directories and create if needed
198 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
199
200 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
201         if not exist "$@/$(NUL)" mkdir "$@"
202
203 ###########################################################
204 ############### Explicit dependencies
205 ###########################################################
206
207 $(ALL_OBJS): makefile
208
209 # force recompilation of everything, if makefile changed
210
211 ###########################################################
212 ############### Log
213 ###########################################################
214 #
215 # $Log: makefile,v $
216 # Revision 1.1  1999-09-10 10:02:29  adam
217 # Added MS NMAKE files - removed project files.
218 #
219