1 # Copyright (C) 2005-2013 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_51
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 # 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 METAPROXY_PROG=$(BINDIR)\metaproxy.exe
66 TEST_PIPE=$(BINDIR)\test_pipe.exe
68 # shortcut names defined here
69 metaproxy: $(METAPROXY_PROG)
70 test_pipe: $(TEST_PIPE)
72 ###########################################################
73 ############### Compiler and linker options
74 ###########################################################
85 YAZ_LIB="$(YAZ_DIR)\lib\$(YAZD).lib"
86 YAZ_DEF=/DYAZ_HAVE_XML2=1 /DYAZ_HAVE_XSLT=1 /DYAZ_USE_NEW_LOG=1 /I"$(YAZ_DIR)\include"
88 # Copy yaz.dll to our bin
89 yaz: $(BINDIR)\$(YAZD).dll
90 $(BINDIR)\$(YAZD).dll: "$(YAZ_DIR)\bin\$(YAZD).dll"
91 copy "$(YAZ_DIR)\bin\$(YAZD).dll" $(BINDIR)
93 # YAZ++ includes & libs
94 YAZPP_LIB="$(YAZPP_DIR)\lib\$(YAZPPD).lib"
95 YAZPP_DEF=/I"$(YAZPP_DIR)\include"
97 # Copy yazpp.dll to our bin
98 yazpp: $(BINDIR)\$(YAZPPD).dll
99 $(BINDIR)\$(YAZPPD).dll: "$(YAZPP_DIR)\bin\$(YAZPPD).dll"
100 copy "$(YAZPP_DIR)\bin\$(YAZPPD).dll" $(BINDIR)
102 # Copy libxslt and associates to our bin directory
103 libxslt: $(BINDIR)\libxslt.dll
105 $(BINDIR)\libxslt.dll: "$(LIBXSLT_DIR)\bin\libxslt.dll"
106 copy "$(ICONV_DIR)\bin\iconv.dll" $(BINDIR)
107 copy "$(ZLIB_DIR)\bin\zlib1.dll" $(BINDIR)
108 copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR)
109 copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR)
111 config: $(SRCDIR)\config.hpp
113 $(SRCDIR)\config.hpp:
114 echo /*windows*/ >$(SRCDIR)\config.hpp
119 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-gd-$(BOOST_VERSION).lib
121 BOOST_LIB_SUFFIX=$(BOOST_TOOLSET)-$(BOOST_MODEL)-$(BOOST_VERSION).lib
124 BOOST_DEF = /I"$(BOOST)"
126 /LIBPATH:"$(BOOST)\lib" \
127 "libboost_thread-$(BOOST_LIB_SUFFIX)" \
128 "libboost_regex-$(BOOST_LIB_SUFFIX)" \
129 "libboost_date_time-$(BOOST_LIB_SUFFIX)"
132 /I"$(ICONV_DIR)\include" \
133 /I"$(LIBXML2_DIR)\include" \
134 /I"$(LIBXSLT_DIR)\include"
137 "$(ICONV_DIR)\lib\iconv.lib" \
138 "$(LIBXML2_DIR)\lib\libxml2.lib" \
139 "$(LIBXSLT_DIR)\lib\libxslt.lib"
142 /nologo /W3 /EHsc /FD /c \
143 /D "_CRT_SECURE_NO_DEPRECATE" \
148 /D VERSION=\"$(VERSION)\" \
154 /I"$(ROOTDIR)\include"
164 # /W3 = warning level
165 # /GX = Enable exception handling
166 # /FD = Generate file dependencies (what ever they are)
167 # /c = compile without linking
168 # /FR = Generate browse info (.sbr file that gets combined into .bsc)
169 # /Fo = object file name (or at least path)
170 # /Fd = debug database name (or path)
171 # /MD = Runtime library: Multithread DLL
172 # /MDd = Runtime library: Multithread DLL (debug)
173 # /Od = Disable optimising (debug)
174 # /O2 = Optimize for speed
175 # /Gm = Minimal rebuild (some cpp class stuff)
176 # /Zi = Program database for debuggers
177 # /ZI = Pgm database with special "edit&continue" stuff - not available in C5
183 LINK_LIBS=kernel32.lib user32.lib gdi32.lib advapi32.lib uuid.lib \
184 wsock32.lib advapi32.lib \
185 $(YAZ_LIB) $(YAZPP_LIB) $(ICONV_LIB) $(LIBXSLT_LIB) \
188 COMMON_LNK_OPTIONS= /nologo /subsystem:windows /incremental:no
190 DEBUG_LNK_OPTIONS= /debug
194 DLL_LINK_OPTIONS= /dll
195 PROG_LINK_OPTIONS = /subsystem:console
197 # Final opt variables
199 COPT= $(COMMON_C_OPTIONS) $(DEBUG_C_OPTIONS)
200 RCOPT= $(COMMON_RC_OPTIONS) $(DEBUG_RC_OPTIONS)
201 LNKOPT= $(COMMON_LNK_OPTIONS) $(DEBUG_LNK_OPTIONS)
204 COPT= $(COMMON_C_OPTIONS) $(RELEASE_C_OPTIONS)
205 RCOPT= $(COMMON_RC_OPTIONS) $(RELEASE_RC_OPTIONS)
206 LNKOPT= $(COMMON_LNK_OPTIONS) $(RELEASE_LNK_OPTIONS)
209 ###########################################################
210 ############### Source and object modules
211 ###########################################################
214 $(OBJDIR)\factory_filter.obj \
215 $(OBJDIR)\factory_static.obj \
216 $(OBJDIR)\filter.obj \
217 $(OBJDIR)\filter_auth_simple.obj \
218 $(OBJDIR)\filter_backend_test.obj \
219 $(OBJDIR)\filter_bounce.obj \
220 $(OBJDIR)\filter_cql_rpn.obj \
221 $(OBJDIR)\filter_frontend_net.obj \
222 $(OBJDIR)\filter_http_client.obj \
223 $(OBJDIR)\filter_http_file.obj \
224 $(OBJDIR)\filter_http_rewrite.obj \
225 $(OBJDIR)\filter_http_rewrite1.obj \
226 $(OBJDIR)\filter_limit.obj \
227 $(OBJDIR)\filter_load_balance.obj \
228 $(OBJDIR)\filter_log.obj \
229 $(OBJDIR)\filter_multi.obj \
230 $(OBJDIR)\filter_present_chunk.obj \
231 $(OBJDIR)\filter_query_rewrite.obj \
232 $(OBJDIR)\filter_record_transform.obj \
233 $(OBJDIR)\filter_sd_remove.obj \
234 $(OBJDIR)\filter_session_shared.obj \
235 $(OBJDIR)\filter_sort.obj \
236 $(OBJDIR)\filter_sru_to_z3950.obj \
237 $(OBJDIR)\filter_template.obj \
238 $(OBJDIR)\filter_virt_db.obj \
239 $(OBJDIR)\filter_z3950_client.obj \
240 $(OBJDIR)\filter_zeerex_explain.obj \
241 $(OBJDIR)\filter_zoom.obj \
242 $(OBJDIR)\gduutil.obj \
243 $(OBJDIR)\html_parser.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)\router_xml.obj \
251 $(OBJDIR)\session.obj \
252 $(OBJDIR)\sru_util.obj \
253 $(OBJDIR)\thread_pool_observer.obj \
254 $(OBJDIR)\torus.obj \
255 $(OBJDIR)\url_recipe.obj \
257 $(OBJDIR)\xmlutil.obj
259 METAPROXY_OBJS = $(OBJDIR)\metaproxy_prog.obj
260 TEST_PIPE_OBJS = $(OBJDIR)\test_pipe.obj
262 ###########################################################
263 ############### Compiling
264 ###########################################################
266 # Note: This defines where to look for the necessary
267 # source files. Funny way of doing it, but it works.
269 {$(SRCDIR)}.cpp{$(OBJDIR)}.obj:
272 ###########################################################
273 ############### Resources
274 ###########################################################
276 ### The RC compiler (resource files)
278 COMMON_RC_OPTIONS= /l 0x406 /i"$(ROOTDIR)"
279 DEBUG_RC_OPTIONS=/d "_DEBUG"
280 RELEASE_RC_OPTIONS=/d "NDEBUG"
282 PROJECT_RES=$(OBJDIR)\metaproxy.res
283 PROJECT_RC=$(WINDIR)\metaproxy.rc
291 $(PROJECT_RES): $(PROJECT_RC)
292 $(RSC) $(RSOPT) /fo"$(PROJECT_RES)" $(PROJECT_RC)
294 ###########################################################
295 ############### Linking
296 ###########################################################
298 $(METAPROXY_PROG) : "$(BINDIR)" $(METAPROXY_OBJS) $(PROJECT_DLL_OBJS)
301 $(PROG_LINK_OPTIONS) \
304 $(PROJECT_DLL_OBJS) \
305 /out:$(METAPROXY_PROG)
307 $(TEST_PIPE) : "$(BINDIR)" $(TEST_PIPE_OBJS) $(PROJECT_DLL_OBJS)
310 $(PROG_LINK_OPTIONS) \
312 $(PROJECT_DLL_OBJS) \
324 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
326 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
327 if not exist "$@/$(NUL)" mkdir "$@"