From Marek Tews:
[obnox/wireshark/wip.git] / Makefile.nmake
1 ## Makefile for building wireshark.exe with Microsoft C and nmake
2 ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
3 #
4 # $Id$
5
6 # We "Deploy using XCopy," which is described at
7 # http://msdn.microsoft.com/en-us/library/ms235291.aspx
8
9 include config.nmake
10 include <win32.mak>
11
12 ############### no need to modify below this line #########
13
14 CC = cl
15 LINK= link
16 BSCMAKE= bscmake
17
18 WIN_SETUP=tools/$(WIRESHARK_TARGET_PLATFORM)-setup.sh
19
20 # -------------
21 # Checking  that the Wireshark Libraries are up-to-date:
22 #  1. win??-setup.sh --checktag is invoked during nmake "preprocessing".
23 #     If an error status is returned (ie: the libraries are not up-to-date)
24 #      then CHECK_TAG is defined as a non-null string.
25 #  2. The $(LIBS_CHECK) target is invoked during the nmake:
26 #     If $(CHECK_TAG) is non-null, then a "libraries not up to date" exit will occur.
27 #     If $(CHECK_TAG) is null, but either config.nmake or Makefile.nmake
28 #      are newer than the $(LIBS_CHECK) target, then a detailed verification
29 #      as to the required library package files will be made.
30 #
31 LIBS_CHECK=_libs_check_
32 !IF [$(SH) $(WIN_SETUP) --checktag "$(WIRESHARK_LIB_DIR)"] != 0
33 CHECK_TAG=_check_tag_
34 !ELSE
35 CHECK_TAG=
36 !ENDIF
37 # -------------
38
39 LDFLAGS = /NOLOGO /INCREMENTAL:NO $(LOCAL_LDFLAGS)
40
41 # We use GENERATED_CFLAGS to get around flex's non-LLP64-compliant output
42 GENERATED_CFLAGS=\
43         $(STANDARD_CFLAGS) \
44         -D_NEED_VAR_IMPORT_ \
45         /I.  /Iwiretap $(GLIB_CFLAGS) \
46         $(ZLIB_CFLAGS) /I$(PCAP_DIR)\include $(AIRPCAP_CFLAGS) \
47         $(C_ARES_CFLAGS) $(ADNS_CFLAGS) $(GNUTLS_CFLAGS) \
48         $(PYTHON_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS)
49
50 CFLAGS=$(WARNINGS_ARE_ERRORS) $(GENERATED_CFLAGS)
51
52 .c.obj::
53         $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
54
55 PLATFORM_SRC = capture-wpcap.c capture_wpcap_packet.c
56
57 WTAP_PLUGIN_SOURCES = \
58        epan/plugins.c \
59        epan/report_err.c \
60        epan/filesystem.c
61
62 include Makefile.common
63
64 wireshark_OBJECTS = $(wireshark_SOURCES:.c=.obj)
65 tshark_OBJECTS = $(tshark_SOURCES:.c=.obj)
66 rawshark_OBJECTS = $(rawshark_SOURCES:.c=.obj)
67 ###text2pcap_OBJECTS = $(text2pcap_SOURCES:.c=.obj)
68 ###mergecap_OBJECTS = $(mergecap_SOURCES:.c=.obj)
69 editcap_OBJECTS = $(editcap_SOURCES:.c=.obj)
70 capinfos_OBJECTS = $(capinfos_SOURCES:.c=.obj)
71 dftest_OBJECTS = $(dftest_SOURCES:.c=.obj)
72 dumpcap_OBJECTS = $(dumpcap_SOURCES:.c=.obj)
73 randpkt_OBJECTS = $(randpkt_SOURCES:.c=.obj)
74
75 wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
76         wsock32.lib user32.lib shell32.lib comctl32.lib \
77         $(GTHREAD_LIBS) \
78         $(HHC_LIBS) \
79         wsutil\libwsutil.lib \
80         $(GNUTLS_LIBS) \
81         $(PYTHON_LIBS) \
82 !IFDEF ENABLE_LIBWIRESHARK
83         epan\libwireshark.lib \
84 !ELSE
85         epan\dissectors\dissectors.lib \
86         epan\wireshark.lib \
87         epan\crypt\airpdcap.lib \
88         epan\dfilter\dfilter.lib \
89         epan\ftypes\ftypes.lib \
90         $(C_ARES_LIBS) \
91         $(ADNS_LIBS) \
92         $(ZLIB_LIBS)
93 !ENDIF
94
95 tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
96         wsock32.lib user32.lib \
97         $(GLIB_LIBS) \
98         $(GTHREAD_LIBS) \
99         wsutil\libwsutil.lib \
100         $(GNUTLS_LIBS) \
101         $(PYTHON_LIBS) \
102 !IFDEF ENABLE_LIBWIRESHARK
103         epan\libwireshark.lib \
104 !ELSE
105         epan\dissectors\dissectors.lib \
106         epan\wireshark.lib \
107         epan\crypt\airpdcap.lib \
108         epan\dfilter\dfilter.lib \
109         epan\ftypes\ftypes.lib \
110         $(C_ARES_LIBS) \
111         $(ADNS_LIBS) \
112         $(ZLIB_LIBS)
113 !ENDIF
114
115 rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
116         wsock32.lib user32.lib \
117         $(GLIB_LIBS) \
118         wsutil\libwsutil.lib \
119         $(GNUTLS_LIBS) \
120         $(PYTHON_LIBS) \
121 !IFDEF ENABLE_LIBWIRESHARK
122         epan\libwireshark.lib \
123 !ELSE
124         epan\dissectors\dissectors.lib \
125         epan\wireshark.lib \
126         epan\crypt\airpdcap.lib \
127         epan\dfilter\dfilter.lib \
128         epan\ftypes\ftypes.lib \
129         $(C_ARES_LIBS) \
130         $(ADNS_LIBS) \
131         $(ZLIB_LIBS)
132 !ENDIF
133
134 capinfos_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
135         wsock32.lib user32.lib shell32.lib \
136         wsutil\libwsutil.lib \
137         $(GLIB_LIBS) \
138         $(GCRYPT_LIBS)
139
140 editcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
141         wsock32.lib user32.lib shell32.lib \
142         wsutil\libwsutil.lib \
143         $(GLIB_LIBS)
144
145 mergecap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
146         wsock32.lib user32.lib \
147         wsutil\libwsutil.lib \
148         $(GLIB_LIBS)
149
150 text2pcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
151         wsock32.lib user32.lib \
152         wsutil\libwsutil.lib \
153         $(GLIB_LIBS)
154
155 dumpcap_LIBS= \
156         wsock32.lib user32.lib \
157         wsutil\libwsutil.lib \
158         $(GLIB_LIBS) \
159         $(GTHREAD_LIBS)
160
161 dftest_LIBS=  wiretap\wiretap-$(WTAP_VERSION).lib \
162         wsock32.lib user32.lib \
163         $(GLIB_LIBS) \
164         wsutil\libwsutil.lib \
165         $(GNUTLS_LIBS) \
166 !IFDEF ENABLE_LIBWIRESHARK
167         epan\libwireshark.lib \
168 !ELSE
169         epan\dissectors\dissectors.lib \
170         epan\wireshark.lib \
171         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
172         $(C_ARES_LIBS) \
173         $(ADNS_LIBS) \
174         $(ZLIB_LIBS) \
175         $(SMI_LIBS)
176 !ENDIF
177
178 randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
179         user32.lib \
180         wsutil\libwsutil.lib \
181         $(GLIB_LIBS)
182
183 EXECUTABLES=wireshark.exe tshark.exe rawshark.exe \
184         capinfos.exe editcap.exe mergecap.exe text2pcap.exe randpkt.exe dumpcap.exe
185
186 RESOURCES=image\wireshark.res image\libwireshark.res image\tshark.res \
187         image\capinfos.res image\editcap.res image\mergecap.res \
188         image\text2pcap.res image\wiretap.res image\dumpcap.res \
189         image\rawshark.res image\libwsutil.res
190
191
192 all: $(LIBS_CHECK) config.h ui\qt\config.pri tools image codecs $(C_ARES_DLL) $(ADNS_DLL) $(ZLIB_DLL) wsutil wiretap epan $(EXECUTABLES) wireshark.bsc $(RESOURCES) doc help install-all
193
194 !IFDEF MAKENSIS
195 packaging: all
196         cd packaging
197         cd nsis
198         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
199         cd ..
200         cd ..
201 !ELSE
202 packaging: _FORCE_
203         @echo \? NSIS not available (MAKENSIS not defined in config.nmake)
204         @echo.
205         @exit 1
206 !ENDIF
207
208 packaging_u3: all
209         cd packaging
210         cd u3
211         cd win32
212         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
213         cd ..
214         cd ..
215         cd ..
216
217 packaging_papps: all
218         cd packaging
219         cd portableapps
220         cd win32
221         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
222         cd ..
223         cd ..
224         cd ..
225
226 # use (info-)zip from cygwin to pack things
227 packaging_zip: all
228 !IFDEF MSVCR_DLL
229         xcopy "$(MSVCR_DLL)" $(INSTALL_DIR)
230 !ENDIF
231 !IFDEF VCREDIST_EXE
232         @echo Including vcredist_$(TARGET_MACHINE).exe -- your recipient may need to run it!
233         xcopy "$(VCREDIST_EXE)" $(INSTALL_DIR)
234 !ENDIF
235         rm -f wireshark.zip
236         zip -r -9 wireshark.zip $(INSTALL_DIR)/
237
238 !IFDEF WIRESHARK_GENERATE_BSC_FILE
239 # FIXME: Add epan\wspython\*.sbr when we support Python embedding
240 # Note: Certain .sbr files which cause bscmake warning "too many references... ignoring ..."
241 wireshark.bsc: *.sbr codecs\*.sbr epan\*.sbr epan\crypt\*.sbr epan\dfilter\*.sbr \
242                epan\dissectors\*.sbr epan\ftypes\*.sbr epan\wslua\*.sbr ui\gtk\*.sbr \
243                plugins\asn1\*.sbr plugins\docsis\*.sbr plugins\ethercat\*.sbr \
244                plugins\giop\*.sbr plugins\gryphon\*.sbr plugins\irda\*.sbr plugins\m2m\*.sbr \
245                plugins\mate\*.sbr plugins\opcua\*.sbr plugins\profinet\*.sbr plugins\stats_tree\*.sbr \
246                plugins\unistim\*.sbr plugins\wimax\*.sbr plugins\wimaxasncp\*.sbr \
247                wiretap\*.sbr wsutil\*.sbr
248         $(BSCMAKE) @<<
249                 /o $@ $?
250 <<
251 !ELSE
252 wireshark.bsc:
253 !ENDIF
254
255 pdb_zip: all
256         cd $(INSTALL_DIR)
257         rm -f ../wireshark-pdb-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).zip
258         zip -9 ../wireshark-pdb-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).zip *.pdb *.lib
259         cd ..
260
261 $(RESOURCES): image
262
263 wiretap\wiretap-$(WTAP_VERSION).lib: image $(ZLIB_DLL) wiretap
264
265 wireshark.exe   : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) codecs epan gtk win32 image\wireshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib ui\gtk\libui.lib ui\win32\libui_win32.lib plugins
266         @echo Linking $@
267         $(LINK) @<<
268                 /OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) $(GTK_LIBS) codecs\codecs.lib ui\gtk\libui.lib ui\win32\libui_win32.lib $(wireshark_OBJECTS) image\wireshark.res
269 <<
270 !IFDEF MANIFEST_INFO_REQUIRED
271         mt.exe -nologo -manifest "wireshark.exe.manifest" -outputresource:wireshark.exe;1
272 !ENDIF
273
274 tshark.exe      : $(LIBS_CHECK) config.h $(tshark_OBJECTS) epan image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
275         @echo Linking $@
276         $(LINK) @<<
277                 /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(tshark_LIBS) $(tshark_OBJECTS) image\tshark.res
278 <<
279 !IFDEF MANIFEST_INFO_REQUIRED
280         mt.exe -nologo -manifest "tshark.exe.manifest" -outputresource:tshark.exe;1
281 !ENDIF
282
283 rawshark.exe    : $(LIBS_CHECK) config.h $(rawshark_OBJECTS) epan image\rawshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
284         @echo Linking $@
285         $(LINK) @<<
286                 /OUT:rawshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(rawshark_LIBS) $(rawshark_OBJECTS) image\rawshark.res
287 <<
288 !IFDEF MANIFEST_INFO_REQUIRED
289         mt.exe -nologo -manifest "rawshark.exe.manifest" -outputresource:rawshark.exe;1
290 !ENDIF
291
292 # XXX: This makefile does not properly handle doing a 'nmake ... capinfos.exe' directly since some of the .objs
293 #      (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all').
294 # Linking with setargv.obj enables "wildcard expansion" of command-line arguments
295 capinfos.exe    : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res
296         @echo Linking $@
297         $(LINK) @<<
298                 /OUT:capinfos.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(capinfos_OBJECTS) $(capinfos_LIBS) setargv.obj image\capinfos.res
299 <<
300 !IFDEF MANIFEST_INFO_REQUIRED
301         mt.exe -nologo -manifest "capinfos.exe.manifest" -outputresource:capinfos.exe;1
302 !ENDIF
303
304 # XXX: This makefile does not properly handle doing a 'nmake ... editcap.exe' directly since some of the .objs
305 #      (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all').
306 editcap.exe     : $(LIBS_CHECK) config.h $(editcap_OBJECTS) wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res
307         @echo Linking $@
308         $(LINK) @<<
309                 /OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(editcap_OBJECTS) $(editcap_LIBS) image\editcap.res
310 <<
311 !IFDEF MANIFEST_INFO_REQUIRED
312         mt.exe -nologo -manifest "editcap.exe.manifest" -outputresource:editcap.exe;1
313 !ENDIF
314
315 # Linking with setargv.obj enables "wildcard expansion" of command-line arguments
316 mergecap.exe    : $(LIBS_CHECK)  config.h mergecap.obj merge.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
317         @echo Linking $@
318         $(LINK) @<<
319                 /OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj $(mergecap_LIBS) setargv.obj image\mergecap.res
320 <<
321 !IFDEF MANIFEST_INFO_REQUIRED
322         mt.exe -nologo -manifest "mergecap.exe.manifest" -outputresource:mergecap.exe;1
323 !ENDIF
324
325 text2pcap.exe   : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\text2pcap.res
326         @echo Linking $@
327         $(LINK) @<<
328                 /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj $(text2pcap_LIBS) image\text2pcap.res
329 <<
330 !IFDEF MANIFEST_INFO_REQUIRED
331         mt.exe -nologo -manifest "text2pcap.exe.manifest" -outputresource:text2pcap.exe;1
332 !ENDIF
333
334 dftest.exe      : $(dftest_OBJECTS) epan
335         @echo Linking $@
336         $(LINK) @<<
337                 /OUT:dftest.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dftest_LIBS) $(dftest_OBJECTS)
338 <<
339 !IFDEF MANIFEST_INFO_REQUIRED
340         mt.exe -nologo -manifest "dftest.exe.manifest" -outputresource:dftest.exe;1
341 !ENDIF
342
343 randpkt.exe     : $(randpkt_OBJECTS)
344         @echo Linking $@
345         $(LINK) @<<
346                 /OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS)
347 <<
348 !IFDEF MANIFEST_INFO_REQUIRED
349         mt.exe -nologo -manifest "randpkt.exe.manifest" -outputresource:randpkt.exe;1
350 !ENDIF
351
352 dumpcap.exe     : $(LIBS_CHECK) config.h $(dumpcap_OBJECTS) wsutil\libwsutil.lib image\dumpcap.res
353         @echo Linking $@
354         $(LINK) @<<
355                 /OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dumpcap_LIBS) $(dumpcap_OBJECTS) image\dumpcap.res
356 <<
357 !IFDEF MANIFEST_INFO_REQUIRED
358         mt.exe -nologo -manifest "dumpcap.exe.manifest" -outputresource:dumpcap.exe;1
359 !ENDIF
360
361
362 config.h        : config.h.win32 config.nmake
363         sed -e s/@VERSION@/$(VERSION)/ \
364             -e "s/@HAVE_C_ARES@/$(C_ARES_CONFIG)/" \
365             -e "s/@HAVE_GNU_ADNS@/$(ADNS_CONFIG)/" \
366             -e "s/@HAVE_KFW@/$(KFW_CONFIG)/" \
367             -e "s/@HAVE_NETTLE@/$(NETTLE_CONFIG)/" \
368             -e "s/@HAVE_LIBZ@/$(ZLIB_CONFIG)/" \
369             -e "s/@HAVE_LIBPCAP@/$(WINPCAP_CONFIG)/" \
370             -e "s/@HAVE_PCAP_FINDALLDEVS@/$(PCAP_FINDALLDEVS_CONFIG)/" \
371             -e "s/@HAVE_PCAP_DATALINK_NAME_TO_VAL@/$(PCAP_DATALINK_NAME_TO_VAL_CONFIG)/" \
372             -e "s/@HAVE_PCAP_DATALINK_VAL_TO_NAME@/$(PCAP_DATALINK_VAL_TO_NAME_CONFIG)/" \
373             -e "s/@HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION@/$(PCAP_DATALINK_VAL_TO_DESCRIPTION_CONFIG)/" \
374             -e "s/@HAVE_PCAP_BREAKLOOP@/$(PCAP_BREAKLOOP_CONFIG)/" \
375             -e "s/@HAVE_REMOTE@/$(PCAP_HAVE_REMOTE_CONFIG)/" \
376             -e "s/@HAVE_PCAP_REMOTE@/$(PCAP_REMOTE_CONFIG)/" \
377             -e "s/@HAVE_PCAP_OPEN@/$(PCAP_OPEN_CONFIG)/" \
378             -e "s/@HAVE_PCAP_OPEN_DEAD@/$(PCAP_OPEN_DEAD_CONFIG)/" \
379             -e "s/@HAVE_PCAP_LIST_DATALINKS@/$(PCAP_LIST_DATALINKS_CONFIG)/" \
380             -e "s/@HAVE_PCAP_FREE_DATALINKS@/$(PCAP_FREE_DATALINKS_CONFIG)/" \
381             -e "s/@HAVE_PCAP_SET_DATALINK@/$(PCAP_SET_DATALINK_CONFIG)/" \
382             -e "s/@HAVE_PCAP_SETSAMPLING@/$(PCAP_SETSAMPLING_CONFIG)/" \
383             -e "s/@HAVE_BPF_IMAGE@/$(BPF_IMAGE_CONFIG)/" \
384             -e "s/@HAVE_LIBWIRESHARKDLL@/$(LIBWIRESHARK_CONFIG)/" \
385             -e "s/@HAVE_LIBGNUTLS@/$(GNUTLS_CONFIG)/" \
386             -e "s/@HAVE_LIBGCRYPT@/$(LIBGCRYPT_CONFIG)/" \
387             -e "s/@HAVE_LUA@/$(LUA_CONFIG)/" \
388             -e "s/@HAVE_LUA_5_1@/$(LUA_VERSION)/" \
389             -e "s/@HAVE_PYTHON@/$(PYTHON_CONFIG)/" \
390             -e "s/@HAVE_AIRPCAP@/$(AIRPCAP_CONFIG)/" \
391             -e "s/@HAVE_AIRPDCAP@/$(AIRPDCAP_CONFIG)/" \
392             -e "s/@HAVE_LIBPORTAUDIO@/$(PORTAUDIO_CONFIG)/" \
393             -e "s/@PORTAUDIO_API_1@/$(PORTAUDIO_API_CONFIG)/" \
394             -e "s/@HAVE_SMI@/$(SMI_CONFIG)/" \
395             -e "s/@HAVE_GEOIP@/$(GEOIP_CONFIG)/" \
396             -e "s/@HAVE_GEOIP_V6@/$(GEOIP_V6_CONFIG)/" \
397             -e "s/@INET6@/$(INET6_CONFIG)/" \
398             -e "s/@HAVE_NTDDNDIS_H@/$(NTDDNDIS_CONFIG)/" \
399             -e "s/@PCAP_NG_DEFAULT@/$(PCAP_NG_DEFAULT)/" \
400             -e "s/@WANT_PACKET_EDITOR@/$(WANT_PACKET_EDITOR)/" \
401             < config.h.win32 > $@
402
403 ui\qt\config.pri: config.nmake Makefile.nmake
404         @echo Creating <<ui\qt\config.pri
405 # Automatically generated from Makefile.nmake. Edit there, not here.
406 VERSION = $(VERSION)
407 !IFDEF MANIFEST_INFO_REQUIRED
408 CONFIG += wireshark_manifest_info_required
409 !ENDIF
410 WIRESHARK_LIB_DIR = $(WIRESHARK_LIB_DIR:\=/)
411 GLIB_DIR = $(GTK_DIR:\=/)
412 C_ARES_DIR = $(C_ARES_DIR:\=/)
413 ZLIB_DIR = $(ZLIB_DIR:\=/)
414 GNUTLS_DIR = $(GNUTLS_DIR:\=/)
415 SMI_DIR = $(SMI_DIR:\=/)
416 KFW_DIR = $(KFW_DIR:\=/)
417 LUA_DIR = $(LUA_DIR:\=/)
418 PORTAUDIO_DIR = $(PORTAUDIO_DIR:\=/)
419
420 MSVC_VARIANT = $(MSVC_VARIANT)
421
422 QMAKE_CFLAGS         *= $(STANDARD_CFLAGS) $(PORTAUDIO_CFLAGS:\=/)
423 QMAKE_CXXFLAGS       *= $(STANDARD_CFLAGS) $(PORTAUDIO_CFLAGS:\=/)
424 QMAKE_LFLAGS         *= /LARGEADDRESSAWARE $(LDFLAGS)
425
426 DEFINES += _NEED_VAR_IMPORT_
427
428 <<KEEP
429
430 ps.c: tools\rdps.py print.ps
431         $(PYTHON) tools\rdps.py print.ps ps.c
432 #
433 # Build the version string
434 #
435 !IF EXIST(".svn/wc.db")
436 SVNENTRIES = .svn/wc.db
437 !ELSE IF EXIST(".svn/entries")
438 SVNENTRIES = .svn/entries
439 !ELSE
440 SVNENTRIES =
441 !ENDIF
442 svnversion.h: $(SVNENTRIES)
443         rm -f svnversion.h
444         $(PERL) make-version.pl
445
446
447 #
448 # Build "tshark-tap-register.c", which contains a function
449 # "register_all_tap_listeners()"
450 # that calls the register routines for all TShark tap listeners.
451 #
452 # We do this by grepping through sources.
453 #
454 # Formatting conventions:  The name of the tap_listener_register_*
455 # routines must start in column zero, or must be preceded only by
456 # "void " starting in column zero, and must not be inside #if.
457 #
458 # The first argument is the name of the file to write.
459 # The second argument is the directory in which the source files live.
460 # All subsequent arguments are the files to scan.
461 #
462 tshark-tap-register.c: $(TSHARK_TAP_SRC) tools\make-tapreg-dotc
463         @echo Making tshark-tap-register.c
464         @$(SH) tools/make-tapreg-dotc tshark-tap-register.c . $(TSHARK_TAP_SRC)
465
466 text2pcap-scanner.c : text2pcap-scanner.l
467         $(LEX) -otext2pcap-scanner.c text2pcap-scanner.l
468
469 text2pcap-scanner.obj : text2pcap-scanner.c
470         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
471
472 #
473 # The following targets will rebuild their respective objs
474 # if and when svnversion.h should change.
475 #
476 text2pcap.obj mergecap.obj capinfos.obj editcap.obj version_info.obj: svnversion.h
477
478
479 clean-local:
480         rm -f $(wireshark_OBJECTS) $(tshark_OBJECTS) $(dumpcap_OBJECTS) $(rawshark_OBJECTS) \
481                 $(EXECUTABLES) *.pdb *.sbr *.exe.manifest \
482                 capinfos.obj editcap.obj mergecap.obj text2pcap.obj \
483                 nio-ie5.obj update.obj \
484                 text2pcap-scanner.obj text2pcap-scanner.c rdps.obj \
485                 rdps.pdb rdps.exe rdps.ilk config.h ps.c $(LIBS_CHECK) \
486                 dftest.obj dftest.exe randpkt.obj randpkt.ext \
487                 doxygen.cfg \
488                 $(RESOURCES) libwireshark.dll wiretap-$(WTAP_VERSION).dll \
489                 libwsutil.dll \
490                 wireshark.bsc
491         rm -rf $(INSTALL_DIR)
492
493 clean: clean-local
494         cd asn1
495         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
496         cd ../wiretap
497         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
498         cd ../wsutil
499         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
500         cd ../codecs
501         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
502         cd ../ui/gtk
503         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
504         cd ../win32
505         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
506         cd ../../epan
507         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
508         cd ../plugins
509         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
510         cd ../tools
511         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
512         cd ../image
513         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
514         cd ../doc
515         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
516         cd ../docbook
517         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
518         cd ../help
519         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
520         cd ../packaging/nsis
521         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
522         cd ../u3/win32
523         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
524         cd ../../portableapps/win32
525         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
526         cd ../../..
527
528 # "distclean" removes all files not part of the distribution.
529 # It does not remove generated files that are part of the distribution.
530 distclean-local: clean-local
531 !IFDEF ADNS_DIR
532         rm -f $(ADNS_DLL) $(ADNS_LIBS)
533 !ENDIF
534 !IFDEF ZLIB_DIR
535         rm -f $(ZLIB_DLL) $(ZLIB_DIR)\zlib1.dll.manifest \
536                 $(ZLIB_DIR)\include\zlib.h $(ZLIB_DIR)\include\zconf.h \
537                 $(ZLIB_DIR)\lib\zdll.lib
538 !ENDIF
539         rm -f config.h $(BUILT_SOURCES) wireshark-pdb*.zip
540
541 distclean: distclean-local
542         cd wiretap
543         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
544         cd ../wsutil
545         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
546         cd ../codecs
547         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
548         cd ../ui/gtk
549         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
550         cd ../win32
551         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
552         cd ../../epan
553         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
554         cd ../plugins
555         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
556         cd ../tools
557         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
558         cd ../image
559         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
560         cd ../doc
561         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
562         cd ../docbook
563         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
564         cd ../help
565         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
566         cd ../packaging/nsis
567         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
568         cd ../u3/win32
569         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
570         cd ../../portableapps/win32
571         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
572         cd ../../..
573
574 # Make "maintainer-clean" only if you would like to remove ALL generated
575 # files.
576 # Be sure to have python and perl installed to regenerate them.
577 maintainer-clean-local: distclean-local
578         rm -f $(GENERATED_FILES)
579
580 maintainer-clean: maintainer-clean-local
581         cd wiretap
582         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
583         cd ../wsutil
584         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
585         cd ../codecs
586         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
587         cd ../ui/gtk
588         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
589         cd ../win32
590         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
591         cd ../../epan
592         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
593         cd ../plugins
594         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
595         cd ../tools
596         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
597         cd ../image
598         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
599         cd ../doc
600         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
601         cd ../docbook
602         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
603         cd ../help
604         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
605         cd ../packaging/nsis
606         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
607         cd ../u3/win32
608         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
609         cd ../../portableapps/win32
610         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
611         cd ../../..
612
613 tools::
614         cd tools
615         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
616         cd ..
617
618 image::
619         cd image
620         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
621         cd ..
622
623 !IFDEF ADNS_DIR
624 # MSVC variants supported by Wireshark have to avoid indirectly using msvcrt.dll,
625 # therefore compile the adns dll from source ADNS_DIR package.
626 # To avoid path problems, copy the adns sources to a temp dir,
627 # compile and copy the resulting files back to (source) ADNS_DIR
628 #
629 # Unfortunately:
630 # - we need to "patch" adns_dll.rep and adns_dll.rc (at least for MSVC2005EE)
631 #
632 $(ADNS_DLL):
633         xcopy $(ADNS_DIR) adns.tmp /D /I /E /Y
634         copy adns_dll.dep adns.tmp\adns_win32\adns_dll
635         copy adns_dll.rc adns.tmp\adns_win32\adns_dll
636         cd adns.tmp\adns_win32\adns_dll
637         set CFG=adns_dll - Win32 Release
638         $(MAKE) /$(MAKEFLAGS) -f adns_dll.mak LOC="$(LOCAL_CFLAGS)"
639         cd ..\lib
640 !IFDEF MANIFEST_INFO_REQUIRED
641         mt.exe -nologo -manifest "adns_dll.dll.manifest" -outputresource:adns_dll.dll;2
642 !ENDIF
643         if not exist "$(WIRESHARK_LIB_DIR)\$(MSVC_VARIANT)\adns" mkdir "$(WIRESHARK_LIB_DIR)\$(MSVC_VARIANT)\adns"
644         copy adns_dll.dll $(ADNS_DLL)
645         copy adns_dll.lib $(ADNS_LIBS)
646         cd ..\..\..
647         rm -r -f adns.tmp
648 !ENDIF
649
650 !IFDEF ZLIB_DIR
651 # MSVC variants supported by Wireshark have to avoid indirectly using msvcrt.dll,
652 # therefore compile the zlib dll from source ZLIB_DIR package.
653 # To avoid path problems, copy the zlib sources to a temp dir,
654 # compile and copy the resulting files back to (source) ZLIB_DIR
655 $(ZLIB_DLL):
656         xcopy $(ZLIB_DIR) zlib.tmp /D /I /E /Y
657         cd zlib.tmp
658 !if "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
659         $(MAKE) /$(MAKEFLAGS) -f win32/Makefile.msc zlib1.dll LOC="-DASMV -DASMINF" OBJA="inffas32.obj match686.obj"
660 !else
661         $(MAKE) /$(MAKEFLAGS) -f win32/Makefile.msc zlib1.dll AS=ml64 LOC="-DASMV -DASMINF" OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
662 !endif
663         if not exist $(ZLIB_DIR) mkdir $(ZLIB_DIR)
664         if not exist $(ZLIB_DIR)\lib mkdir $(ZLIB_DIR)\lib
665         if not exist $(ZLIB_DIR)\include mkdir $(ZLIB_DIR)\include
666 !IFDEF MANIFEST_INFO_REQUIRED
667         mt.exe -nologo -manifest "zlib1.dll.manifest" -outputresource:zlib1.dll;2
668 !ENDIF
669         copy zlib1.dll $(ZLIB_DIR)
670         copy zdll.lib $(ZLIB_DIR)\lib
671         copy zconf.h $(ZLIB_DIR)\include
672         copy zlib.h $(ZLIB_DIR)\include
673         cd ..
674         rm -r -f zlib.tmp
675 !ENDIF
676
677 wsutil::
678         cd wsutil
679         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
680         cd ..
681
682 wiretap::
683         cd wiretap
684         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
685         cd ..
686
687 codecs::
688         cd codecs
689         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
690         cd ..
691
692 gtk:: help config.h svnversion.h doxygen
693         cd ui/gtk
694         $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libui.lib
695         cd ../..
696
697 win32::
698         cd ui/win32
699         $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libui_win32.lib
700         cd ../..
701
702 epan:: $(RESOURCES) $(ZLIB_DLL) wiretap\wiretap-$(WTAP_VERSION).lib $(BUILT_SOURCES) doxygen
703         cd epan
704         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
705         cd ..
706
707 plugins::
708         cd plugins
709         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
710         cd ..
711
712 doc::
713         cd doc
714         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
715         cd ..
716
717 docbook::
718         cd docbook
719         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
720         cd ..
721
722 help::
723         cd help
724         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
725         cd ..
726
727 doxygen.cfg: config.nmake doxygen.cfg.in
728         sed -e s/@VERSION@/$(VERSION)/ \
729             < doxygen.cfg.in > $@
730
731 doxygen-run:
732 !IFDEF DOXYGEN
733         $(DOXYGEN) doxygen.cfg
734 !ENDIF
735
736 doxygen: doxygen.cfg doxygen-run
737
738 services: tools\make-services.pl
739         $(PERL) tools/make-services.pl
740
741 ################################################################################
742 # Prepare build environment by downloading and installing required libraries
743 ################################################################################
744
745 # The required tools to build Wireshark.
746 #
747 # The 'find' tool is available both in \WINNT\System32 and in cygwin's /usr/bin.
748 # We only need the cygwin version (for some shell scripts).
749 # In the PATH, System32 is before cygwin's dir, so explicitly check for /usr/bin/find.
750 REQUIRED_TOOLS=\
751         $(CC) \
752         $(LINK) \
753         nmake \
754 !IFDEF MANIFEST_INFO_REQUIRED
755         --windowsonly mt        \
756 !ENDIF
757         $(SH_PROG)      \
758         $(YACC) \
759         $(LEX)  \
760         env     \
761         grep    \
762         --cygwinonly /usr/bin/find      \
763         peflags \
764         $(PERL) \
765         $(PYTHON)       \
766         sed     \
767         unzip   \
768         wget
769
770 verify_tools:
771 # As win-setup.sh assumes the dir exists create it if it doesn't
772         @if not exist "$(WIRESHARK_LIB_DIR)" md "$(WIRESHARK_LIB_DIR)"
773         @$(SH) $(WIN_SETUP) --appverify $(REQUIRED_TOOLS)
774
775 # Targets and etc used to verify or download libraries
776
777 !IFNDEF WIN_SETUP_OPT
778 WIN_SETUP_OPT=--download
779 !ENDIF
780
781 # Verify that the required library 'package' (zip) files have been downloaded.
782 # (It seems reasonable to assume that if the files have been downloaded
783 #  then they have been installed).
784 check_libs:
785         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake WIN_SETUP_OPT=--libverify process_libs
786
787 # Verify library packages:
788 #  If $(CHECK_TAG) is non-null then checktag failed; Exit with an error message. (See beginning of this Makefile).
789 #  Otherwise do detailed library package files verification only if Makefile.nmake or config.make have been updated
790 #  (or dummy file doesn't exist because of 'make clean' or whatever).
791 #  Note that the creation/modification time of a file after an svn update of that file
792 #   is the time of the update (not the time of the file in the repository).
793 # touch is only called if libverify succeeds.
794 $(LIBS_CHECK):  $(CHECK_TAG) config.nmake Makefile.nmake
795         @echo  Verifying library package files ...
796         @$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake WIN_SETUP_OPT=--libverify process_libs
797         @touch $@
798
799 # Target for "checktag failed" (libraries not up to date).
800 # Defined only if "checktag" failed (see beginning of this Makefile).
801 !IF "$(CHECK_TAG)" != ""
802 $(CHECK_TAG): _FORCE_
803         @echo \? Wireshark Libraries not up-to-date \?
804         @echo \? Do you need to run "nmake -f Makefile.nmake setup" \?
805         @echo.
806         @exit 1
807
808 !ENDIF
809
810 # Download (if needed) and install all the required libraries into WIRESHARK_LIB_DIR.
811 # A clean_setup is done first to ensure that the target dirs don't
812 # contain old files remaining from a previous setup run.
813 setup: verify_tools clean_setup process_libs
814
815
816 # The process_libs target when invoked causes either a --libverify or a --download for all the required libraries.
817 # (The choice is determined by the value of the macro WIN_SETUP_OPT).
818 process_libs:
819         @if not exist "$(WIRESHARK_LIB_DIR)" md "$(WIRESHARK_LIB_DIR)"
820 !IFDEF GTK_DIR
821         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
822                 gtk2 gtk+-bundle_$(GTK_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
823 !ENDIF
824 !IFDEF KFW_DIR
825         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
826                 . kfw-3-2-2-i386-ws-vc6.zip
827 #       @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
828 #               . kfw-3-2-2.zip
829 !ENDIF
830 !IFDEF PCAP_DIR
831         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
832                 . WpdPack_$(PCAP_VERSION).zip
833 !ENDIF
834 !IFDEF AIRPCAP_DIR
835         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
836                 AirPcap_Devpack_4_1_0_1622 AirPcap_Devpack_4_1_0_1622.zip
837 !ENDIF
838 !IFDEF C_ARES_DIR
839         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
840                 . c-ares-$(C_ARES_PKG)-$(WIRESHARK_TARGET_PLATFORM)ws.zip
841 !ENDIF
842 !IFDEF ADNS_DIR
843         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
844                 . adns-1.0-win32-05ws.zip
845 !ENDIF
846 !IFDEF ZLIB_DIR
847         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
848 !if "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
849                 zlib125 zlib-1.2.5.zip
850 !else
851                 zlib125 zlib125ws.zip
852 !endif
853 !ENDIF
854 !IFDEF LUA_DIR
855         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
856                 lua5.1.4 lua$(LUA_DIST)_lib.zip
857 !ENDIF
858
859 !IFDEF GNUTLS_PKG
860         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
861                 . gnutls-$(GNUTLS_PKG)-$(WIRESHARK_TARGET_PLATFORM)ws.zip
862 !ENDIF
863 !IFDEF PORTAUDIO_DIR
864         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
865                 . portaudio_v19_2.zip
866 !ENDIF
867 !IFDEF SMI_DIR
868         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
869                 . libsmi-$(SMI_PKG)-$(WIRESHARK_TARGET_PLATFORM)ws.zip
870 !ENDIF
871 !IFDEF GEOIP_DIR
872         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
873                 . GeoIP-1.4.6-$(WIRESHARK_TARGET_PLATFORM)ws.zip
874 !ENDIF
875 !IFDEF HHC_DIR
876         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
877                 user-guide user-guide-37310.zip
878 !ENDIF
879 !IFDEF UPX
880         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
881                 . upx303w.zip
882 !ENDIF
883 !IFDEF NASM
884         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIB_DIR)" \
885                 . nasm-2.09.08-win32.zip
886 !ENDIF
887 !IF "$(WIN_SETUP_OPT)" == "--download"
888         @$(SH) $(WIN_SETUP) --settag "$(WIRESHARK_LIB_DIR)"
889 !ENDIF
890         @echo.
891         @echo Wireshark is ready to build.
892
893 # Cleanup files installed by the setup target. It will not remove the
894 # downloaded zip files.
895 # WHEN UPDATING LIBRARY VERSIONS, KEEP ALSO ONE FORMER VERSION SO
896 # UPDATING REMOVES THE FORMER USER DIRS
897 clean_setup:
898     cd "$(WIRESHARK_LIB_DIR)"
899     rm -r -f adns-1.0-win32-05ws
900     rm -r -f c-ares-1.5.3ws
901     rm -r -f c-ares-1.6.0ws
902     rm -r -f c-ares-1.7.0-win??ws
903     rm -r -f c-ares-1.7.1-win??ws
904     rm -r -f gettext-0.14.5
905     rm -r -f gettext-runtime-0.17
906     rm -r -f gettext-runtime-0.17-1
907     rm -r -f gettext-0.17-1            # win64
908     rm -r -f glib
909     rm -r -f gnutls-2.8.1-1
910     rm -r -f gnutls-2.8.5-*-win??ws
911     rm -r -f gnutls-2.10.3-*-win??ws
912     rm -r -f gtk2
913     rm -r -f gtk+
914     rm -r -f gtk-wimp
915     rm -r -f kfw-2.5
916     rm -r -f kfw-3.2.2-ws1
917     rm -r -f kfw-3.2.2-i386-ws-vc6
918     rm -r -f libiconv-1.9.1.bin.woe32
919     rm -r -f lua5.1
920     rm -r -f lua5.1.4
921     rm -r -f libsmi-0.4.5
922     rm -r -f libsmi-0.4.8
923     rm -r -f libsmi-win??-svn-40773
924     rm -r -f nasm-2.00
925     rm -r -f nasm-2.02
926     rm -r -f nasm-2.09.08
927     rm -r -f pcre-6.4
928     rm -r -f pcre-7.0
929     rm -r -f portaudio_v19
930     rm -r -f portaudio_v19_2
931     rm -r -f user-guide
932     rm -r -f WpdPack
933     rm -r -f AirPcap_Devpack_1_0_0_594
934     rm -r -f AirPcap_Devpack_4_0_0_1480
935     rm -r -f AirPcap_Devpack_4_1_0_1622
936     rm -r -f zlib123
937     rm -r -f zlib-1.2.5
938     rm -r -f zlib123-dll
939     rm -r -f upx301w
940     rm -r -f upx303w
941     rm -r -f GeoIP-1.4.5ws
942     rm -r -f GeoIP-1.4.6-win??ws
943     cd "$(MAKEDIR)"
944
945 ################################################################################
946 # Prepare the debug trees for running Wireshark/Tshark from there.
947 ################################################################################
948
949
950 # prepare debugging of Wireshark in INSTALL_DIR
951 debug-wireshark: wireshark.exe install-generated-files
952
953 # prepare debugging of tshark in INSTALL_DIR
954 debug-tshark: tshark.exe install-generated-files
955
956 # prepare debugging of rawshark in INSTALL_DIR
957 debug-rawshark: rawshark.exe install-generated-files
958
959 # prepare debugging of dumpcap in INSTALL_DIR
960 debug-dumpcap: dumpcap.exe install-generated-files
961
962
963 # install generated files (exe, "our" libs, ...)
964 install-generated-files:
965         set copycmd=/y
966         if not exist $(INSTALL_DIR) mkdir $(INSTALL_DIR)
967 !IF DEFINED (MSVCR_DLL) && "$(MSVC_VARIANT)" == "MSVC2008"
968         xcopy "$(MSVCR_DLL)" $(INSTALL_DIR)\*.* /d
969 !ENDIF
970 !IFDEF ENABLE_LIBWIRESHARK
971         xcopy epan\libwireshark.dll $(INSTALL_DIR) /d
972         if exist epan\libwireshark.lib xcopy .\epan\libwireshark.lib $(INSTALL_DIR) /d
973         if exist epan\libwireshark.pdb xcopy .\epan\libwireshark.pdb $(INSTALL_DIR) /d
974 !ENDIF
975         xcopy ".\wiretap\wiretap-$(WTAP_VERSION).dll" $(INSTALL_DIR) /d
976         if exist ".\wiretap\wiretap-$(WTAP_VERSION).lib" xcopy ".\wiretap\wiretap-$(WTAP_VERSION).lib" $(INSTALL_DIR) /d
977         if exist ".\wiretap\wiretap-$(WTAP_VERSION).pdb" xcopy ".\wiretap\wiretap-$(WTAP_VERSION).pdb" $(INSTALL_DIR) /d
978         xcopy ".\wsutil\libwsutil.dll" $(INSTALL_DIR) /d
979         if exist ".\wsutil\libwsutil.lib" xcopy ".\wsutil\libwsutil.lib" $(INSTALL_DIR) /d
980         if exist ".\wsutil\libwsutil.pdb" xcopy ".\wsutil\libwsutil.pdb" $(INSTALL_DIR) /d
981         if exist wireshark.exe copy wireshark.exe $(INSTALL_DIR)\wireshark.exe
982         if exist wireshark.pdb copy wireshark.pdb $(INSTALL_DIR)\wireshark.pdb
983         if exist wireshark.bsc copy wireshark.bsc $(INSTALL_DIR)\wireshark.bsc
984         if exist ".\docbook\user-guide.chm" xcopy ".\docbook\user-guide.chm" $(INSTALL_DIR) /d
985         if exist capinfos.exe xcopy capinfos.exe $(INSTALL_DIR) /d
986         if exist capinfos.pdb xcopy capinfos.pdb $(INSTALL_DIR) /d
987         if exist dumpcap.exe xcopy dumpcap.exe $(INSTALL_DIR) /d
988         if exist dumpcap.pdb xcopy dumpcap.pdb $(INSTALL_DIR) /d
989         if exist editcap.exe xcopy editcap.exe $(INSTALL_DIR) /d
990         if exist editcap.pdb xcopy editcap.pdb $(INSTALL_DIR) /d
991         if exist mergecap.exe xcopy mergecap.exe $(INSTALL_DIR) /d
992         if exist mergecap.pdb xcopy mergecap.pdb $(INSTALL_DIR) /d
993         if exist rawshark.exe xcopy rawshark.exe $(INSTALL_DIR) /d
994         if exist rawshark.pdb xcopy rawshark.pdb $(INSTALL_DIR) /d
995         if exist text2pcap.exe xcopy text2pcap.exe $(INSTALL_DIR) /d
996         if exist text2pcap.pdb xcopy text2pcap.pdb $(INSTALL_DIR) /d
997         if exist tshark.exe xcopy tshark.exe $(INSTALL_DIR) /d
998         if exist tshark.pdb xcopy tshark.pdb $(INSTALL_DIR) /d
999         xcopy "doc\AUTHORS-SHORT" $(INSTALL_DIR) /d
1000         xcopy ".\manuf" $(INSTALL_DIR) /d
1001         xcopy ".\services" $(INSTALL_DIR) /d
1002         xcopy ".\pdml2html.xsl" $(INSTALL_DIR) /d
1003         $(TEXTIFY) "./COPYING" $(INSTALL_DIR)
1004         $(TEXTIFY) "./NEWS" $(INSTALL_DIR)
1005         $(TEXTIFY) "./README" $(INSTALL_DIR)
1006         $(TEXTIFY) "./README.windows" $(INSTALL_DIR)
1007         xcopy ".\cfilters" $(INSTALL_DIR) /d
1008         xcopy ".\colorfilters" $(INSTALL_DIR) /d
1009         xcopy ".\dfilters" $(INSTALL_DIR) /d
1010         xcopy ".\smi_modules" $(INSTALL_DIR) /d
1011 !IFDEF LUA_DIR
1012         xcopy ".\epan\wslua\init.lua" $(INSTALL_DIR) /d
1013         xcopy ".\epan\wslua\console.lua" $(INSTALL_DIR) /d
1014 !ENDIF
1015 !IFDEF PYTHON_DIR
1016         if not exist $(INSTALL_DIR)\python mkdir $(INSTALL_DIR)\python
1017         xcopy ".\epan\wspython\register-dissector.py" $(INSTALL_DIR)\python /d
1018         xcopy ".\epan\wspython\wspy_dissector.py" $(INSTALL_DIR)\python /d
1019         xcopy ".\epan\wspython\wspy_libws.py" $(INSTALL_DIR)\python /d
1020 !ENDIF
1021         xcopy ipmap.html $(INSTALL_DIR) /d
1022         xcopy doc\*.html $(INSTALL_DIR) /d
1023         if not exist $(INSTALL_DIR)\help mkdir $(INSTALL_DIR)\help
1024         xcopy ".\help\*.*" $(INSTALL_DIR)\help /d
1025 # you can't reliably use xcopy to rename files "on the fly" (so copy first, then rename)
1026         xcopy ".\help\faq.txt" $(INSTALL_DIR) /d
1027         $(UNIX2DOS) $(INSTALL_DIR)/help/*.txt
1028         if not exist $(INSTALL_DIR)\dtds mkdir $(INSTALL_DIR)\dtds
1029         xcopy ".\dtds\*.*" $(INSTALL_DIR)\dtds /d
1030         if not exist $(INSTALL_DIR)\asn1 mkdir $(INSTALL_DIR)\asn1
1031         echo create empty asn1 default.tt file to prevent problems 2> $(INSTALL_DIR)\asn1\default.tt
1032         if not exist $(INSTALL_DIR)\radius mkdir $(INSTALL_DIR)\radius
1033         xcopy ".\radius\*.*" $(INSTALL_DIR)\radius /d
1034         if not exist $(INSTALL_DIR)\diameter mkdir $(INSTALL_DIR)\diameter
1035         xcopy ".\diameter\*.dtd" $(INSTALL_DIR)\diameter /d
1036         xcopy ".\diameter\*.xml" $(INSTALL_DIR)\diameter /d
1037         if not exist $(INSTALL_DIR)\tpncp mkdir $(INSTALL_DIR)\tpncp
1038         xcopy ".\tpncp\*.dat" $(INSTALL_DIR)\tpncp /d
1039         if not exist $(INSTALL_DIR)\wimaxasncp mkdir $(INSTALL_DIR)\wimaxasncp
1040         xcopy ".\wimaxasncp\*.*" $(INSTALL_DIR)\wimaxasncp /d
1041         if not exist $(INSTALL_DIR)\plugins mkdir $(INSTALL_DIR)\plugins
1042         if not exist $(INSTALL_DIR)\plugins\$(VERSION) mkdir $(INSTALL_DIR)\plugins\$(VERSION)
1043         cd plugins
1044         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake install-plugins
1045         cd ..
1046         if not exist $(INSTALL_DIR)\ui mkdir $(INSTALL_DIR)\ui
1047         xcopy "ui\gtk\ui\*.xml" $(INSTALL_DIR)\ui /d
1048
1049 # "install-all" will copy all files needed to run Wireshark/Tshark
1050 # to the INSTALL_DIR, so you can run/debug Wireshark/Tshark from there.
1051 install-all: install-generated-files
1052         set copycmd=/y
1053         if not exist $(INSTALL_DIR) mkdir $(INSTALL_DIR)
1054         xcopy $(GTK_DIR)\bin\libgdk-win32-2.0-0.dll $(INSTALL_DIR) /d
1055         xcopy $(GTK_DIR)\bin\libgdk_pixbuf-2.0-0.dll $(INSTALL_DIR) /d
1056         xcopy $(GTK_DIR)\bin\libgtk-win32-2.0-0.dll $(INSTALL_DIR) /d
1057         xcopy $(GTK_DIR)\bin\libatk-1.0-0.dll $(INSTALL_DIR) /d
1058         xcopy $(GTK_DIR)\bin\libpango-1.0-0.dll $(INSTALL_DIR) /d
1059         xcopy $(GTK_DIR)\bin\libpangowin32-1.0-0.dll $(INSTALL_DIR) /d
1060         if not exist $(INSTALL_DIR)\etc mkdir $(INSTALL_DIR)\etc
1061         if not exist $(INSTALL_DIR)\etc\gtk-2.0 mkdir $(INSTALL_DIR)\etc\gtk-2.0
1062         if not exist $(INSTALL_DIR)\etc\pango mkdir $(INSTALL_DIR)\etc\pango
1063         if not exist $(INSTALL_DIR)\lib mkdir $(INSTALL_DIR)\lib
1064         if not exist $(INSTALL_DIR)\lib\gtk-2.0 mkdir $(INSTALL_DIR)\lib\gtk-2.0
1065         if not exist $(INSTALL_DIR)\lib\gtk-2.0\modules mkdir $(INSTALL_DIR)\lib\gtk-2.0\modules
1066         if not exist $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR) mkdir $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)
1067         if not exist $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders mkdir $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders
1068         if not exist $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines mkdir $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines
1069         xcopy $(GTK_DIR)\etc\gtk-2.0\*.* $(INSTALL_DIR)\etc\gtk-2.0 /d
1070         if exist $(GTK_DIR)\etc\pango xcopy $(GTK_DIR)\etc\pango\pango.* $(INSTALL_DIR)\etc\pango /d
1071         if exist $(GTK_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders xcopy $(GTK_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders\libpixbufloader-*.dll $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders /d
1072         xcopy $(GTK_DIR)\lib\gtk-2.0\modules\libgail.dll $(INSTALL_DIR)\lib\gtk-2.0\modules /d
1073         xcopy $(GTK_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines\libpixmap.dll $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines /d
1074 !IFDEF NEED_LIBPNG_DLL
1075         xcopy $(GTK_DIR)\bin\$(PNG_DLL) $(INSTALL_DIR) /d
1076 !ENDIF
1077 !IFDEF NEED_LIBTIFF_DLL
1078         xcopy $(GTK_DIR)\bin\$(TIFF_DLL) $(INSTALL_DIR) /d
1079 !ENDIF
1080 !IFDEF NEED_LIBJPEG_DLL
1081         xcopy $(GTK_DIR)\bin\$(JPEG_DLL) $(INSTALL_DIR) /d
1082 !ENDIF
1083 !IFDEF NEED_CAIRO_DLL
1084         xcopy $(GTK_DIR)\bin\libcairo-2.dll $(INSTALL_DIR)  /d
1085         xcopy $(GTK_DIR)\bin\libpangocairo-1.0-0.dll $(INSTALL_DIR) /d
1086 !ENDIF
1087 !IFDEF NEED_FREETYPE_DLL
1088         xcopy $(GTK_DIR)\bin\libpangoft2-1.0-0.dll $(INSTALL_DIR) /d
1089         xcopy $(GTK_DIR)\bin\$(FREETYPE_DLL) $(INSTALL_DIR) /d
1090 !ENDIF
1091 !IFDEF NEED_FONTCONFIG_DLL
1092         xcopy $(GTK_DIR)\bin\$(FONTCONFIG_DLL) $(INSTALL_DIR) /d
1093 !ENDIF
1094 !IFDEF NEED_EXPAT_DLL
1095         xcopy $(GTK_DIR)\bin\$(EXPAT_DLL) $(INSTALL_DIR) /d
1096 !ENDIF
1097         if not exist $(INSTALL_DIR)\$(GTK_WIMP_DLLDST_DIR) mkdir $(INSTALL_DIR)\$(GTK_WIMP_DLLDST_DIR)
1098         xcopy "$(GTK_WIMP_DLLSRC_DIR)\libwimp.dll" $(INSTALL_DIR)\$(GTK_WIMP_DLLDST_DIR) /d
1099         if not exist $(INSTALL_DIR)\$(GTK_WIMP_RCDST_DIR) mkdir $(INSTALL_DIR)\$(GTK_WIMP_RCDST_DIR)
1100         xcopy "$(GTK_WIMP_RCSRC_DIR)\gtkrc" $(INSTALL_DIR)\$(GTK_WIMP_RCDST_DIR) /d
1101         xcopy $(GTK_DIR)\bin\libgio-2.0-0.dll $(INSTALL_DIR) /d
1102         xcopy $(GTK_DIR)\bin\libglib-2.0-0.dll $(INSTALL_DIR) /d
1103         xcopy $(GTK_DIR)\bin\libgmodule-2.0-0.dll $(INSTALL_DIR) /d
1104         xcopy $(GTK_DIR)\bin\libgobject-2.0-0.dll $(INSTALL_DIR) /d
1105         xcopy $(GTK_DIR)\bin\libgthread-2.0-0.dll $(INSTALL_DIR) /d
1106         xcopy $(GTK_DIR)\bin\$(INTL_DLL) $(INSTALL_DIR) /d
1107 !IFDEF ZLIB_DIR
1108         xcopy $(ZLIB_DLL) $(INSTALL_DIR) /d
1109 !ENDIF
1110 !IFDEF C_ARES_DIR
1111         xcopy $(C_ARES_DLL) $(INSTALL_DIR) /d
1112 !ENDIF
1113 !IFDEF ADNS_DIR
1114         xcopy $(ADNS_DLL) $(INSTALL_DIR) /d
1115 !ENDIF
1116 !IFDEF KFW_DIR
1117         xcopy $(KFW_PATH)\comerr32.dll $(INSTALL_DIR) /d
1118         xcopy $(KFW_PATH)\krb5_32.dll $(INSTALL_DIR) /d
1119         xcopy $(KFW_PATH)\k5sprt32.dll $(INSTALL_DIR) /d
1120 !ENDIF
1121 !IFDEF GNUTLS_DIR
1122         xcopy $(GNUTLS_DIR)\bin\libgcrypt-11.dll $(INSTALL_DIR) /d
1123         xcopy $(GNUTLS_DIR)\bin\libgnutls-26.dll $(INSTALL_DIR) /d
1124         xcopy $(GNUTLS_DIR)\bin\libgpg-error-0.dll $(INSTALL_DIR) /d
1125         xcopy $(GNUTLS_DIR)\bin\libtasn1-3.dll $(INSTALL_DIR) /d
1126 ! IF "$(INTL_DLL)" != "libintl-8.dll"
1127 # The gtk+ bundle doesn't provide libintl-8.dll (which is the case
1128 # with the 32-bit package); use the GNUTLS version.
1129         xcopy $(GNUTLS_DIR)\bin\libintl-8.dll $(INSTALL_DIR) /d
1130 ! ENDIF
1131 !ENDIF
1132 !IFDEF LUA_DIR
1133         xcopy "$(LUA_DIR)\lua5.1.dll" $(INSTALL_DIR) /d
1134 !ENDIF
1135 !IFDEF SMI_DIR
1136         if not exist $(INSTALL_DIR)\snmp mkdir $(INSTALL_DIR)\snmp
1137         if not exist $(INSTALL_DIR)\snmp\mibs mkdir $(INSTALL_DIR)\snmp\mibs
1138         xcopy "$(SMI_DIR)\bin\libsmi-2.dll" $(INSTALL_DIR) /d
1139         xcopy "$(SMI_DIR)\share\mibs\iana\*" $(INSTALL_DIR)\snmp\mibs /d
1140         xcopy "$(SMI_DIR)\share\mibs\ietf\*" $(INSTALL_DIR)\snmp\mibs /d
1141         xcopy "$(SMI_DIR)\share\mibs\irtf\*" $(INSTALL_DIR)\snmp\mibs /d
1142         xcopy "$(SMI_DIR)\share\mibs\tubs\*" $(INSTALL_DIR)\snmp\mibs /d
1143         xcopy "$(SMI_DIR)\share\pibs\*" $(INSTALL_DIR)\snmp\mibs /d
1144         xcopy "$(SMI_DIR)\share\yang\*.yang" $(INSTALL_DIR)\snmp\mibs /d
1145 !ENDIF
1146         cd $(INSTALL_DIR)
1147         peflags --dynamicbase=true --nxcompat=true *.dll
1148         peflags --dynamicbase=true --nxcompat=true lib/gtk-2.0/*/engines/*.dll
1149         peflags --dynamicbase=true --nxcompat=true lib/gtk-2.0/modules/*.dll
1150         cd ..
1151
1152 checkapi_local:
1153         $(PERL) tools/checkAPIs.pl \
1154         $(wireshark_SOURCES) \
1155         $(TSHARK_TAP_SRC) \
1156 #       $(EXTRA_wireshark_SOURCES)
1157
1158 checkapi: checkapi_local
1159         cd wiretap
1160         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1161         cd ../codecs
1162         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1163         cd ../ui/gtk
1164         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1165         cd ../win32
1166         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1167         cd ../../epan
1168 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1169         cd ../epan/crypt
1170 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1171         cd ../dfilter
1172         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1173         cd ../ftypes
1174 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1175         cd ../wslua
1176 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1177         cd ../dissectors
1178         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1179         cd ..
1180         cd ../plugins
1181         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1182         cd ../wsutil
1183         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1184
1185 ####
1186 _FORCE_:  ## Assumption: no file named _FORCE_ exists in the current directory