1 # Copyright (C) 2005-2008, Index Data ApS
3 # $Id: makefile,v 1.37 2008-02-29 15:25:20 adam Exp $
5 # MS NMAKE makefile for metaproxy
7 # Parameters that we customize often.
8 DEBUG=0 # 0 for release, 1 for debug
13 # YAZ and YAZ++ directories
18 BOOST=\program files\boost\boost_1_35_0
20 BOOST_TOOLSET=vc90 # vc90 for VS2008, vc80 for VS 2005, vc71 for 2003
23 # libxml2 + libxslt + associates
24 ZLIB_DIR=\zlib-1.2.3.win32
25 ICONV_DIR=\iconv-1.9.2.win32
26 LIBXML2_DIR=\libxml2-2.7.1.win32
27 LIBXSLT_DIR=\libxslt-1.1.24.win32
33 all: dirs config yaz yazpp libxslt progs
35 progs: metaproxy ex_filter_frontend_net # test_pipe does not work
36 NSIS="c:\program files\nsis\makensis.exe"
42 # The current directory is supposed to be something like
43 # ..../yaz/win, everything is relative to that
44 ROOTDIR=.. # The home of our project
46 INCLDIR=$(ROOTDIR)\include # our includes
47 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
48 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
49 WINDIR=$(ROOTDIR)\win # all these Win make things
50 SRCDIR=$(ROOTDIR)\src # for the case we move them under src
53 OBJDIR=$(WINDIR)\dobj # where we store intermediate files
55 OBJDIR=$(WINDIR)\obj # where we store intermediate files
58 TMPDIR=$(ROOTDIR)\win\tmp
62 ##########################################################
63 ############### Targets - what to make
64 ###########################################################
66 EX_FILTER_FRONTEND_NET=$(BINDIR)\ex_filter_frontend_net.exe
67 METAPROXY_PROG=$(BINDIR)\metaproxy.exe
68 TEST_PIPE=$(BINDIR)\test_pipe.exe
70 # shortcut names defined here
71 ex_filter_frontend_net: $(EX_FILTER_FRONTEND_NET)
72 metaproxy: $(METAPROXY_PROG)
73 test_pipe: $(TEST_PIPE)
75 ###########################################################
76 ############### Compiler and linker options
77 ###########################################################
88 YAZ_LIB="$(YAZ_DIR)\lib\$(YAZD).lib"
89 YAZ_DEF=/DYAZ_HAVE_XML2=1 /DYAZ_HAVE_XSLT=1 /DYAZ_USE_NEW_LOG=1 /I"$(YAZ_DIR)\include"
91 # Copy yaz.dll to our bin
92 yaz: $(BINDIR)\$(YAZD).dll
93 $(BINDIR)\$(YAZD).dll: "$(YAZ_DIR)\bin\$(YAZD).dll"
94 copy "$(YAZ_DIR)\bin\$(YAZD).dll" $(BINDIR)
96 # YAZ++ includes & libs
97 YAZPP_LIB="$(YAZPP_DIR)\lib\$(YAZPPD).lib"
98 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
100 # Copy yazpp.dll to our bin
101 yazpp: $(BINDIR)\$(YAZPPD).dll
102 $(BINDIR)\$(YAZPPD).dll: "$(YAZPP_DIR)\bin\$(YAZPPD).dll"
103 copy "$(YAZPP_DIR)\bin\$(YAZPPD).dll" $(BINDIR)
105 # Copy libxslt and associates to our bin directory
106 libxslt: $(BINDIR)\libxslt.dll
108 $(BINDIR)\libxslt.dll: "$(LIBXSLT_DIR)\bin\libxslt.dll"
109 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
110 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
111 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
112 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
114 config: $(SRCDIR)\config.hpp
116 $(SRCDIR)\config.hpp:
117 echo /*windows*/ >$(SRCDIR)\config.hpp
122 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-gd-$(BOOST_VERSION).lib
124 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-$(BOOST_VERSION).lib
127 BOOST_DEF = /I"$(BOOST)"
129 "$(BOOST)\lib\libboost_date_time-$(BOOST_LIB_SUFFIX)" \
130 "$(BOOST)\lib\libboost_thread-$(BOOST_LIB_SUFFIX)"
132 #"$(BOOST)\lib\libboost_program_options-$(BOOST_LIB_SUFFIX)" \
133 # "$(BOOST)\lib\libboost_unit_test_framework-$(BOOST_LIB_SUFFIX)"
137 /I"$(ICONV_DIR)\include" \
138 /I"$(LIBXML2_DIR)\include" \
139 /I"$(LIBXSLT_DIR)\include"
142 "$(ICONV_DIR)\lib\iconv.lib" \
143 "$(LIBXML2_DIR)\lib\libxml2.lib" \
144 "$(LIBXSLT_DIR)\lib\libxslt.lib"
147 /nologo /W3 /EHsc /FD /c \
148 /D "_CRT_SECURE_NO_DEPRECATE" \
153 /D VERSION=\"$(VERSION)\" \
159 /I"$(ROOTDIR)\include"
169 # /W3 = warning level
170 # /GX = Enable exception handling
171 # /FD = Generate file dependencies (what ever they are)
172 # /c = compile without linking
173 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
174 # /Fo = object file name (or at least path)
175 # /Fd = debug database name (or path)
176 # /MD = Runtime library: Multithread DLL
177 # /MDd = Runtime library: Multithread DLL (debug)
178 # /Od = Disable optimising (debug)
179 # /O2 = Optimize for speed
180 # /Gm = Minimal rebuild (some cpp class stuff)
181 # /Zi = Program database for debuggers
182 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
188 LINK_LIBS=kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib \
189 wsock32.lib advapi32.lib \
191 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXSLT_LIB) \
194 COMMON_LNK_OPTIONS= /nologo \
199 DEBUG_LNK_OPTIONS= /debug
203 DLL_LINK_OPTIONS= /dll
204 PROG_LINK_OPTIONS = /subsystem:console
206 # Final opt variables
208 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS)
209 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
210 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS)
213 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS)
214 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
215 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS)
218 ###########################################################
219 ############### Source and object modules
220 ###########################################################
223 $(OBJDIR)\factory_filter.obj \
224 $(OBJDIR)\factory_static.obj \
225 $(OBJDIR)\filter.obj \
226 $(OBJDIR)\filter_auth_simple.obj \
227 $(OBJDIR)\filter_backend_test.obj \
228 $(OBJDIR)\filter_bounce.obj \
229 $(OBJDIR)\filter_cql_to_rpn.obj \
230 $(OBJDIR)\filter_frontend_net.obj \
231 $(OBJDIR)\filter_http_file.obj \
232 $(OBJDIR)\filter_load_balance.obj \
233 $(OBJDIR)\filter_log.obj \
234 $(OBJDIR)\filter_multi.obj \
235 $(OBJDIR)\filter_query_rewrite.obj \
236 $(OBJDIR)\filter_record_transform.obj \
237 $(OBJDIR)\filter_session_shared.obj \
238 $(OBJDIR)\filter_sru_to_z3950.obj \
239 $(OBJDIR)\filter_template.obj \
240 $(OBJDIR)\filter_virt_db.obj \
241 $(OBJDIR)\filter_z3950_client.obj \
242 $(OBJDIR)\filter_zeerex_explain.obj \
243 $(OBJDIR)\gduutil.obj \
244 $(OBJDIR)\origin.obj \
245 $(OBJDIR)\package.obj \
247 $(OBJDIR)\plainfile.obj \
248 $(OBJDIR)\router_chain.obj \
249 $(OBJDIR)\router_flexml.obj \
250 $(OBJDIR)\session.obj \
251 $(OBJDIR)\sru_util.obj \
252 $(OBJDIR)\thread_pool_observer.obj \
254 $(OBJDIR)\xmlutil.obj
256 EX_FILTER_FRONTEND_NET_OBJS = $(OBJDIR)\ex_filter_frontend_net.obj
257 METAPROXY_OBJS = $(OBJDIR)\metaproxy_prog.obj
258 TEST_PIPE_OBJS = $(OBJDIR)\test_pipe.obj
260 ###########################################################
261 ############### Compiling
262 ###########################################################
264 # Note: This defines where to look for the necessary
265 # source files. Funny way of doing it, but it works.
267 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
270 ###########################################################
271 ############### Resources
272 ###########################################################
274 ### The RC compiler (resource files)
276 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
277 DEBUG_RC_OPTIONS=/d "_DEBUG"
278 RELEASE_RC_OPTIONS=/d "NDEBUG"
280 PROJECT_RES=$(OBJDIR)\metaproxy.res
281 PROJECT_RC=$(WINDIR)\metaproxy.rc
289 $(PROJECT_RES): $(PROJECT_RC)
290 $(RSC) $(RSOPT) /fo"$(PROJECT_RES)" $(PROJECT_RC)
292 ###########################################################
293 ############### Linking
294 ###########################################################
296 $(EX_FILTER_FRONTEND_NET) : "$(BINDIR)" $(EX_FILTER_FRONTEND_NET_OBJS) $(PROJECT_DLL_OBJS)
299 $(PROG_LINK_OPTIONS) \
301 $(PROJECT_DLL_OBJS) \
302 $(EX_FILTER_FRONTEND_NET_OBJS) \
303 /out:$(EX_FILTER_FRONTEND_NET)
305 $(METAPROXY_PROG) : "$(BINDIR)" $(METAPROXY_OBJS) $(PROJECT_DLL_OBJS)
308 $(PROG_LINK_OPTIONS) \
311 $(PROJECT_DLL_OBJS) \
312 /out:$(METAPROXY_PROG)
314 $(TEST_PIPE) : "$(BINDIR)" $(TEST_PIPE_OBJS) $(PROJECT_DLL_OBJS)
317 $(PROG_LINK_OPTIONS) \
319 $(PROJECT_DLL_OBJS) \
331 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
333 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
334 if not exist "$@/$(NUL)" mkdir "$@"