1 # Copyright (C) 1993-2004, Index Data ApS
3 # $Id: makefile,v 1.5 2004-04-11 17:53:03 adam Exp $
5 ###########################################################
6 ############### Parameters
7 ###########################################################
9 DEBUG=0 # 0 for release, 1 for debug
16 all: dirs generated dll 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
53 # shortcut names defined here
57 ###########################################################
58 ############### Compiler and linker options
59 ###########################################################
62 YAZ_LIB="$(YAZ_DIR)\lib\yaz.lib"
63 YAZ_DEF=/I"$(YAZ_DIR)\include"
64 yaz: $(BINDIR)\yaz.dll $(BINDIR)\yaz.dll
66 $(BINDIR)\yaz.dll: $(YAZ_DIR)\bin\yaz.dll
67 copy "$(YAZ_DIR)\bin\yaz.dll" $(BINDIR)
70 /nologo /W3 /GX /FD /c \
80 /I"$(ROOTDIR)\include"
91 # /GX = Enable exception handling
92 # /FD = Generate file dependencies (what ever they are)
93 # /c = compile without linking
94 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
95 # /Fo = object file name (or at least path)
96 # /Fd = debug database name (or path)
97 # /MD = Runtime library: Multithread DLL
98 # /MDd = Runtime library: Multithread DLL (debug)
99 # /Od = Disable optimising (debug)
100 # /O2 = Optimize for speed
101 # /YX = Automatic use of precomipled headers
102 # /Gm = Minimal rebuild (some cpp class stuff)
103 # /Zi = Program database for debuggers
104 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
110 LINK_LIBS= kernel32.lib user32.lib gdi32.lib \
111 advapi32.lib uuid.lib \
112 wsock32.lib advapi32.lib \
113 $(YAZ_LIB) $(ICONV_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB)
115 COMMON_LNK_OPTIONS= /nologo \
120 DEBUG_LNK_OPTIONS= /debug
124 DLL_LINK_OPTIONS= /dll
125 CLIENT_LINK_OPTIONS = /subsystem:console
127 # Final opt variables
129 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS) $(COMMON_C_INCLUDES)
130 MTLOPT= $(COMMON_MTL_OPTIONS) $(DEBUG_MTL_OPTIONS)
131 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
132 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS) $(LNK_LIBS)
133 TCLOPT= $(COMMON_TCL_OPTIONS)
136 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS) $(COMMON_C_INCLUDES)
137 MTLOPT= $(COMMON_MTL_OPTIONS) $(RELEASE_MTL_OPTIONS)
138 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
139 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS) $(LNK_LIBS)
140 TCLOPT= $(COMMON_TCL_OPTIONS)
143 ###########################################################
144 ############### Source and object modules
145 ###########################################################
148 "$(OBJDIR)\yaz-socket-manager.obj" \
149 "$(OBJDIR)\yaz-pdu-assoc.obj" \
150 "$(OBJDIR)\yaz-z-assoc.obj" \
151 "$(OBJDIR)\yaz-z-query.obj" \
152 "$(OBJDIR)\yaz-ir-assoc.obj" \
153 "$(OBJDIR)\yaz-z-server.obj" \
154 "$(OBJDIR)\yaz-pdu-assoc-thread.obj" \
155 "$(OBJDIR)\yaz-z-server-sr.obj" \
156 "$(OBJDIR)\yaz-z-server-ill.obj" \
157 "$(OBJDIR)\yaz-z-server-update.obj" \
158 "$(OBJDIR)\yaz-z-databases.obj" \
159 "$(OBJDIR)\yaz-z-cache.obj" \
160 "$(OBJDIR)\yaz-cql2rpn.obj" \
161 "$(OBJDIR)\zexcept.obj" \
162 "$(OBJDIR)\zconn.obj" \
163 "$(OBJDIR)\zquery.obj" \
164 "$(OBJDIR)\zrs.obj" \
168 "$(OBJDIR)\zclient.obj"
170 ###########################################################
171 ############### Compiling
172 ###########################################################
174 # Note: This defines where to look for the necessary
175 # source files. Funny way of doing it, but it works.
177 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
180 {$(ZOOMDIR)}.cpp{$(OBJDIR)}.obj:
183 ###########################################################
184 ############### Resources
185 ###########################################################
187 ### The RC compiler (resource files)
189 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
190 DEBUG_RC_OPTIONS=/d "_DEBUG"
191 RELEASE_RC_OPTIONS=/d "NDEBUG"
193 YAZ_RES=$(OBJDIR)\yaz.res
194 YAZ_RC=$(WINDIR)\yaz.rc
202 $(YAZ_RES): $(YAZ_RC)
203 $(RSC) $(RSOPT) /fo"$(YAZ_RES)" $(YAZ_RC)
205 ###########################################################
206 ############### Linking
207 ###########################################################
209 $(YAZPP_DLL) $(YAZPP_IMPLIB): "$(BINDIR)" $(YAZPP_DLL_OBJS)
210 @echo Linking $(YAZPP_DLL)
217 /implib:"$(YAZPP_IMPLIB)"
218 /map:"$(LIBDIR)\yazpp.map"
221 $(ZCLIENT) : "$(BINDIR)" $(ZCLIENT_OBJS) $(YAZPP_IMPLIB)
222 @echo Linking $(ZCLIENT)
225 $(CLIENT_LINK_OPTIONS)
229 /map:"$(LIBDIR)\zclient.map"
234 ###########################################################
235 ############### Generated Source files
236 ###########################################################
238 generated: $(ZOOMDIR)\zoom.h
240 "$(ZOOMDIR)\zoom.h": "$(ZOOMDIR)\master-header"
241 sed "s/^* / /; s/^*/ /" "$(ZOOMDIR)\master-header" >"$(ZOOMDIR)\zoom.h"
253 -del $(ZOOMDIR)\zoom.h
255 # Because DOS del will only accept one file name to delete,
256 # the _H_ files work only on sets that have just one file.
257 # Z3950_H_FILES had to be spelled out. One more point for MS!
259 ########### check directories and create if needed
260 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
262 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
263 if not exist "$@/$(NUL)" mkdir "$@"