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