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" \
144 /D _SCL_SECURE_NO_WARNINGS \
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_rpn.obj \
222 $(OBJDIR)\filter_frontend_net.obj \
223 $(OBJDIR)\filter_http_client.obj \
224 $(OBJDIR)\filter_http_file.obj \
225 $(OBJDIR)\filter_http_rewrite.obj \
226 $(OBJDIR)\filter_http_rewrite1.obj \
227 $(OBJDIR)\filter_limit.obj \
228 $(OBJDIR)\filter_load_balance.obj \
229 $(OBJDIR)\filter_log.obj \
230 $(OBJDIR)\filter_multi.obj \
231 $(OBJDIR)\filter_present_chunk.obj \
232 $(OBJDIR)\filter_query_rewrite.obj \
233 $(OBJDIR)\filter_record_transform.obj \
234 $(OBJDIR)\filter_sd_remove.obj \
235 $(OBJDIR)\filter_session_shared.obj \
236 $(OBJDIR)\filter_sort.obj \
237 $(OBJDIR)\filter_sru_to_z3950.obj \
238 $(OBJDIR)\filter_template.obj \
239 $(OBJDIR)\filter_virt_db.obj \
240 $(OBJDIR)\filter_z3950_client.obj \
241 $(OBJDIR)\filter_zeerex_explain.obj \
242 $(OBJDIR)\filter_zoom.obj \
243 $(OBJDIR)\gduutil.obj \
244 $(OBJDIR)\html_parser.obj \
245 $(OBJDIR)\origin.obj \
246 $(OBJDIR)\package.obj \
248 $(OBJDIR)\plainfile.obj \
249 $(OBJDIR)\router_chain.obj \
250 $(OBJDIR)\router_flexml.obj \
251 $(OBJDIR)\router_xml.obj \
252 $(OBJDIR)\session.obj \
253 $(OBJDIR)\sru_util.obj \
254 $(OBJDIR)\thread_pool_observer.obj \
255 $(OBJDIR)\torus.obj \
256 $(OBJDIR)\url_recipe.obj \
258 $(OBJDIR)\xmlutil.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 $(METAPROXY_PROG) : "$(BINDIR)" $(METAPROXY_OBJS) $(PROJECT_DLL_OBJS)
302 $(PROG_LINK_OPTIONS) \
305 $(PROJECT_DLL_OBJS) \
306 /out:$(METAPROXY_PROG)
308 $(TEST_PIPE) : "$(BINDIR)" $(TEST_PIPE_OBJS) $(PROJECT_DLL_OBJS)
311 $(PROG_LINK_OPTIONS) \
313 $(PROJECT_DLL_OBJS) \
325 dirs: $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR)
327 $(OBJDIR) $(WINDIR) $(LIBDIR) $(BINDIR) $(TMPDIR):
328 if not exist "$@/$(NUL)" mkdir "$@"