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