Check for the existence of a couple of directories and add variables for DLL
[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 LDFLAGS = /NOLOGO /INCREMENTAL:no $(LOCAL_LDFLAGS)
21
22 # We use GENERATED_CFLAGS to get around flex's non-LLP64-compliant output
23 GENERATED_CFLAGS=-DHAVE_CONFIG_H $(LOCAL_CFLAGS) $(GLIB_CFLAGS) /I. /Iwiretap \
24         $(ZLIB_CFLAGS) /I$(PCAP_DIR)\include \
25         $(AIRPCAP_CFLAGS) \
26         $(C_ARES_CFLAGS) $(ADNS_CFLAGS) $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) \
27         $(LUA_CFLAGS) $(SMI_CFLAGS) $(GEOIP_CFLAGS) \
28         -D_U_="" -D_NEED_VAR_IMPORT_
29 CFLAGS=-WX $(GENERATED_CFLAGS)
30
31 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
32
33 .c.obj::
34         $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
35
36 PLATFORM_SRC = capture-wpcap.c capture_wpcap_packet.c
37
38 WTAP_PLUGIN_SOURCES = \
39        epan/plugins.c \
40        epan/report_err.c \
41        epan/filesystem.c
42
43 include Makefile.common
44
45 wireshark_OBJECTS = $(wireshark_SOURCES:.c=.obj)
46 tshark_OBJECTS = $(tshark_SOURCES:.c=.obj)
47 rawshark_OBJECTS = $(rawshark_SOURCES:.c=.obj)
48 ###text2pcap_OBJECTS = $(text2pcap_SOURCES:.c=.obj)
49 ###mergecap_OBJECTS = $(mergecap_SOURCES:.c=.obj)
50 editcap_OBJECTS = $(editcap_SOURCES:.c=.obj)
51 capinfos_OBJECTS = $(capinfos_SOURCES:.c=.obj)
52 dftest_OBJECTS = $(dftest_SOURCES:.c=.obj)
53 dumpcap_OBJECTS = $(dumpcap_SOURCES:.c=.obj)
54 randpkt_OBJECTS = $(randpkt_SOURCES:.c=.obj)
55
56 EXTRA_OBJECTS = \
57         getopt.obj      \
58         inet_ntop.obj   \
59         inet_pton.obj   \
60         mkstemp.obj     \
61         strptime.obj
62
63 wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
64         wsock32.lib user32.lib shell32.lib comctl32.lib \
65         $(HHC_LIBS) \
66         wsutil\libwsutil.lib \
67         $(GNUTLS_LIBS) \
68 !IFDEF ENABLE_LIBWIRESHARK
69         epan\libwireshark.lib \
70 !ELSE
71         epan\dissectors\dissectors.lib \
72         epan\wireshark.lib \
73         epan\crypt\airpdcap.lib \
74         epan\dfilter\dfilter.lib \
75         epan\ftypes\ftypes.lib \
76         $(C_ARES_LIBS) \
77         $(ADNS_LIBS) \
78         $(PCRE_LIBS) \
79         $(ZLIB_LIBS)
80 !ENDIF
81
82 tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
83         wsock32.lib user32.lib \
84         $(GLIB_LIBS) \
85         wsutil\libwsutil.lib \
86         $(GNUTLS_LIBS) \
87 !IFDEF ENABLE_LIBWIRESHARK
88         epan\libwireshark.lib \
89 !ELSE
90         epan\dissectors\dissectors.lib \
91         epan\wireshark.lib \
92         epan\crypt\airpdcap.lib \
93         epan\dfilter\dfilter.lib \
94         epan\ftypes\ftypes.lib \
95         $(C_ARES_LIBS) \
96         $(ADNS_LIBS) \
97         $(PCRE_LIBS) \
98         $(ZLIB_LIBS)
99 !ENDIF
100
101 rawshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
102         wsock32.lib user32.lib \
103         $(GLIB_LIBS) \
104         wsutil\libwsutil.lib \
105         $(GNUTLS_LIBS) \
106 !IFDEF ENABLE_LIBWIRESHARK
107         epan\libwireshark.lib \
108 !ELSE
109         epan\dissectors\dissectors.lib \
110         epan\wireshark.lib \
111         epan\crypt\airpdcap.lib \
112         epan\dfilter\dfilter.lib \
113         epan\ftypes\ftypes.lib \
114         $(C_ARES_LIBS) \
115         $(ADNS_LIBS) \
116         $(PCRE_LIBS) \
117         $(ZLIB_LIBS)
118 !ENDIF
119
120 capinfos_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
121         wsock32.lib user32.lib shell32.lib \
122         wsutil\libwsutil.lib \
123         $(GLIB_LIBS)
124
125 editcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
126         wsock32.lib user32.lib shell32.lib \
127         wsutil\libwsutil.lib \
128         $(GLIB_LIBS)
129
130 mergecap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
131         wsock32.lib user32.lib \
132         wsutil\libwsutil.lib \
133         $(GLIB_LIBS)
134
135 text2pcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
136         wsock32.lib user32.lib \
137         wsutil\libwsutil.lib \
138         $(GLIB_LIBS)
139
140 dumpcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
141         wsock32.lib user32.lib \
142         wsutil\libwsutil.lib \
143         $(GLIB_LIBS) \
144         $(GNUTLS_LIBS)
145
146 dftest_LIBS=  wiretap\wiretap-$(WTAP_VERSION).lib \
147         wsock32.lib user32.lib \
148         $(GLIB_LIBS) \
149         wsutil\libwsutil.lib \
150         $(GNUTLS_LIBS) \
151 !IFDEF ENABLE_LIBWIRESHARK
152         epan\libwireshark.lib \
153 !ELSE
154         epan\dissectors\dissectors.lib \
155         epan\wireshark.lib \
156         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
157         $(C_ARES_LIBS) \
158         $(ADNS_LIBS) \
159         $(PCRE_LIBS) \
160         $(ZLIB_LIBS) \
161         $(SMI_LIBS)
162 !ENDIF
163
164 randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
165         user32.lib \
166         wsutil\libwsutil.lib \
167         $(GLIB_LIBS)
168
169 EXECUTABLES=wireshark.exe tshark.exe rawshark.exe \
170         capinfos.exe editcap.exe mergecap.exe text2pcap.exe randpkt.exe dumpcap.exe
171
172 RESOURCES=image\wireshark.res image\libwireshark.res image\tshark.res \
173         image\capinfos.res image\editcap.res image\mergecap.res \
174         image\text2pcap.res image\wiretap.res image\dumpcap.res \
175         image\rawshark.res image\libwsutil.res
176
177 LIBS_CHECK=_libs_check_
178
179 all: $(LIBS_CHECK) config.h tools image codecs $(C_ARES_DLL) $(ADNS_DLL) $(ZLIB_DLL) wsutil wiretap epan $(EXECUTABLES) $(RESOURCES) doc help install-all
180
181 packaging: all
182         cd packaging
183         cd nsis
184         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
185         cd ..
186         cd ..
187
188 packaging_u3: all
189         cd packaging
190         cd u3
191         cd win32
192         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
193         cd ..
194         cd ..
195         cd ..
196
197 packaging_papps: all
198         cd packaging
199         cd portableapps
200         cd win32
201         $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
202         cd ..
203         cd ..
204         cd ..
205
206 # use (info-)zip from cygwin to pack things
207 packaging_zip: all
208 !IFDEF MSVCR_DLL
209         xcopy "$(MSVCR_DLL)" $(INSTALL_DIR)
210 !ENDIF
211 !IFDEF VCREDIST_EXE
212         @echo Including vcredist_x86.exe -- your recipient may need to run it!
213         xcopy "$(VCREDIST_EXE)" $(INSTALL_DIR)
214 !ENDIF
215         rm -f wireshark.zip
216         zip -r -9 wireshark.zip $(INSTALL_DIR)/
217
218 wireshark.bsc: *.sbr epan\*.sbr epan\dfilter\*.sbr epan\ftypes\*.sbr epan\wslua\*.sbr epan\dissectors\*.sbr gtk\*.sbr wiretap\*.sbr
219         rm -f $@
220         $(BSCMAKE) @<<
221                 /o $@ $?
222 <<
223         xcopy $@ $(INSTALL_DIR)\ /d
224
225 $(RESOURCES): image
226
227 wiretap\wiretap-$(WTAP_VERSION).lib: image $(ZLIB_DLL) wiretap
228
229 wireshark.exe   : $(LIBS_CHECK) config.h svnversion.h $(wireshark_OBJECTS) getopt.obj inet_ntop.obj inet_pton.obj codecs epan gtk image\wireshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib gtk\libui.lib plugins
230         @echo Linking $@
231         $(LINK) @<<
232                 /OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) getopt.obj inet_ntop.obj inet_pton.obj $(GTK_LIBS) codecs\codecs.lib gtk\libui.lib $(wireshark_OBJECTS) image\wireshark.res
233 <<
234 !IF $(MSC_VER_REQUIRED) >= 1400
235         mt.exe -nologo -manifest "wireshark.exe.manifest" -outputresource:wireshark.exe;1
236 !ENDIF
237
238 tshark.exe      : $(LIBS_CHECK) config.h svnversion.h $(tshark_OBJECTS) getopt.obj inet_ntop.obj epan image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
239         @echo Linking $@
240         $(LINK) @<<
241                 /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(tshark_LIBS) $(tshark_OBJECTS) getopt.obj inet_ntop.obj image\tshark.res
242 <<
243 !IF $(MSC_VER_REQUIRED) >= 1400
244         mt.exe -nologo -manifest "tshark.exe.manifest" -outputresource:tshark.exe;1
245 !ENDIF
246
247 rawshark.exe    : $(LIBS_CHECK) config.h svnversion.h $(rawshark_OBJECTS) getopt.obj inet_ntop.obj epan image\rawshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
248         @echo Linking $@
249         $(LINK) @<<
250                 /OUT:rawshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(rawshark_LIBS) $(rawshark_OBJECTS) getopt.obj inet_ntop.obj image\rawshark.res
251 <<
252 !IF $(MSC_VER_REQUIRED) >= 1400
253         mt.exe -nologo -manifest "rawshark.exe.manifest" -outputresource:rawshark.exe;1
254 !ENDIF
255
256 # XXX: This makefile does not properly handle doing a 'nmake ... capinfos.exe' directly since some of the .objs
257 #      (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all').
258 capinfos.exe    : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) getopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res
259         @echo Linking $@
260         $(LINK) @<<
261                 /OUT:capinfos.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(capinfos_OBJECTS) getopt.obj $(capinfos_LIBS) image\capinfos.res
262 <<
263 !IF $(MSC_VER_REQUIRED) >= 1400
264         mt.exe -nologo -manifest "capinfos.exe.manifest" -outputresource:capinfos.exe;1
265 !ENDIF
266
267 # XXX: This makefile does not properly handle doing a 'nmake ... editcap.exe' directly since some of the .objs
268 #      (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all').
269 editcap.exe     : $(LIBS_CHECK) config.h $(editcap_OBJECTS) getopt.obj strptime.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res
270         @echo Linking $@
271         $(LINK) @<<
272                 /OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(editcap_OBJECTS) getopt.obj strptime.obj $(editcap_LIBS) image\editcap.res
273 <<
274 !IF $(MSC_VER_REQUIRED) >= 1400
275         mt.exe -nologo -manifest "editcap.exe.manifest" -outputresource:editcap.exe;1
276 !ENDIF
277
278 mergecap.exe    : $(LIBS_CHECK)  config.h svnversion.h mergecap.obj merge.obj getopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
279         @echo Linking $@
280         $(LINK) @<<
281                 /OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj getopt.obj $(mergecap_LIBS) image\mergecap.res
282 <<
283 !IF $(MSC_VER_REQUIRED) >= 1400
284         mt.exe -nologo -manifest "mergecap.exe.manifest" -outputresource:mergecap.exe;1
285 !ENDIF
286
287 text2pcap.exe   : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj getopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib strptime.obj image\text2pcap.res
288         @echo Linking $@
289         $(LINK) @<<
290                 /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj getopt.obj $(text2pcap_LIBS) strptime.obj image\text2pcap.res
291 <<
292 !IF $(MSC_VER_REQUIRED) >= 1400
293         mt.exe -nologo -manifest "text2pcap.exe.manifest" -outputresource:text2pcap.exe;1
294 !ENDIF
295
296 dftest.exe      : $(dftest_OBJECTS) epan
297         @echo Linking $@
298         $(LINK) @<<
299                 /OUT:dftest.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dftest_LIBS) $(dftest_OBJECTS)
300 <<
301 !IF $(MSC_VER_REQUIRED) >= 1400
302         mt.exe -nologo -manifest "dftest.exe.manifest" -outputresource:dftest.exe;1
303 !ENDIF
304
305 randpkt.exe     : $(randpkt_OBJECTS) getopt.obj
306         @echo Linking $@
307         $(LINK) @<<
308                 /OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS) getopt.obj
309 <<
310 !IF $(MSC_VER_REQUIRED) >= 1400
311         mt.exe -nologo -manifest "randpkt.exe.manifest" -outputresource:randpkt.exe;1
312 !ENDIF
313
314 dumpcap.exe     : $(LIBS_CHECK) config.h svnversion.h $(dumpcap_OBJECTS) getopt.obj inet_ntop.obj mkstemp.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\dumpcap.res
315         @echo Linking $@
316         $(LINK) @<<
317                 /OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dumpcap_LIBS) $(dumpcap_OBJECTS) getopt.obj inet_ntop.obj mkstemp.obj image\dumpcap.res
318 <<
319 !IF $(MSC_VER_REQUIRED) >= 1400
320         mt.exe -nologo -manifest "dumpcap.exe.manifest" -outputresource:dumpcap.exe;1
321 !ENDIF
322
323
324 config.h        : config.h.win32 config.nmake
325         sed -e s/@VERSION@/$(VERSION)/ \
326             -e "s/@HAVE_C_ARES@/$(C_ARES_CONFIG)/" \
327             -e "s/@HAVE_GNU_ADNS@/$(ADNS_CONFIG)/" \
328             -e "s/@HAVE_PCRE@/$(PCRE_CONFIG)/" \
329             -e "s/@HAVE_KFW@/$(KFW_CONFIG)/" \
330             -e "s/@HAVE_NETTLE@/$(NETTLE_CONFIG)/" \
331             -e "s/@HAVE_LIBZ@/$(ZLIB_CONFIG)/" \
332             -e "s/@HAVE_LIBPCAP@/$(WINPCAP_CONFIG)/" \
333             -e "s/@HAVE_PCAP_FINDALLDEVS@/$(PCAP_FINDALLDEVS_CONFIG)/" \
334             -e "s/@HAVE_PCAP_DATALINK_NAME_TO_VAL@/$(PCAP_DATALINK_NAME_TO_VAL_CONFIG)/" \
335             -e "s/@HAVE_PCAP_DATALINK_VAL_TO_NAME@/$(PCAP_DATALINK_VAL_TO_NAME_CONFIG)/" \
336             -e "s/@HAVE_PCAP_BREAKLOOP@/$(PCAP_BREAKLOOP_CONFIG)/" \
337             -e "s/@HAVE_REMOTE@/$(PCAP_HAVE_REMOTE_CONFIG)/" \
338             -e "s/@HAVE_PCAP_REMOTE@/$(PCAP_REMOTE_CONFIG)/" \
339             -e "s/@HAVE_PCAP_OPEN@/$(PCAP_OPEN_CONFIG)/" \
340         -e "s/@HAVE_PCAP_LIST_DATALINKS@/$(PCAP_LIST_DATALINKS_CONFIG)/" \
341         -e "s/@HAVE_PCAP_SET_DATALINK@/$(PCAP_SET_DATALINK_CONFIG)/" \
342             -e "s/@HAVE_PCAP_FINDALLDEVS_EX@/$(PCAP_FINDALLDEVS_EX_CONFIG)/" \
343             -e "s/@HAVE_PCAP_CREATESRCSTR@/$(PCAP_CREATESRCSTR_CONFIG)/" \
344             -e "s/@HAVE_PCAP_SETSAMPLING@/$(PCAP_SETSAMPLING_CONFIG)/" \
345             -e "s/@HAVE_LIBWIRESHARKDLL@/$(LIBWIRESHARK_CONFIG)/" \
346             -e "s/@WPCAP_CONSTIFIED@/$(WPCAP_CONSTIFIED_CONFIG)/" \
347             -e "s/@HAVE_LIBGNUTLS@/$(GNUTLS_CONFIG)/" \
348             -e "s/@HAVE_LIBGCRYPT@/$(LIBGCRYPT_CONFIG)/" \
349             -e "s/@HAVE_LUA@/$(LUA_CONFIG)/" \
350             -e "s/@HAVE_LUA_5_1@/$(LUA_VERSION)/" \
351             -e "s/@HAVE_AIRPCAP@/$(AIRPCAP_CONFIG)/" \
352             -e "s/@HAVE_AIRPDCAP@/$(AIRPDCAP_CONFIG)/" \
353             -e "s/@HAVE_LIBPORTAUDIO@/$(PORTAUDIO_CONFIG)/" \
354             -e "s/@PORTAUDIO_API_1@/$(PORTAUDIO_API_CONFIG)/" \
355             -e "s/@HAVE_SMI@/$(SMI_CONFIG)/" \
356             -e "s/@HAVE_GEOIP@/$(GEOIP_CONFIG)/" \
357             -e "s/@INET6@/$(INET6_CONFIG)/" \
358             < config.h.win32 > $@
359
360
361 ps.c    : rdps.py print.ps
362         $(PYTHON) rdps.py print.ps ps.c
363 #
364 # Build the version string
365 #
366 !IF EXIST(".svn/entries")
367 SVNENTRIES = .svn/entries
368 !ELSE
369 SVNENTRIES =
370 !ENDIF
371 svnversion.h: $(SVNENTRIES)
372         rm -f svnversion.h
373         $(PERL) make-version.pl
374
375 #
376 # Build the short version of the authors file for the about dialog
377 #
378 AUTHORS-SHORT: AUTHORS make-authors-short.pl
379         $(PERL) perlnoutf.pl make-authors-short.pl < AUTHORS > AUTHORS-SHORT
380
381 #
382 # Build the short version of the authors file with formatting codes for
383 # the man page
384 #
385 AUTHORS-SHORT-FORMAT: AUTHORS-SHORT make-authors-format.pl
386     $(PERL) perlnoutf.pl make-authors-format.pl < AUTHORS-SHORT > AUTHORS-SHORT-FORMAT
387
388 #
389 # Build "tshark-tap-register.c", which contains a function
390 # "register_all_tap_listeners()"
391 # that calls the register routines for all TShark tap listeners.
392 #
393 # We do this by grepping through sources.
394 #
395 # Formatting conventions:  The name of the tap_listener_register_*
396 # routines must start in column zero, or must be preceded only by
397 # "void " starting in column zero, and must not be inside #if.
398 #
399 # The first argument is the name of the file to write.
400 # The second argument is the directory in which the source files live.
401 # All subsequent arguments are the files to scan.
402 #
403 tshark-tap-register.c: $(TSHARK_TAP_SRC) make-tapreg-dotc
404         @echo Making tshark-tap-register.c
405         @$(SH) make-tapreg-dotc tshark-tap-register.c . $(TSHARK_TAP_SRC)
406
407 text2pcap-scanner.c : text2pcap-scanner.l
408         $(LEX) -otext2pcap-scanner.c text2pcap-scanner.l
409
410 text2pcap-scanner.obj : text2pcap-scanner.c
411         $(CC) $(CVARSDLL) $(GENERATED_CFLAGS) -Fd.\ -c $?
412
413 clean-local: clean-deps
414         rm -f $(wireshark_OBJECTS) $(tshark_OBJECTS) $(dumpcap_OBJECTS) $(rawshark_OBJECTS) \
415                 $(EXTRA_OBJECTS) $(EXECUTABLES) *.pdb *.exe.manifest \
416                 capinfos.obj editcap.obj mergecap.obj text2pcap.obj \
417                 nio-ie5.obj update.obj \
418                 text2pcap-scanner.obj text2pcap-scanner.c rdps.obj \
419                 rdps.pdb rdps.exe rdps.ilk config.h ps.c AUTHORS-SHORT \
420                 AUTHORS-SHORT-FORMAT $(LIBS_CHECK) \
421                 dftest.obj dftest.exe randpkt.obj randpkt.ext \
422                 doxygen.cfg \
423                 $(RESOURCES) libwireshark.dll wiretap-$(WTAP_VERSION).dll \
424                 libwsutil.dll \
425                 wireshark.bsc
426
427 clean: clean-local
428         cd asn1
429         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
430         cd ../wiretap
431         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
432         cd ../wsutil
433         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
434         cd ../codecs
435         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
436         cd ../gtk
437         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
438         cd ../epan
439         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
440         cd ../plugins
441         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
442         cd ../tools
443         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
444         cd ../image
445         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
446         cd ../doc
447         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
448         cd ../help
449         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
450         cd ../packaging/nsis
451         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
452         cd ../u3/win32
453         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
454         cd ../../portableapps/win32
455         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
456         cd ../../..
457
458 # "distclean" removes all files not part of the distribution.
459 # It does not remove generated files that are part of the distribution.
460 distclean-local: clean-local
461 !IFDEF ADNS_DIR
462 !IF "$(MSVC_VARIANT)" != "MSVC6"
463         rm -f $(ADNS_DLL) $(ADNS_LIBS)
464 !ENDIF
465 !ENDIF
466 !IFDEF ZLIB_DIR
467         rm -f $(ZLIB_DLL) $(ZLIB_DIR)\zlib1.dll.manifest \
468                 $(ZLIB_DIR)\include\zlib.h $(ZLIB_DIR)\include\zconf.h \
469                 $(ZLIB_DIR)\lib\zdll.lib
470 !ENDIF
471         rm -f config.h $(BUILT_SOURCES)
472
473 distclean: distclean-local
474         cd wiretap
475         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
476         cd ../wsutil
477         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
478         cd ../codecs
479         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
480         cd ../gtk
481         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
482         cd ../epan
483         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
484         cd ../plugins
485         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
486         cd ../tools
487         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
488         cd ../image
489         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
490         cd ../doc
491         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
492         cd ../help
493         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
494         cd ../packaging/nsis
495         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
496         cd ../u3/win32
497         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
498         cd ../../portableapps/win32
499         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
500         cd ../../..
501
502 # Make "maintainer-clean" only if you would like to remove ALL generated
503 # files.
504 # Be sure to have python and perl installed to regenerate them.
505 maintainer-clean-local: distclean-local
506         rm -f $(GENERATED_FILES)
507
508 maintainer-clean: maintainer-clean-local
509         cd wiretap
510         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
511         cd ../wsutil
512         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
513         cd ../codecs
514         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
515         cd ../gtk
516         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
517         cd ../epan
518         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
519         cd ../plugins
520         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
521         cd ../tools
522         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
523         cd ../image
524         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
525         cd ../doc
526         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
527         cd ../help
528         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
529         cd ../packaging/nsis
530         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
531         cd ../u3/win32
532         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
533         cd ../../portableapps/win32
534         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
535         cd ../../..
536
537 tools::
538         cd tools
539         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
540         cd ..
541
542 image::
543         cd image
544         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
545         cd ..
546
547 !IFDEF ADNS_DIR
548 # Non-MSVC6 variants have to avoid indirectly using msvcrt.dll,
549 # therefore compile the adns dll from source ADNS_DIR package.
550 # To avoid path problems, copy the adns sources to a temp dir,
551 # compile and copy the resulting files back to (source) ADNS_DIR
552 #
553 # Unfortunately:
554 # - we need to "patch" adns_dll.rep and adns_dll.rc (at least for MSVC2005EE)
555 # - on MSVC6 we can't easily rebuild, because iphlpapi.h is needed
556 #
557 $(ADNS_DLL):
558 !IF "$(MSVC_VARIANT)" == "MSVC6"
559         if not exist $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns mkdir $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns
560         copy $(ADNS_DIR)\adns_win32\lib\adns_dll.dll $(ADNS_DLL)
561         copy $(ADNS_DIR)\adns_win32\lib\adns_dll.lib $(ADNS_LIBS)
562 !ELSE
563         xcopy $(ADNS_DIR) adns.tmp /D /I /E /Y
564         copy adns_dll.dep adns.tmp\adns_win32\adns_dll
565         copy adns_dll.rc adns.tmp\adns_win32\adns_dll
566         cd adns.tmp\adns_win32\adns_dll
567         set CFG=adns_dll - Win32 Release
568         $(MAKE) /$(MAKEFLAGS) -f adns_dll.mak LOC="$(LOCAL_CFLAGS)"
569         cd ..\lib
570 !IF $(MSC_VER_REQUIRED) >= 1400
571         mt.exe -nologo -manifest "adns_dll.dll.manifest" -outputresource:adns_dll.dll;2
572 !ENDIF
573         if not exist $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns mkdir $(WIRESHARK_LIBS)\$(MSVC_VARIANT)\adns
574         copy adns_dll.dll $(ADNS_DLL)
575         copy adns_dll.lib $(ADNS_LIBS)
576         cd ..\..\..
577         rm -r -f adns.tmp
578 !ENDIF
579 !ENDIF
580
581 !IFDEF ZLIB_DIR
582 # Non-MSVC6 variants have to avoid indirectly using msvcrt.dll,
583 # therefore compile the zlib dll from source ZLIB_DIR package.
584 # To avoid path problems, copy the zlib sources to a temp dir,
585 # compile and copy the resulting files back to (source) ZLIB_DIR
586 $(ZLIB_DLL):
587         xcopy $(ZLIB_DIR) zlib.tmp /D /I /E /Y
588         cd zlib.tmp
589         $(MAKE) /$(MAKEFLAGS) -f win32/Makefile.msc zlib1.dll LOC="$(LOCAL_CFLAGS)"
590         if not exist $(ZLIB_DIR) mkdir $(ZLIB_DIR)
591         if not exist $(ZLIB_DIR)\lib mkdir $(ZLIB_DIR)\lib
592         if not exist $(ZLIB_DIR)\include mkdir $(ZLIB_DIR)\include
593 !IF $(MSC_VER_REQUIRED) >= 1400
594         mt.exe -nologo -manifest "zlib1.dll.manifest" -outputresource:zlib1.dll;2
595 !ENDIF
596         copy zlib1.dll $(ZLIB_DIR)
597         copy zdll.lib $(ZLIB_DIR)\lib
598         copy zconf.h $(ZLIB_DIR)\include
599         copy zlib.h $(ZLIB_DIR)\include
600         cd ..
601         rm -r -f zlib.tmp
602 !ENDIF
603
604 wsutil::
605         cd wsutil
606         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
607         cd ..
608
609 wiretap::
610         cd wiretap
611         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
612         cd ..
613
614 codecs::
615         cd codecs
616         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
617         cd ..
618
619 gtk:: help config.h svnversion.h AUTHORS-SHORT doxygen
620         cd gtk
621         $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libui.lib
622         cd ..
623
624 epan:: $(RESOURCES) $(ZLIB_DLL) wiretap\wiretap-$(WTAP_VERSION).lib $(BUILT_SOURCES) doxygen
625         cd epan
626         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
627         cd ..
628
629 plugins::
630         cd plugins
631         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
632         cd ..
633
634 doc::
635         cd doc
636         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
637         cd ..
638
639 help::
640         cd help
641         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
642         cd ..
643
644 doxygen.cfg: config.nmake doxygen.cfg.in
645         sed -e s/@VERSION@/$(VERSION)/ \
646             < doxygen.cfg.in > $@
647
648 doxygen-run:
649 !IFDEF DOXYGEN
650         $(DOXYGEN) doxygen.cfg
651 !ENDIF
652
653 doxygen: doxygen.cfg doxygen-run
654         
655
656 ################################################################################
657 # Prepare build environment by downloading and installing required libraries
658 ################################################################################
659
660 # The required tools to build Wireshark.
661 #
662 # The 'find' tool is available both in \WINNT\System32 and in cygwin's /usr/bin.
663 # We only need the cygwin version (for some shell scripts).
664 # In the PATH, System32 is before cygwin's dir, so explicitly check for /usr/bin/find.
665 REQUIRED_TOOLS=\
666         $(CC) \
667         $(LINK) \
668         nmake \
669 !IF $(MSC_VER_REQUIRED) >= 1400
670         mt \
671 !ENDIF
672         $(SH_PROG)      \
673         $(YACC) \
674         $(LEX)  \
675         env     \
676         grep    \
677         /usr/bin/find   \
678         $(PERL) \
679         $(PYTHON)       \
680         sed     \
681         unzip   \
682         wget
683
684 verify_tools:
685         @$(SH) $(WIN_SETUP) --appverify $(REQUIRED_TOOLS)
686
687 # Targets and etc used to verify or download libraries
688
689 !IFNDEF WIN_SETUP_OPT
690 WIN_SETUP_OPT=--download
691 !ENDIF
692
693 # Verify that the required library 'package' (zip) files have been downloaded.
694 # (It seems reasonable to assume that if the files have been downloaded
695 #  then they have been installed).
696 check_libs:
697         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake WIN_SETUP_OPT=--libverify process_libs
698
699 # Verify library packages only if Makefile.nmake has been updated
700 #  (or dummy file doesn't exist because of 'make clean' or whatever)
701 # (To disable library verification when Makefile.nmake changes,
702 #  comment out the commands for the following target).
703 # touch is only called if libverify succeeds.
704 #  (One microsec is added to the makefile.nmake time since the time set by [cygwin ?] 'touch --reference' 
705 #   apparently has the nanosecs truncated from the reference file time [at least on Windows Vista]).
706 $(LIBS_CHECK): Makefile.nmake
707         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake WIN_SETUP_OPT=--libverify process_libs
708         @touch --reference=Makefile.nmake -d "+0.000001 sec" $@
709
710 # Download (if needed) and install all the required libraries into WIRESHARK_LIBS.
711 # A clean_setup is done first to ensure that the target dirs don't
712 # contain old files remaining from a previous setup run.
713 setup: verify_tools clean_setup process_libs
714
715
716 # The process_libs target when invoked causes either a --libverify or a --download for all the required libraries.
717 # (The choice is determined by the value of the macro WIN_SETUP_OPT).
718 process_libs:
719 !IF "$(WIN_SETUP_OPT)" == "--libverify"
720     @$(SH) $(WIN_SETUP) --checktag "$(WIRESHARK_LIBS)"
721 !ENDIF
722     if not exist $(WIRESHARK_LIBS) md $(WIRESHARK_LIBS)
723 !IF "$(GTK_INST_VERSION)" == "2.16" || "$(GTK_INST_VERSION)" == "2.14" || "$(GTK_INST_VERSION)" == "2.12"
724         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
725                 glib gtk$(GTK_INST_VERSION)/glib_$(GLIB_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
726         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
727                 glib gtk$(GTK_INST_VERSION)/glib-dev_$(GLIB_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
728 !ELSE
729 !ERROR ? Unknown or invalid GTK_INST_VERSION
730 !ENDIF
731 !IFDEF ICONV_DIR
732         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
733                 libiconv-1.9.1.bin.woe32 libiconv-1.9.1.bin.woe32.zip
734 !ENDIF
735 !IF "$(WIRESHARK_TARGET_PLATFORM)" == "win32"
736         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
737                 gettext-runtime-0.17-1 gettext-runtime-0.17-1.zip
738 !ELSE
739         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
740                 gettext-0.17-1 gettext$(GETTEXT_PKG).zip
741 !ENDIF
742 !IFDEF KFW_DIR
743         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
744                 kfw-2.5 kfw-2.5.zip
745 !ENDIF
746 !IFDEF PCAP_DIR
747         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
748                 . WpdPack_$(PCAP_VERSION).zip
749 !ENDIF
750 !IFDEF AIRPCAP_DIR
751         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
752                 AirPcap_Devpack_1_0_0_594 AirPcap_Devpack_1_0_0_594.zip
753 !ENDIF
754 !IFDEF C_ARES_DIR
755         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
756                 . c-ares-1.6.0ws.zip
757 !ENDIF
758 !IFDEF ADNS_DIR
759         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
760                 . adns-1.0-win32-05ws.zip
761 !ENDIF
762 !IFDEF PCRE_DIR
763         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
764                 pcre-7.0 pcre-7.0-bin.zip
765         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
766                 pcre-7.0 pcre-7.0-lib.zip
767 !ENDIF
768 !IFDEF ZLIB_DIR
769         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
770                 zlib123 zlib123ws.zip
771 !ENDIF
772 !IFDEF LUA_DIR
773         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
774                 lua5.1.4 lua$(LUA_DIST)_lib.zip
775 !ENDIF
776
777 !IFDEF GNUTLS_DIR
778         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
779                 . gnutls-2.6.4-1.zip
780 !ENDIF
781 !IFDEF PORTAUDIO_DIR
782         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
783                 . portaudio_v19_2.zip
784 !ENDIF
785 !IFDEF SMI_DIR
786         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
787                 . libsmi-0.4.8.zip
788 !ENDIF
789 !IFDEF GEOIP_DIR
790         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
791                 . GeoIP-1.4.5ws.zip
792 !ENDIF
793
794 !IFDEF GTK_DIR
795 !IF "$(GTK_INST_VERSION)" == "2.16" || "$(GTK_INST_VERSION)" == "2.14" || "$(GTK_INST_VERSION)" == "2.12"
796         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
797                 gtk2 gtk$(GTK_INST_VERSION)/gtk+_$(GTK_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
798         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
799                 gtk2 gtk$(GTK_INST_VERSION)/gtk+-dev_$(GTK_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
800         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
801                 gtk2 gtk$(GTK_INST_VERSION)/cairo_$(CAIRO_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
802         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
803                 gtk2 gtk$(GTK_INST_VERSION)/cairo-dev_$(CAIRO_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
804         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
805                 gtk2 gtk$(GTK_INST_VERSION)/atk_$(ATK_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
806         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
807                 gtk2 gtk$(GTK_INST_VERSION)/atk-dev_$(ATK_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
808         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
809                 gtk2 gtk$(GTK_INST_VERSION)/libpng_$(LIBPNG_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
810         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
811                 gtk2 gtk$(GTK_INST_VERSION)/$(TIFF_PKG).zip
812         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
813                 gtk2 gtk$(GTK_INST_VERSION)/$(JPEG_PKG).zip
814 !ELSE
815 !ERROR ? Unknown or invalid GTK_INST_VERSION
816 !ENDIF
817 !IF "$(PANGO_INST_VERSION)" == "1.24" || "$(PANGO_INST_VERSION)" == "1.22"
818         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
819                 gtk2 gtk$(GTK_INST_VERSION)/pango_$(PANGO_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
820         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
821                 gtk2 gtk$(GTK_INST_VERSION)/pango-dev_$(PANGO_PKG)_$(WIRESHARK_TARGET_PLATFORM).zip
822 !ELSE
823 !ERROR ? Unknown or invalid PANGO_INST_VERSION
824 !ENDIF
825 !ENDIF
826 !IFDEF HHC_DIR
827         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
828                 user-guide user-guide-24665.zip
829 !ENDIF
830 !IFDEF UPX
831         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
832                 . upx301w.zip
833 !ENDIF
834 !IFDEF NASM
835         @$(SH) $(WIN_SETUP) "$(WIN_SETUP_OPT)" "$(WIRESHARK_LIBS)" \
836                 . nasm-2.02-win32.zip
837 !ENDIF
838 !IF "$(WIN_SETUP_OPT)" == "--download"
839     @$(SH) $(WIN_SETUP) --settag "$(WIRESHARK_LIBS)"
840 !ENDIF
841         @echo.
842         @echo Wireshark is ready to build.
843
844 # Cleanup files installed by the setup target. It will not remove the
845 # downloaded zip files.
846 # WHEN UPDATING LIBRARY VERSIONS, KEEP ALSO ONE FORMER VERSION SO
847 # UPDATING REMOVES THE FORMER USER DIRS
848 clean_setup:
849     rm -r -f $(WIRESHARK_LIBS)/adns-1.0-win32-05ws
850     rm -r -f $(WIRESHARK_LIBS)/c-ares-1.5.3ws
851     rm -r -f $(WIRESHARK_LIBS)/c-ares-1.6.0ws
852     rm -r -f $(WIRESHARK_LIBS)/gettext-0.14.5
853     rm -r -f $(WIRESHARK_LIBS)/gettext-runtime-0.17
854     rm -r -f $(WIRESHARK_LIBS)/gettext-runtime-0.17-1
855     rm -r -f $(WIRESHARK_LIBS)/gettext-0.17-1            # win64
856     rm -r -f $(WIRESHARK_LIBS)/glib
857     rm -r -f $(WIRESHARK_LIBS)/gnutls-2.6.3-1
858     rm -r -f $(WIRESHARK_LIBS)/gnutls-2.6.4-1
859     rm -r -f $(WIRESHARK_LIBS)/gtk2
860     rm -r -f $(WIRESHARK_LIBS)/gtk+
861     rm -r -f $(WIRESHARK_LIBS)/gtk-wimp
862     rm -r -f $(WIRESHARK_LIBS)/kfw-2.5
863     rm -r -f $(WIRESHARK_LIBS)/libiconv-1.9.1.bin.woe32
864     rm -r -f $(WIRESHARK_LIBS)/lua5.1
865     rm -r -f $(WIRESHARK_LIBS)/lua5.1.4
866     rm -r -f $(WIRESHARK_LIBS)/libsmi-0.4.5
867     rm -r -f $(WIRESHARK_LIBS)/libsmi-0.4.8
868     rm -r -f $(WIRESHARK_LIBS)/nasm-2.00
869     rm -r -f $(WIRESHARK_LIBS)/nasm-2.02
870     rm -r -f $(WIRESHARK_LIBS)/pcre-6.4
871     rm -r -f $(WIRESHARK_LIBS)/pcre-7.0
872     rm -r -f $(WIRESHARK_LIBS)/portaudio_v19
873     rm -r -f $(WIRESHARK_LIBS)/portaudio_v19_2
874     rm -r -f $(WIRESHARK_LIBS)/user-guide
875     rm -r -f $(WIRESHARK_LIBS)/WpdPack
876     rm -r -f $(WIRESHARK_LIBS)/AirPcap_Devpack_1_0_0_594
877     rm -r -f $(WIRESHARK_LIBS)/zlib123
878     rm -r -f $(WIRESHARK_LIBS)/zlib123-dll
879     rm -r -f $(WIRESHARK_LIBS)/upx301w
880     rm -r -f $(WIRESHARK_LIBS)/GeoIP-1.4.5ws
881
882 ################################################################################
883 # Prepare the debug trees for running Wireshark/Tshark from there.
884 ################################################################################
885
886
887 # prepare debugging of Wireshark in INSTALL_DIR
888 debug-wireshark: wireshark.exe install-generated-files
889
890 # prepare debugging of tshark in INSTALL_DIR
891 debug-tshark: tshark.exe install-generated-files
892
893 # prepare debugging of rawshark in INSTALL_DIR
894 debug-rawshark: rawshark.exe install-generated-files
895
896 # prepare debugging of dumpcap in INSTALL_DIR
897 debug-dumpcap: dumpcap.exe install-generated-files
898
899
900 # install generated files (exe, "our" libs, ...)
901 install-generated-files:
902         set copycmd=/y
903         if not exist $(INSTALL_DIR) mkdir $(INSTALL_DIR)
904 !IF "$(MSVC_VARIANT)" == "MSVC2008"
905         xcopy "$(MSVCR_DLL)" $(INSTALL_DIR)\*.*
906 !ENDIF
907 !IFDEF ENABLE_LIBWIRESHARK
908         xcopy epan\libwireshark.dll $(INSTALL_DIR) /d
909 !ENDIF
910         xcopy ".\wiretap\wiretap-$(WTAP_VERSION).dll" $(INSTALL_DIR) /d
911         if exist ".\wiretap\wiretap-$(WTAP_VERSION).pdb" xcopy ".\wiretap\wiretap-$(WTAP_VERSION).pdb" $(INSTALL_DIR) /d
912         xcopy ".\epan\libwireshark.dll" $(INSTALL_DIR) /d
913         xcopy ".\wsutil\libwsutil.dll" $(INSTALL_DIR) /d
914         if exist ".\epan\libwireshark.pdb" xcopy ".\epan\libwireshark.pdb" $(INSTALL_DIR) /d
915         if exist wireshark.exe copy wireshark.exe $(INSTALL_DIR)\wireshark.exe
916         if exist wireshark.pdb copy wireshark.pdb $(INSTALL_DIR)\wireshark.pdb
917         if exist ".\docbook\user-guide.chm" xcopy ".\docbook\user-guide.chm" $(INSTALL_DIR) /d
918         if exist tshark.exe xcopy tshark.exe $(INSTALL_DIR) /d
919         if exist tshark.pdb xcopy tshark.pdb $(INSTALL_DIR) /d
920         if exist rawshark.exe xcopy rawshark.exe $(INSTALL_DIR) /d
921         if exist rawshark.pdb xcopy rawshark.pdb $(INSTALL_DIR) /d
922         if exist dumpcap.exe xcopy dumpcap.exe $(INSTALL_DIR) /d
923         if exist dumpcap.pdb xcopy dumpcap.pdb $(INSTALL_DIR) /d
924         if exist mergecap.exe xcopy mergecap.exe $(INSTALL_DIR) /d
925         if exist mergecap.pdb xcopy mergecap.pdb $(INSTALL_DIR) /d
926         if exist text2pcap.exe xcopy text2pcap.exe $(INSTALL_DIR) /d
927         if exist text2pcap.pdb xcopy text2pcap.pdb $(INSTALL_DIR) /d
928         if exist capinfos.exe xcopy capinfos.exe $(INSTALL_DIR) /d
929         if exist capinfos.pdb xcopy capinfos.pdb $(INSTALL_DIR) /d
930         if exist editcap.exe xcopy editcap.exe $(INSTALL_DIR) /d
931         if exist editcap.pdb xcopy editcap.pdb $(INSTALL_DIR) /d
932         xcopy ".\AUTHORS-SHORT" $(INSTALL_DIR) /d
933         xcopy ".\manuf" $(INSTALL_DIR) /d
934         xcopy ".\services" $(INSTALL_DIR) /d
935         xcopy ".\README" $(INSTALL_DIR) /d
936         xcopy ".\README.win32" $(INSTALL_DIR) /d
937         xcopy ".\AUTHORS-SHORT" $(INSTALL_DIR) /d
938         xcopy ".\COPYING" $(INSTALL_DIR) /d
939         copy ".\NEWS" $(INSTALL_DIR)\NEWS.txt
940         xcopy ".\cfilters" $(INSTALL_DIR) /d
941         xcopy ".\colorfilters" $(INSTALL_DIR) /d
942         xcopy ".\dfilters" $(INSTALL_DIR) /d
943         xcopy ".\smi_modules" $(INSTALL_DIR) /d
944 !IFDEF LUA_DIR
945         xcopy ".\epan\wslua\init.lua" $(INSTALL_DIR) /d
946         xcopy ".\epan\wslua\console.lua" $(INSTALL_DIR) /d
947 !ENDIF
948         xcopy ipmap.html $(INSTALL_DIR) /d
949         xcopy doc\*.html $(INSTALL_DIR) /d
950         if not exist $(INSTALL_DIR)\help mkdir $(INSTALL_DIR)\help
951         xcopy ".\help\*.*" $(INSTALL_DIR)\help /d
952 # you can't reliably use xcopy to rename files "on the fly" (so copy first, then rename)
953         xcopy ".\help\faq.txt" $(INSTALL_DIR) /d
954         if exist $(INSTALL_DIR)\FAQ del $(INSTALL_DIR)\FAQ
955     ren $(INSTALL_DIR)\faq.txt FAQ 
956         if not exist $(INSTALL_DIR)\dtds mkdir $(INSTALL_DIR)\dtds
957         xcopy ".\dtds\*.*" $(INSTALL_DIR)\dtds /d
958         if not exist $(INSTALL_DIR)\asn1 mkdir $(INSTALL_DIR)\asn1
959         echo create empty asn1 default.tt file to prevent problems 2> $(INSTALL_DIR)\asn1\default.tt
960         if not exist $(INSTALL_DIR)\radius mkdir $(INSTALL_DIR)\radius
961         xcopy ".\radius\*.*" $(INSTALL_DIR)\radius /d
962         if not exist $(INSTALL_DIR)\diameter mkdir $(INSTALL_DIR)\diameter
963         xcopy ".\diameter\*.dtd" $(INSTALL_DIR)\diameter /d
964         xcopy ".\diameter\*.xml" $(INSTALL_DIR)\diameter /d
965         if not exist $(INSTALL_DIR)\tpncp mkdir $(INSTALL_DIR)\tpncp
966         xcopy ".\tpncp\*.dat" $(INSTALL_DIR)\tpncp /d
967         if not exist $(INSTALL_DIR)\wimaxasncp mkdir $(INSTALL_DIR)\wimaxasncp
968         xcopy ".\wimaxasncp\*.*" $(INSTALL_DIR)\wimaxasncp /d
969         if not exist $(INSTALL_DIR)\plugins mkdir $(INSTALL_DIR)\plugins
970         if not exist $(INSTALL_DIR)\plugins\$(VERSION) mkdir $(INSTALL_DIR)\plugins\$(VERSION)
971         cd plugins 
972         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake install-plugins 
973         cd .. 
974
975 # "install-all" will copy all files needed to run Wireshark/Tshark
976 # to the INSTALL_DIR, so you can run/debug Wireshark/Tshark from there.
977 install-all: install-generated-files
978         set copycmd=/y
979         if not exist $(INSTALL_DIR) mkdir $(INSTALL_DIR)
980         xcopy $(GTK_DIR)\bin\libgdk-win32-2.0-0.dll $(INSTALL_DIR) /d
981         xcopy $(GTK_DIR)\bin\libgdk_pixbuf-2.0-0.dll $(INSTALL_DIR) /d
982         xcopy $(GTK_DIR)\bin\libgtk-win32-2.0-0.dll $(INSTALL_DIR) /d
983         xcopy $(GTK_DIR)\bin\libatk-1.0-0.dll $(INSTALL_DIR) /d
984         xcopy $(GTK_DIR)\bin\libpango-1.0-0.dll $(INSTALL_DIR) /d
985         xcopy $(GTK_DIR)\bin\libpangowin32-1.0-0.dll $(INSTALL_DIR) /d
986         if not exist $(INSTALL_DIR)\etc mkdir $(INSTALL_DIR)\etc
987         if not exist $(INSTALL_DIR)\etc\gtk-2.0 mkdir $(INSTALL_DIR)\etc\gtk-2.0
988         if not exist $(INSTALL_DIR)\etc\pango mkdir $(INSTALL_DIR)\etc\pango
989         if not exist $(INSTALL_DIR)\lib mkdir $(INSTALL_DIR)\lib
990         if not exist $(INSTALL_DIR)\lib\gtk-2.0 mkdir $(INSTALL_DIR)\lib\gtk-2.0
991         if not exist $(INSTALL_DIR)\lib\gtk-2.0\modules mkdir $(INSTALL_DIR)\lib\gtk-2.0\modules
992         if not exist $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR) mkdir $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)
993         if not exist $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders mkdir $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\loaders
994 #       if not exist $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules mkdir $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules
995         if not exist $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines mkdir $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines
996 #       if not exist $(INSTALL_DIR)\lib\pango mkdir $(INSTALL_DIR)\lib\pango
997 #       if not exist $(INSTALL_DIR)\lib\pango\$(PANGO_LIB_DIR) mkdir $(INSTALL_DIR)\lib\pango\$(PANGO_LIB_DIR)
998 #       if not exist $(INSTALL_DIR)\lib\pango\$(PANGO_LIB_DIR)\modules mkdir $(INSTALL_DIR)\lib\pango\$(PANGO_LIB_DIR)\modules
999         xcopy $(GTK_DIR)\etc\gtk-2.0\*.* $(INSTALL_DIR)\etc\gtk-2.0 /d
1000         if exist $(GTK_DIR)\etc\pango xcopy $(GTK_DIR)\etc\pango\pango.* $(INSTALL_DIR)\etc\pango /d
1001         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
1002         xcopy $(GTK_DIR)\lib\gtk-2.0\modules\libgail.dll $(INSTALL_DIR)\lib\gtk-2.0\modules /d
1003         xcopy $(GTK_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines\libpixmap.dll $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\engines /d
1004 #       xcopy $(GTK_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules\im-*.dll $(INSTALL_DIR)\lib\gtk-2.0\$(GTK_LIB_DIR)\immodules /d
1005 #       xcopy $(GTK_DIR)\lib\pango\$(PANGO_LIB_DIR)\modules\pango-*.dll $(INSTALL_DIR)\lib\pango\$(PANGO_LIB_DIR)\modules /d
1006 !IFDEF NEED_LIBPNG_DLL
1007 #       xcopy $(GTK_DIR)\bin\libpng13.dll $(INSTALL_DIR) /d
1008         xcopy $(GTK_DIR)\bin\libpng12-0.dll $(INSTALL_DIR) /d
1009 !ENDIF
1010 !IFDEF NEED_LIBTIFF_DLL
1011         xcopy $(GTK_DIR)\bin\$(TIFF_DLL) $(INSTALL_DIR) /d
1012 !ENDIF
1013 !IFDEF NEED_LIBJPEG_DLL
1014         xcopy $(GTK_DIR)\bin\$(JPEG_DLL) $(INSTALL_DIR) /d
1015 !ENDIF
1016 !IFDEF NEED_CAIRO_DLL
1017         xcopy $(GTK_DIR)\bin\libcairo-2.dll $(INSTALL_DIR)  /d
1018         xcopy $(GTK_DIR)\bin\libpangocairo-1.0-0.dll $(INSTALL_DIR) /d
1019 !ENDIF
1020         if not exist $(INSTALL_DIR)\$(GTK_WIMP_DLLDST_DIR) mkdir $(INSTALL_DIR)\$(GTK_WIMP_DLLDST_DIR)
1021         xcopy "$(GTK_WIMP_DLLSRC_DIR)\libwimp.dll" $(INSTALL_DIR)\$(GTK_WIMP_DLLDST_DIR) /d
1022         if not exist $(INSTALL_DIR)\$(GTK_WIMP_RCDST_DIR) mkdir $(INSTALL_DIR)\$(GTK_WIMP_RCDST_DIR)
1023         xcopy "$(GTK_WIMP_RCSRC_DIR)\gtkrc" $(INSTALL_DIR)\$(GTK_WIMP_RCDST_DIR) /d
1024         xcopy $(GLIB_DIR)\bin\libgio-2.0-0.dll $(INSTALL_DIR) /d
1025         xcopy $(GLIB_DIR)\bin\libglib-2.0-0.dll $(INSTALL_DIR) /d
1026         xcopy $(GLIB_DIR)\bin\libgmodule-2.0-0.dll $(INSTALL_DIR) /d
1027         xcopy $(GLIB_DIR)\bin\libgobject-2.0-0.dll $(INSTALL_DIR) /d
1028 !IFDEF ICONV_DIR
1029         xcopy $(ICONV_DIR)\bin\iconv.dll $(INSTALL_DIR) /d
1030 !ENDIF
1031         xcopy $(GETTEXT_DIR)\bin\$(GETTEXT_DLL) $(INSTALL_DIR) /d
1032 !IFDEF ZLIB_DIR
1033         xcopy $(ZLIB_DLL) $(INSTALL_DIR) /d
1034 !ENDIF
1035 !IFDEF C_ARES_DIR
1036         xcopy $(C_ARES_DLL) $(INSTALL_DIR) /d
1037 !ENDIF
1038 !IFDEF ADNS_DIR
1039         xcopy $(ADNS_DLL) $(INSTALL_DIR) /d
1040 !ENDIF
1041 !IFDEF PCRE_DIR
1042         xcopy $(PCRE_DIR)\bin\pcre3.dll $(INSTALL_DIR) /d
1043         xcopy $(PCRE_DIR)\man\cat3\pcrepattern.3.txt $(INSTALL_DIR) /d
1044 !ENDIF
1045 !IFDEF KFW_DIR
1046         xcopy $(KFW_DIR)\bin\comerr32.dll $(INSTALL_DIR) /d
1047         xcopy $(KFW_DIR)\bin\krb5_32.dll $(INSTALL_DIR) /d
1048 !ENDIF
1049 !IFDEF GNUTLS_DIR
1050         xcopy $(GNUTLS_DIR)\bin\libgcrypt-11.dll $(INSTALL_DIR) /d
1051         xcopy $(GNUTLS_DIR)\bin\libgnutls-26.dll $(INSTALL_DIR) /d
1052         xcopy $(GNUTLS_DIR)\bin\libgnutls-extra-26.dll $(INSTALL_DIR) /d
1053         xcopy $(GNUTLS_DIR)\bin\libgnutls-openssl-26.dll $(INSTALL_DIR) /d
1054         xcopy $(GNUTLS_DIR)\bin\libgpg-error-0.dll $(INSTALL_DIR) /d
1055         xcopy $(GNUTLS_DIR)\bin\libtasn1-3.dll $(INSTALL_DIR) /d
1056 !ENDIF
1057 !IFDEF LUA_DIR
1058         xcopy "$(LUA_DIR)\lua5.1.dll" $(INSTALL_DIR) /d
1059 !ENDIF
1060 !IFDEF SMI_DIR
1061         if not exist $(INSTALL_DIR)\snmp mkdir $(INSTALL_DIR)\snmp
1062         if not exist $(INSTALL_DIR)\snmp\mibs mkdir $(INSTALL_DIR)\snmp\mibs
1063         xcopy "$(SMI_DIR)\lib\smi.dll" $(INSTALL_DIR) /d
1064         xcopy "$(SMI_DIR)\mibs\*" $(INSTALL_DIR)\snmp\mibs /d
1065 !ENDIF
1066
1067 clean-deps:
1068         rm -rf $(INSTALL_DIR)
1069         cd plugins
1070         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean-deps
1071         cd ..
1072
1073 checkapi_local:
1074         $(PERL) tools/checkAPIs.pl \
1075         $(wireshark_SOURCES) \
1076         $(TSHARK_TAP_SRC) \
1077 #       $(EXTRA_wireshark_SOURCES)
1078
1079 checkapi: checkapi_local
1080         cd wiretap
1081         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1082         cd ../codecs
1083         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1084         cd ../gtk
1085         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1086         cd ../epan
1087 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1088         cd ../epan/crypt
1089 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1090         cd ../dfilter
1091         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1092         cd ../ftypes
1093 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1094         cd ../wslua
1095 ##      $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1096         cd ../dissectors
1097         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1098         cd ..
1099         cd ../plugins
1100         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi
1101         cd ../wsutil
1102         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake checkapi