1 # Copyright (C) 2005-2012 Index Data
4 # MS NMAKE makefile for metaproxy
6 # Parameters that we customize often.
7 DEBUG=0 # 0 for release, 1 for debug
12 # YAZ and YAZ++ directories
17 BOOST=\program files\boost\boost_1_43
19 BOOST_TOOLSET=vc90 # vc90 for VS2008, vc80 for VS 2005, vc71 for 2003
22 # libxml2 + libxslt + associates
23 ZLIB_DIR=\zlib-1.2.3.win32
24 ICONV_DIR=\iconv-1.9.2.win32
25 LIBXML2_DIR=\libxml2-2.7.6.win32
26 LIBXSLT_DIR=\libxslt-1.1.26.win32
32 all: dirs config yaz yazpp libxslt progs
34 progs: metaproxy ex_filter_frontend_net # test_pipe does not work
35 NSIS="c:\program files\nsis\makensis.exe"
41 # The current directory is supposed to be something like
42 # ..../yaz/win, everything is relative to that
43 ROOTDIR=.. # The home of our project
45 INCLDIR=$(ROOTDIR)\include # our includes
46 LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there
47 BINDIR=$(ROOTDIR)\bin # We produce exes and dlls there
48 WINDIR=$(ROOTDIR)\win # all these Win make things
49 SRCDIR=$(ROOTDIR)\src # for the case we move them under src
52 OBJDIR=$(WINDIR)\dobj # where we store intermediate files
54 OBJDIR=$(WINDIR)\obj # where we store intermediate files
57 TMPDIR=$(ROOTDIR)\win\tmp
61 ##########################################################
62 ############### Targets - what to make
63 ###########################################################
65 EX_FILTER_FRONTEND_NET=$(BINDIR)\ex_filter_frontend_net.exe
66 METAPROXY_PROG=$(BINDIR)\metaproxy.exe
67 TEST_PIPE=$(BINDIR)\test_pipe.exe
69 # shortcut names defined here
70 ex_filter_frontend_net: $(EX_FILTER_FRONTEND_NET)
71 metaproxy: $(METAPROXY_PROG)
72 test_pipe: $(TEST_PIPE)
74 ###########################################################
75 ############### Compiler and linker options
76 ###########################################################
87 YAZ_LIB="$(YAZ_DIR)\lib\$(YAZD).lib"
88 YAZ_DEF=/DYAZ_HAVE_XML2=1 /DYAZ_HAVE_XSLT=1 /DYAZ_USE_NEW_LOG=1 /I"$(YAZ_DIR)\include"
90 # Copy yaz.dll to our bin
91 yaz: $(BINDIR)\$(YAZD).dll
92 $(BINDIR)\$(YAZD).dll: "$(YAZ_DIR)\bin\$(YAZD).dll"
93 copy "$(YAZ_DIR)\bin\$(YAZD).dll" $(BINDIR)
95 # YAZ++ includes & libs
96 YAZPP_LIB="$(YAZPP_DIR)\lib\$(YAZPPD).lib"
97 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
99 # Copy yazpp.dll to our bin
100 yazpp: $(BINDIR)\$(YAZPPD).dll
101 $(BINDIR)\$(YAZPPD).dll: "$(YAZPP_DIR)\bin\$(YAZPPD).dll"
102 copy "$(YAZPP_DIR)\bin\$(YAZPPD).dll" $(BINDIR)
104 # Copy libxslt and associates to our bin directory
105 libxslt: $(BINDIR)\libxslt.dll
107 $(BINDIR)\libxslt.dll: "$(LIBXSLT_DIR)\bin\libxslt.dll"
108 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
109 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
110 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
111 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
113 config: $(SRCDIR)\config.hpp
115 $(SRCDIR)\config.hpp:
116 echo /*windows*/ >$(SRCDIR)\config.hpp
121 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-gd-$(BOOST_VERSION).lib
123 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-$(BOOST_VERSION).lib
126 BOOST_DEF = /I"$(BOOST)"
128 "$(BOOST)\lib\libboost_thread-$(BOOST_LIB_SUFFIX)" \
129 "$(BOOST)\lib\libboost_regex-$(BOOST_LIB_SUFFIX)" \
130 "$(BOOST)\lib\libboost_date_time-$(BOOST_LIB_SUFFIX)"
133 /I"$(ICONV_DIR)\include" \
134 /I"$(LIBXML2_DIR)\include" \
135 /I"$(LIBXSLT_DIR)\include"
138 "$(ICONV_DIR)\lib\iconv.lib" \
139 "$(LIBXML2_DIR)\lib\libxml2.lib" \
140 "$(LIBXSLT_DIR)\lib\libxslt.lib"
143 /nologo /W3 /EHsc /FD /c \
144 /D "_CRT_SECURE_NO_DEPRECATE" \
149 /D VERSION=\"$(VERSION)\" \
155 /I"$(ROOTDIR)\include"
165 # /W3 = warning level
166 # /GX = Enable exception handling
167 # /FD = Generate file dependencies (what ever they are)
168 # /c = compile without linking
169 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
170 # /Fo = object file name (or at least path)
171 # /Fd = debug database name (or path)
172 # /MD = Runtime library: Multithread DLL
173 # /MDd = Runtime library: Multithread DLL (debug)
174 # /Od = Disable optimising (debug)
175 # /O2 = Optimize for speed
176 # /Gm = Minimal rebuild (some cpp class stuff)
177 # /Zi = Program database for debuggers
178 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
184 LINK_LIBS=kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib \
185 wsock32.lib advapi32.lib \
186 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXSLT_LIB) \
189 COMMON_LNK_OPTIONS= /nologo /subsystem:windows /incremental:no
191 DEBUG_LNK_OPTIONS= /debug
195 DLL_LINK_OPTIONS= /dll
196 PROG_LINK_OPTIONS = /subsystem:console
198 # Final opt variables
200 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS)
201 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
202 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS)
205 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS)
206 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
207 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS)
210 ###########################################################
211 ############### Source and object modules
212 ###########################################################
215 $(OBJDIR)\factory_filter.obj \
216 $(OBJDIR)\factory_static.obj \
217 $(OBJDIR)\filter.obj \
218 $(OBJDIR)\filter_auth_simple.obj \
219 $(OBJDIR)\filter_backend_test.obj \
220 $(OBJDIR)\filter_bounce.obj \
221 $(OBJDIR)\filter_cql_to_rpn.obj \
222 $(OBJDIR)\filter_frontend_net.obj \
223 $(OBJDIR)\filter_http_file.obj \
224 $(OBJDIR)\filter_limit.obj \
225 $(OBJDIR)\filter_load_balance.obj \
226 $(OBJDIR)\filter_log.obj \
227 $(OBJDIR)\filter_multi.obj \
228 $(OBJDIR)\filter_query_rewrite.obj \
229 $(OBJDIR)\filter_record_transform.obj \
230 $(OBJDIR)\filter_session_shared.obj \
231 $(OBJDIR)\filter_sort.obj \
232 $(OBJDIR)\filter_sru_to_z3950.obj \
233 $(OBJDIR)\filter_template.obj \
234 $(OBJDIR)\filter_virt_db.obj \
235 $(OBJDIR)\filter_z3950_client.obj \
236 $(OBJDIR)\filter_zeerex_explain.obj \
237 $(OBJDIR)\filter_zoom.obj \
238 $(OBJDIR)\gduutil.obj \
239 $(OBJDIR)\origin.obj \
240 $(OBJDIR)\package.obj \
242 $(OBJDIR)\plainfile.obj \
243 $(OBJDIR)\router_chain.obj \
244 $(OBJDIR)\router_flexml.obj \
245 $(OBJDIR)\session.obj \
246 $(OBJDIR)\sru_util.obj \
247 $(OBJDIR)\thread_pool_observer.obj \
248 $(OBJDIR)\torus.obj \
249 $(OBJDIR)\url_recipe.obj \
251 $(OBJDIR)\xmlutil.obj
253 EX_FILTER_FRONTEND_NET_OBJS = $(OBJDIR)\ex_filter_frontend_net.obj
254 METAPROXY_OBJS = $(OBJDIR)\metaproxy_prog.obj
255 TEST_PIPE_OBJS = $(OBJDIR)\test_pipe.obj
257 ###########################################################
258 ############### Compiling
259 ###########################################################
261 # Note: This defines where to look for the necessary
262 # source files. Funny way of doing it, but it works.
264 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
267 ###########################################################
268 ############### Resources
269 ###########################################################
271 ### The RC compiler (resource files)
273 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
274 DEBUG_RC_OPTIONS=/d "_DEBUG"
275 RELEASE_RC_OPTIONS=/d "NDEBUG"
277 PROJECT_RES=$(OBJDIR)\metaproxy.res
278 PROJECT_RC=$(WINDIR)\metaproxy.rc
286 $(PROJECT_RES): $(PROJECT_RC)
287 $(RSC) $(RSOPT) /fo"$(PROJECT_RES)" $(PROJECT_RC)
289 ###########################################################
290 ############### Linking
291 ###########################################################
293 $(EX_FILTER_FRONTEND_NET) : "$(BINDIR)" $(EX_FILTER_FRONTEND_NET_OBJS) $(PROJECT_DLL_OBJS)
296 $(PROG_LINK_OPTIONS) \
298 $(PROJECT_DLL_OBJS) \
299 $(EX_FILTER_FRONTEND_NET_OBJS) \
300 /out:$(EX_FILTER_FRONTEND_NET)
302 $(METAPROXY_PROG) : "$(BINDIR)" $(METAPROXY_OBJS) $(PROJECT_DLL_OBJS)
305 $(PROG_LINK_OPTIONS) \
308 $(PROJECT_DLL_OBJS) \
309 /out:$(METAPROXY_PROG)
311 $(TEST_PIPE) : "$(BINDIR)" $(TEST_PIPE_OBJS) $(PROJECT_DLL_OBJS)
314 $(PROG_LINK_OPTIONS) \
316 $(PROJECT_DLL_OBJS) \
328 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
330 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
331 if not exist "$@/$(NUL)" mkdir "$@"