1 # Copyright (C) 2005-2006, Index Data ApS
3 # $Id: makefile,v 1.28 2007-01-12 10:24:25 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
20 BOOST_TOOLSET=vc80 # 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.6.26.win32
27 LIBXSLT_DIR=\libxslt-1.1.17.win32
33 all: dirs config yaz yazpp libxslt dll progs
35 progs: ex_filter_frontend_net test_pipe metaproxy
37 NSIS="c:\program files\nsis\makensis.exe"
43 # The current directory is supposed to be something like
44 # ..../yaz/win, everything is relative to that
45 ROOTDIR=.. # The home of our project
47 INCLDIR=$(ROOTDIR)\include # our includes
48 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
49 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
50 WINDIR=$(ROOTDIR)\win # all these Win make things
51 SRCDIR=$(ROOTDIR)\src # for the case we move them under src
54 OBJDIR=$(WINDIR)\dobj # where we store intermediate files
56 OBJDIR=$(WINDIR)\obj # where we store intermediate files
59 TMPDIR=$(ROOTDIR)\win\tmp
63 ##########################################################
64 ############### Targets - what to make
65 ###########################################################
67 PROJECT_DLL=$(BINDIR)\metaproxy.dll
68 PROJECT_IMPLIB=$(LIBDIR)\metaproxy.lib
69 EX_FILTER_FRONTEND_NET=$(BINDIR)\ex_filter_frontend_net.exe
70 METAPROXY_PROG=$(BINDIR)\metaproxy.exe
71 TEST_PIPE=$(BINDIR)\test_pipe.exe
73 # shortcut names defined here
75 ex_filter_frontend_net: $(EX_FILTER_FRONTEND_NET)
76 metaproxy: $(METAPROXY_PROG)
77 test_pipe: $(TEST_PIPE)
79 ###########################################################
80 ############### Compiler and linker options
81 ###########################################################
92 YAZ_LIB="$(YAZ_DIR)\lib\$(YAZD).lib"
93 YAZ_DEF=/DYAZ_HAVE_XML2=1 /DYAZ_HAVE_XSLT=1 /DYAZ_USE_NEW_LOG=1 /I"$(YAZ_DIR)\include"
95 # Copy yaz.dll to our bin
96 yaz: $(BINDIR)\$(YAZD).dll
97 $(BINDIR)\$(YAZD).dll: "$(YAZ_DIR)\bin\$(YAZD).dll"
98 copy "$(YAZ_DIR)\bin\$(YAZD).dll" $(BINDIR)
100 # YAZ++ includes & libs
101 YAZPP_LIB="$(YAZPP_DIR)\lib\$(YAZPPD).lib"
102 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
104 # Copy yazpp.dll to our bin
105 yazpp: $(BINDIR)\$(YAZPPD).dll
106 $(BINDIR)\$(YAZPPD).dll: "$(YAZPP_DIR)\bin\$(YAZPPD).dll"
107 copy "$(YAZPP_DIR)\bin\$(YAZPPD).dll" $(BINDIR)
109 # Copy libxslt and associates to our bin directory
110 libxslt: $(BINDIR)\libxslt.dll
112 $(BINDIR)\libxslt.dll: "$(LIBXSLT_DIR)\bin\libxslt.dll"
113 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
114 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
115 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
116 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
118 config: $(SRCDIR)\config.hpp
120 $(SRCDIR)\config.hpp:
121 echo /*windows*/ >$(SRCDIR)\config.hpp
126 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-gd-$(BOOST_VERSION).lib
128 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-$(BOOST_VERSION).lib
131 BOOST_DEF = /I"$(BOOST)\include\boost-$(BOOST_VERSION)"
133 "$(BOOST)\lib\libboost_date_time-$(BOOST_LIB_SUFFIX)" \
134 "$(BOOST)\lib\libboost_program_options-$(BOOST_LIB_SUFFIX)" \
135 "$(BOOST)\lib\libboost_thread-$(BOOST_LIB_SUFFIX)" \
136 "$(BOOST)\lib\libboost_unit_test_framework-$(BOOST_LIB_SUFFIX)"
140 /I"$(ICONV_DIR)\include" \
141 /I"$(LIBXML2_DIR)\include" \
142 /I"$(LIBXSLT_DIR)\include"
145 "$(ICONV_DIR)\lib\iconv.lib" \
146 "$(LIBXML2_DIR)\lib\libxml2.lib" \
147 "$(LIBXSLT_DIR)\lib\libxslt.lib"
150 /nologo /W3 /EHsc /FD /c \
151 /D "_CRT_SECURE_NO_DEPRECATE" \
156 /D VERSION=\"$(VERSION)\" \
162 /I"$(ROOTDIR)\include"
172 # /W3 = warning level
173 # /GX = Enable exception handling
174 # /FD = Generate file dependencies (what ever they are)
175 # /c = compile without linking
176 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
177 # /Fo = object file name (or at least path)
178 # /Fd = debug database name (or path)
179 # /MD = Runtime library: Multithread DLL
180 # /MDd = Runtime library: Multithread DLL (debug)
181 # /Od = Disable optimising (debug)
182 # /O2 = Optimize for speed
183 # /Gm = Minimal rebuild (some cpp class stuff)
184 # /Zi = Program database for debuggers
185 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
191 LINK_LIBS=kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib \
192 wsock32.lib advapi32.lib \
194 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXSLT_LIB) \
197 COMMON_LNK_OPTIONS= /nologo \
202 DEBUG_LNK_OPTIONS= /debug
206 DLL_LINK_OPTIONS= /dll
207 PROG_LINK_OPTIONS = /subsystem:console
209 # Final opt variables
211 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS)
212 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
213 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS)
216 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS)
217 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
218 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS)
221 ###########################################################
222 ############### Source and object modules
223 ###########################################################
226 $(OBJDIR)\factory_filter.obj \
227 $(OBJDIR)\factory_static.obj \
228 $(OBJDIR)\filter.obj \
229 $(OBJDIR)\filter_auth_simple.obj \
230 $(OBJDIR)\filter_backend_test.obj \
231 $(OBJDIR)\filter_bounce.obj \
232 $(OBJDIR)\filter_cql_to_rpn.obj \
233 $(OBJDIR)\filter_frontend_net.obj \
234 $(OBJDIR)\filter_http_file.obj \
235 $(OBJDIR)\filter_load_balance.obj \
236 $(OBJDIR)\filter_log.obj \
237 $(OBJDIR)\filter_multi.obj \
238 $(OBJDIR)\filter_query_rewrite.obj \
239 $(OBJDIR)\filter_record_transform.obj \
240 $(OBJDIR)\filter_session_shared.obj \
241 $(OBJDIR)\filter_sru_to_z3950.obj \
242 $(OBJDIR)\filter_template.obj \
243 $(OBJDIR)\filter_virt_db.obj \
244 $(OBJDIR)\filter_z3950_client.obj \
245 $(OBJDIR)\filter_zeerex_explain.obj \
246 $(OBJDIR)\gduutil.obj \
247 $(OBJDIR)\origin.obj \
248 $(OBJDIR)\package.obj \
250 $(OBJDIR)\plainfile.obj \
251 $(OBJDIR)\router_chain.obj \
252 $(OBJDIR)\router_flexml.obj \
253 $(OBJDIR)\session.obj \
254 $(OBJDIR)\sru_util.obj \
255 $(OBJDIR)\thread_pool_observer.obj \
257 $(OBJDIR)\xmlutil.obj
259 EX_FILTER_FRONTEND_NET_OBJS = $(OBJDIR)\ex_filter_frontend_net.obj
260 METAPROXY_OBJS = $(OBJDIR)\metaproxy_prog.obj
261 TEST_PIPE_OBJS = $(OBJDIR)\test_pipe.obj
263 ###########################################################
264 ############### Compiling
265 ###########################################################
267 # Note: This defines where to look for the necessary
268 # source files. Funny way of doing it, but it works.
270 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
273 ###########################################################
274 ############### Resources
275 ###########################################################
277 ### The RC compiler (resource files)
279 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
280 DEBUG_RC_OPTIONS=/d "_DEBUG"
281 RELEASE_RC_OPTIONS=/d "NDEBUG"
283 PROJECT_RES=$(OBJDIR)\metaproxy.res
284 PROJECT_RC=$(WINDIR)\metaproxy.rc
292 $(PROJECT_RES): $(PROJECT_RC)
293 $(RSC) $(RSOPT) /fo"$(PROJECT_RES)" $(PROJECT_RC)
295 ###########################################################
296 ############### Linking
297 ###########################################################
299 $(PROJECT_DLL) $(PROJECT_IMPLIB): "$(BINDIR)" $(PROJECT_DLL_OBJS)
303 $(DLL_LINK_OPTIONS) \
304 $(PROJECT_DLL_OBJS) \
305 /out:"$(PROJECT_DLL)" \
306 /implib:"$(PROJECT_IMPLIB)"
308 $(EX_FILTER_FRONTEND_NET) : "$(BINDIR)" $(EX_FILTER_FRONTEND_NET_OBJS) $(PROJECT_IMPLIB)
311 $(PROG_LINK_OPTIONS) \
313 $(PROJECT_DLL_OBJS) \
314 $(EX_FILTER_FRONTEND_NET_OBJS) \
315 /out:$(EX_FILTER_FRONTEND_NET)
317 $(METAPROXY_PROG) : "$(BINDIR)" $(METAPROXY_OBJS) $(PROJECT_IMPLIB)
320 $(PROG_LINK_OPTIONS) \
322 $(PROJECT_DLL_OBJS) \
324 /out:$(METAPROXY_PROG)
326 $(TEST_PIPE) : "$(BINDIR)" $(TEST_PIPE_OBJS) $(PROJECT_IMPLIB)
329 $(PROG_LINK_OPTIONS) \
332 $(PROJECT_DLL_OBJS) \
343 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
345 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
346 if not exist "$@/$(NUL)" mkdir "$@"