1 # Copyright (C) 1993-2004, Index Data ApS
3 # $Id: makefile,v 1.8 2005-11-03 14:46:34 adam Exp $
5 ###########################################################
6 ############### Parameters
7 ###########################################################
9 DEBUG=0 # 0 for release, 1 for debug
16 all: dirs generated dll myclient zclient yaz
18 NSIS="c:\program files\nsis\makensis-bz2.exe"
26 ###########################################################
27 ############### Directories
28 ###########################################################
29 # The current directory is supposed to be something like
30 # ..../yaz/win, everything is relative to that
31 ROOTDIR=.. # The home of yaz++
33 INCLDIR=$(ROOTDIR)\include # our includes
34 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
35 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
36 WINDIR=$(ROOTDIR)\win # all these Win make things
37 OBJDIR=$(WINDIR)\obj # where we store intermediate files
38 SRCDIR=$(ROOTDIR)\src # for the case we move them under src
39 PROXYDIR=$(ROOTDIR)\proxy
40 ZOOMDIR=$(ROOTDIR)\zoom
42 TMPDIR=$(ROOTDIR)\win\tmp
45 ###########################################################
46 ############### Targets - what to make
47 ###########################################################
49 YAZPP_DLL=$(BINDIR)\yazpp.dll
50 YAZPP_IMPLIB=$(LIBDIR)\yazpp.lib
51 ZCLIENT=$(BINDIR)\zclient.exe
52 MY_CLIENT=$(BINDIR)\yaz-my-client.exe
54 # shortcut names defined here
57 myclient: $(MY_CLIENT)
59 ###########################################################
60 ############### Compiler and linker options
61 ###########################################################
64 YAZ_LIB="$(YAZ_DIR)\lib\yaz.lib"
65 YAZ_DEF=/I"$(YAZ_DIR)\include"
66 yaz: $(BINDIR)\yaz.dll $(BINDIR)\yaz.dll
68 $(BINDIR)\yaz.dll: $(YAZ_DIR)\bin\yaz.dll
69 copy "$(YAZ_DIR)\bin\yaz.dll" $(BINDIR)
72 /nologo /W3 /GX /FD /c \
82 /I"$(ROOTDIR)\include"
93 # /GX = Enable exception handling
94 # /FD = Generate file dependencies (what ever they are)
95 # /c = compile without linking
96 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
97 # /Fo = object file name (or at least path)
98 # /Fd = debug database name (or path)
99 # /MD = Runtime library: Multithread DLL
100 # /MDd = Runtime library: Multithread DLL (debug)
101 # /Od = Disable optimising (debug)
102 # /O2 = Optimize for speed
103 # /YX = Automatic use of precomipled headers
104 # /Gm = Minimal rebuild (some cpp class stuff)
105 # /Zi = Program database for debuggers
106 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
112 LINK_LIBS= kernel32.lib user32.lib gdi32.lib \
113 advapi32.lib uuid.lib \
114 wsock32.lib advapi32.lib \
115 $(YAZ_LIB) $(ICONV_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB)
117 COMMON_LNK_OPTIONS= /nologo \
122 DEBUG_LNK_OPTIONS= /debug
126 DLL_LINK_OPTIONS= /dll
127 CLIENT_LINK_OPTIONS = /subsystem:console
129 # Final opt variables
131 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
132 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
133 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
134 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
135 TCLOPT= $(COMMON_TCL_OPTIONS)
138 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
139 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
140 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
141 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
142 TCLOPT= $(COMMON_TCL_OPTIONS)
145 ###########################################################
146 ############### Source and object modules
147 ###########################################################
150 "$(OBJDIR)\gdu.obj" \
151 "$(OBJDIR)\gduqueue.obj" \
152 "$(OBJDIR)\pdu-observer.obj" \
153 "$(OBJDIR)\query.obj" \
154 "$(OBJDIR)\socket-observer.obj" \
155 "$(OBJDIR)\z-server.obj" \
156 "$(OBJDIR)\yaz-socket-manager.obj" \
157 "$(OBJDIR)\yaz-pdu-assoc.obj" \
158 "$(OBJDIR)\yaz-z-assoc.obj" \
159 "$(OBJDIR)\yaz-z-query.obj" \
160 "$(OBJDIR)\yaz-ir-assoc.obj" \
161 "$(OBJDIR)\yaz-z-server.obj" \
162 "$(OBJDIR)\yaz-pdu-assoc-thread.obj" \
163 "$(OBJDIR)\yaz-z-server-sr.obj" \
164 "$(OBJDIR)\yaz-z-server-ill.obj" \
165 "$(OBJDIR)\yaz-z-server-update.obj" \
166 "$(OBJDIR)\yaz-z-databases.obj" \
167 "$(OBJDIR)\yaz-z-cache.obj" \
168 "$(OBJDIR)\yaz-cql2rpn.obj" \
169 "$(OBJDIR)\zexcept.obj" \
170 "$(OBJDIR)\zconn.obj" \
171 "$(OBJDIR)\zquery.obj" \
172 "$(OBJDIR)\zrs.obj" \
176 "$(OBJDIR)\yaz-my-client.obj"
179 "$(OBJDIR)\zclient.obj"
181 ###########################################################
182 ############### Compiling
183 ###########################################################
185 # Note: This defines where to look for the necessary
186 # source files. Funny way of doing it, but it works.
188 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
191 {$(ZOOMDIR)}.cpp{$(OBJDIR)}.obj:
194 ###########################################################
195 ############### Resources
196 ###########################################################
198 ### The RC compiler (resource files)
200 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
201 DEBUG_RC_OPTIONS=/d "_DEBUG"
202 RELEASE_RC_OPTIONS=/d "NDEBUG"
204 YAZ_RES=$(OBJDIR)\yaz.res
205 YAZ_RC=$(WINDIR)\yaz.rc
213 $(YAZ_RES): $(YAZ_RC)
214 $(RSC) $(RSOPT) /fo"$(YAZ_RES)" $(YAZ_RC)
216 ###########################################################
217 ############### Linking
218 ###########################################################
220 $(YAZPP_DLL) $(YAZPP_IMPLIB): "$(BINDIR)" $(YAZPP_DLL_OBJS)
221 @echo Linking $(YAZPP_DLL)
228 /implib:"$(YAZPP_IMPLIB)"
229 /map:"$(LIBDIR)\yazpp.map"
232 $(MY_CLIENT) : "$(BINDIR)" $(MY_CLIENT_OBJS) $(YAZPP_IMPLIB)
233 @echo Linking $(MY_CLIENT)
236 $(CLIENT_LINK_OPTIONS)
240 /map:"$(LIBDIR)\yaz-my-client.map"
244 $(ZCLIENT) : "$(BINDIR)" $(ZCLIENT_OBJS) $(YAZPP_IMPLIB)
245 @echo Linking $(ZCLIENT)
248 $(CLIENT_LINK_OPTIONS)
252 /map:"$(LIBDIR)\zclient.map"
257 ###########################################################
258 ############### Generated Source files
259 ###########################################################
261 generated: $(ZOOMDIR)\zoom.h
263 "$(ZOOMDIR)\zoom.h": "$(ZOOMDIR)\master-header"
264 sed "s/^* / /; s/^*/ /" "$(ZOOMDIR)\master-header" >"$(ZOOMDIR)\zoom.h"
276 -del $(ZOOMDIR)\zoom.h
278 # Because DOS del will only accept one file name to delete,
279 # the _H_ files work only on sets that have just one file.
280 # Z3950_H_FILES had to be spelled out. One more point for MS!
282 ########### check directories and create if needed
283 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
285 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
286 if not exist "$@/$(NUL)" mkdir "$@"