aca12f609bcf24c278351c9edfd0c11b3ff76758
[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 include config.nmake
7 include <win32.mak>
8
9 ############### no need to modify below this line #########
10
11 CC = cl
12 LINK= link
13
14 LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)
15
16 CFLAGS=-DHAVE_CONFIG_H $(LOCAL_CFLAGS) $(GLIB_CFLAGS) /I. /Iwiretap \
17         $(ZLIB_CFLAGS) /I$(PCAP_DIR)\include \
18         /I$(NET_SNMP_DIR)\include /I$(NET_SNMP_DIR)\win32 \
19         $(ADNS_CFLAGS) $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) $(LUA_CFLAGS) \
20         -D_U_="" -D_NEED_VAR_IMPORT_
21
22 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
23
24 .c.obj::
25         $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
26
27 PLATFORM_SRC = capture-wpcap.c capture_wpcap_packet.c
28
29 include Makefile.common
30
31 wireshark_OBJECTS = $(wireshark_SOURCES:.c=.obj)
32 tshark_OBJECTS = $(tshark_SOURCES:.c=.obj)
33 dftest_OBJECTS = $(dftest_SOURCES:.c=.obj)
34
35 dumpcap_OBJECTS = $(dumpcap_SOURCES:.c=.obj)
36
37 randpkt_OBJECTS = $(randpkt_SOURCES:.c=.obj)
38
39 command_line_OBJECTS = 
40
41 #setargv.obj
42
43 EXTRA_OBJECTS = \
44 #       strerror.obj    \
45         mkstemp.obj     \
46         strptime.obj
47
48 wireshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
49         wsock32.lib user32.lib shell32.lib comctl32.lib \
50         $(NET_SNMP_DIR)\win32\lib\release\netsnmp.lib \
51 !IFDEF HHC_DIR
52         $(HHC_DIR)\lib\htmlhelp.lib \
53 !ENDIF
54 !IFDEF ENABLE_LIBWIRESHARK
55         epan\libwireshark.lib \
56 !ELSE
57         epan\dissectors\dissectors.lib \
58         epan\wireshark.lib \
59         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
60         $(ADNS_LIBS) \
61         $(PCRE_LIBS) \
62         $(ZLIB_LIBS) \
63         $(GNUTLS_LIBS) 
64 !ENDIF
65 #       $(PCAP_DIR)\lib\wpcap.lib
66
67 tshark_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
68         wsock32.lib user32.lib \
69         $(GLIB_LIBS) \
70         $(NET_SNMP_DIR)\win32\lib\release\netsnmp.lib \
71 !IFDEF ENABLE_LIBWIRESHARK
72         epan\libwireshark.lib \
73 !ELSE
74         epan\dissectors\dissectors.lib \
75         epan\wireshark.lib \
76         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
77         $(ADNS_LIBS) \
78         $(PCRE_LIBS) \
79         $(ZLIB_LIBS) \
80         $(GNUTLS_LIBS)
81 !ENDIF
82
83 capinfos_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
84         wsock32.lib user32.lib \
85         $(GLIB_LIBS)
86
87 editcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
88         wsock32.lib user32.lib \
89         $(GLIB_LIBS)
90
91 mergecap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
92         wsock32.lib user32.lib \
93         $(GLIB_LIBS)
94
95 dumpcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
96         wsock32.lib user32.lib \
97         $(GLIB_LIBS)
98
99 dftest_LIBS=  wiretap\wiretap-$(WTAP_VERSION).lib \
100         wsock32.lib user32.lib \
101         $(GLIB_LIBS) \
102         $(NET_SNMP_DIR)\win32\lib\release\netsnmp.lib \
103 !IFDEF ENABLE_LIBWIRESHARK
104         epan\libwireshark.lib \
105 !ELSE
106         epan\dissectors\dissectors.lib \
107         epan\wireshark.lib \
108         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
109         $(ADNS_LIBS) \
110         $(PCRE_LIBS) \
111         $(ZLIB_LIBS) \
112         $(GNUTLS_LIBS)  
113 !ENDIF
114
115 randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
116         user32.lib \
117         $(GLIB_LIBS) \
118         $(NET_SNMP_DIR)\win32\lib\release\netsnmp.lib
119
120 EXECUTABLES=wireshark.exe wireshark-gtk2.exe tshark.exe \
121         capinfos.exe editcap.exe mergecap.exe text2pcap.exe randpkt.exe dumpcap.exe
122
123 RESOURCES=image\wireshark.res image\libwireshark.res image\tshark.res \
124         image\capinfos.res image\editcap.res image\mergecap.res \
125         image\text2pcap.res image\wiretap.res image\dumpcap.res
126
127 all: config.h tools image codecs wiretap epan $(EXECUTABLES) $(RESOURCES) doc
128
129 packaging: all
130         cd packaging
131         cd nsis
132         nmake -f makefile.nmake
133         cd ..
134         cd ..
135
136 separate_packaging: all
137         cd packaging
138         cd nsis
139 !IFDEF GTK1_DIR
140         nmake -f makefile.nmake GTK1_ONLY="USE"
141 !ENDIF
142 !IFDEF GTK2_DIR
143         nmake -f makefile.nmake GTK2_ONLY="USE"
144 !ENDIF
145         cd ..
146         cd ..
147
148 $(RESOURCES): image
149
150 wiretap\wiretap-$(WTAP_VERSION).lib: wiretap
151
152 !IFNDEF GTK1_DIR
153 wireshark.exe   : 
154 !ELSE
155 wireshark.exe   : config.h svnversion.h $(wireshark_OBJECTS) $(command_line_OBJECTS) epan gtk image\wireshark.res wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib gtk\libui.lib plugins
156         @echo Linking $@
157         $(LINK) @<<
158                 /OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(wireshark_LIBS) $(GTK1_LIBS) codecs\codecs.lib gtk\libui.lib $(wireshark_OBJECTS) image\wireshark.res
159 <<
160 !ENDIF
161
162 !IFNDEF GTK2_DIR
163 wireshark-gtk2.exe      : 
164 !ELSE
165 wireshark-gtk2.exe      : config.h svnversion.h $(wireshark_OBJECTS) $(command_line_OBJECTS) codecs epan gtk2 image\wireshark.res wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib gtk2.tmp\libui.lib plugins
166         @echo Linking $@
167         $(LINK) @<<
168                 /OUT:wireshark-gtk2.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(wireshark_LIBS) $(GTK2_LIBS) codecs\codecs.lib gtk2.tmp\libui.lib $(wireshark_OBJECTS) image\wireshark.res
169 <<
170 !ENDIF
171
172 tshark.exe      : config.h svnversion.h $(tshark_OBJECTS) $(command_line_OBJECTS) epan image\tshark.res wiretap\wiretap-$(WTAP_VERSION).lib plugins
173         @echo Linking $@
174         $(LINK) @<<
175                 /OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(tshark_LIBS) $(tshark_OBJECTS) $(command_line_OBJECTS) image\tshark.res
176 <<
177
178 capinfos.exe    : config.h capinfos.obj getopt.obj $(command_line_OBJECTS) wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res
179         @echo Linking $@
180         $(LINK) @<<
181                 /OUT:capinfos.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console capinfos.obj getopt.obj $(command_line_OBJECTS) $(capinfos_LIBS) image\capinfos.res
182 <<
183
184 editcap.exe     : config.h editcap.obj getopt.obj strptime.obj epan\crypt-md5.obj wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res
185         @echo Linking $@
186         $(LINK) @<<
187                 /OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console editcap.obj getopt.obj strptime.obj epan\crypt-md5.obj $(command_line_OBJECTS) $(editcap_LIBS) image\editcap.res
188 <<
189
190 mergecap.exe    : config.h svnversion.h mergecap.obj merge.obj getopt.obj $(command_line_OBJECTS) wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
191         @echo Linking $@
192         $(LINK) @<<
193                 /OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj getopt.obj $(command_line_OBJECTS) $(mergecap_LIBS) image\mergecap.res
194 <<
195
196 text2pcap.exe   : config.h text2pcap.obj text2pcap-scanner.obj getopt.obj strptime.obj $(command_line_OBJECTS) image\text2pcap.res
197         @echo Linking $@
198         $(LINK) @<<
199                 /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj getopt.obj strptime.obj $(command_line_OBJECTS) image\text2pcap.res
200 <<
201
202 dftest.exe      : $(dftest_OBJECTS) epan
203         @echo Linking $@
204         $(LINK) @<<
205                 /OUT:dftest.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dftest_LIBS) $(dftest_OBJECTS)
206 <<
207
208 randpkt.exe     : $(randpkt_OBJECTS) $(command_line_OBJECTS)
209         @echo Linking $@
210         $(LINK) @<<
211                 /OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS) $(command_line_OBJECTS)
212 <<
213
214 dumpcap.exe     : config.h svnversion.h $(dumpcap_OBJECTS) getopt.obj mkstemp.obj $(command_line_OBJECTS) wiretap\wiretap-$(WTAP_VERSION).lib image\dumpcap.res 
215         @echo Linking $@
216         $(LINK) @<<
217                 /OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dumpcap_LIBS) $(dumpcap_OBJECTS) getopt.obj mkstemp.obj $(command_line_OBJECTS) image\dumpcap.res
218 <<
219
220
221 config.h        : config.h.win32 config.nmake
222         sed -e s/@VERSION@/$(VERSION)/ \
223             -e "s/@HAVE_GNU_ADNS@/$(ADNS_CONFIG)/" \
224             -e "s/@HAVE_PCRE@/$(PCRE_CONFIG)/" \
225             -e "s/@HAVE_KFW@/$(KFW_CONFIG)/" \
226             -e "s/@HAVE_NETTLE@/$(NETTLE_CONFIG)/" \
227             -e "s/@HAVE_LIBZ@/$(ZLIB_CONFIG)/" \
228             -e "s/@HAVE_LIBPCAP@/$(WINPCAP_CONFIG)/" \
229             -e "s/@HAVE_PCAP_FINDALLDEVS@/$(PCAP_FINDALLDEVS_CONFIG)/" \
230             -e "s/@HAVE_PCAP_DATALINK_NAME_TO_VAL@/$(PCAP_DATALINK_NAME_TO_VAL_CONFIG)/" \
231             -e "s/@HAVE_PCAP_DATALINK_VAL_TO_NAME@/$(PCAP_DATALINK_VAL_TO_NAME_CONFIG)/" \
232             -e "s/@HAVE_PCAP_BREAKLOOP@/$(PCAP_BREAKLOOP_CONFIG)/" \
233             -e "s/@HAVE_LIBWIRESHARKDLL@/$(LIBWIRESHARK_CONFIG)/" \
234             -e "s/@WPCAP_CONSTIFIED@/$(WPCAP_CONSTIFIED_CONFIG)/" \
235             -e "s/@HAVE_GNUTLS@/$(GNUTLS_CONFIG)/" \
236             -e "s/@HAVE_LIBGCRYPT@/$(LIBGCRYPT_CONFIG)/" \
237             -e "s/@HAVE_LUA@/$(LUA_CONFIG)/" \
238             -e "s/@HAVE_LUA_5_1@/$(LUA_VERSION)/" \
239             -e "s/@HAVE_AIRPCAP@/$(AIRPCAP_CONFIG)/" \
240             -e "s/@HAVE_PORTAUDIO@/$(PORTAUDIO_CONFIG)/" \
241             -e "s/@HAVE_PORTAUDIO_API@/$(PORTAUDIO_API_CONFIG)/" \
242             < config.h.win32 > $@
243
244 ps.c    : rdps.exe print.ps
245         rdps print.ps ps.c
246
247
248 #
249 # Build the version string
250 #
251 svnversion.h:
252         $(PERL) make-version.pl
253
254 #
255 # Build the short version of the authors file for the about dialog
256 #
257 AUTHORS-SHORT: AUTHORS make-authors-short.pl
258         $(PERL) perlnoutf.pl make-authors-short.pl < AUTHORS > AUTHORS-SHORT
259
260 #
261 # Build the short version of the authors file with formatting codes for
262 # the man page
263 #
264 AUTHORS-SHORT-FORMAT: AUTHORS-SHORT make-authors-format.pl
265     $(PERL) perlnoutf.pl make-authors-format.pl < AUTHORS-SHORT > AUTHORS-SHORT-FORMAT
266
267 #
268 # Build "tshark-tap-register.c", which contains a function 
269 # "register_all_tap_listeners()"
270 # that calls the register routines for all tehtereal tap listeners.
271 #
272 # We do this by grepping through sources.
273 #
274 # Formatting conventions:  The name of the tap_listener_register_* 
275 # routines must start in column zero, or must be preceded only by 
276 # "void " starting in column zero, and must not be inside #if.
277 #
278 # The first argument is the name of the file to write.
279 # The second argument is the directory in which the source files live.
280 # All subsequent arguments are the files to scan.
281 #
282 tshark-tap-register.c: $(TSHARK_TAP_SRC) make-tapreg-dotc
283         @echo Making tshark-tap-register.c
284         @$(SH) make-tapreg-dotc tshark-tap-register.c . $(TSHARK_TAP_SRC)
285
286 text2pcap-scanner.c : text2pcap-scanner.l
287         $(LEX) -otext2pcap-scanner.c text2pcap-scanner.l
288
289 gtk2_distclean:
290         rm -f gtk2.tmp/*.*
291         if exist gtk2.tmp rmdir gtk2.tmp
292
293 clean: gtk2_distclean
294         rm -f $(wireshark_OBJECTS) $(tshark_OBJECTS) $(EXTRA_OBJECTS) \
295                 $(EXECUTABLES) $(PDB_FILE) \
296                 capinfos.obj editcap.obj mergecap.obj text2pcap.obj getopt.obj\
297                 text2pcap-scanner.obj text2pcap-scanner.c rdps.obj \
298                 rdps.pdb rdps.exe rdps.ilk config.h ps.c AUTHORS-SHORT \
299                 AUTHORS-SHORT-FORMAT \
300                 dftest.obj dftest.exe randpkt.obj randpkt.ext dumpcap.obj \
301                 doxygen.cfg \
302                 $(RESOURCES) libwireshark.dll wiretap-$(WTAP_VERSION).dll
303         cd asn1
304         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
305         cd ..
306         cd wiretap
307         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
308         cd ../codecs
309         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
310         cd ../gtk
311         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
312         cd ../epan
313         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
314         cd ../plugins
315         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
316         cd ../tools
317         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
318         cd ../image
319         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
320         cd ../doc
321         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
322         cd ../help
323         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
324         cd ../packaging/nsis
325         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
326         cd ../..
327
328 # "distclean" removes all files not part of the distribution.
329 # It does not remove generated files that are part of the distribution.
330 distclean: clean gtk2_distclean clean-deps
331         rm -f config.h $(BUILT_SOURCES)
332         cd wiretap
333         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
334         cd ../codecs
335         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
336         cd ../gtk
337         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
338         cd ../epan
339         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
340         cd ../plugins
341         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
342         cd ../tools
343         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
344         cd ../image
345         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
346         cd ../doc
347         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
348         cd ../help
349         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
350         cd ../packaging/nsis
351         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
352         cd ../..
353
354 # Make "maintainer-clean" only if you would like to remove ALL generated
355 # files.
356 # Be sure to have python and perl installed to regenerate them.
357 maintainer-clean: distclean
358         rm -f $(GENERATED_FILES)
359         cd wiretap
360         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
361         cd ../codecs
362         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
363         cd ../gtk
364         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
365         cd ../epan
366         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
367         cd ../plugins
368         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
369         cd ../tools
370         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
371         cd ../image
372         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
373         cd ../doc
374         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
375         cd ../help
376         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
377         cd ../packaging/nsis
378         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake maintainer-clean
379         cd ../..
380
381 tools::
382         cd tools
383         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
384         cd ..
385
386 image::
387         cd image
388         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
389         cd ..
390
391 wiretap::
392         cd wiretap
393         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
394         cd ..
395
396 codecs:: help config.h svnversion.h AUTHORS-SHORT doxygen
397         cd codecs
398         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
399         cd ..
400
401 gtk:: help config.h svnversion.h AUTHORS-SHORT doxygen
402         cd gtk
403         $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake GTK_CFLAGS="$(GTK1_CFLAGS)" GTK_LIBS="$(GTK1_LIBS)" libui.lib
404         cd ..
405
406 # copy all required files to gtk2.tmp (but only when newer than existing) and compile in that dir
407 gtk2:: help config.h svnversion.h AUTHORS-SHORT
408         if not exist gtk2.tmp mkdir gtk2.tmp
409         cd gtk
410         set copycmd=/y
411         xcopy Makefile.* ..\gtk2.tmp /d
412         xcopy *.c        ..\gtk2.tmp /d
413         xcopy *.h        ..\gtk2.tmp /d
414         cd ..\gtk2.tmp
415         $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake GTK_CFLAGS="$(GTK2_CFLAGS)" GTK_LIBS="$(GTK2_LIBS)" libui.lib
416         cd ..
417
418 epan:: $(RESOURCES) $(BUILT_SOURCES) doxygen
419         cd epan
420         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
421         cd ..
422
423 plugins::
424         cd plugins
425         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
426         cd ..
427
428 doc::
429         cd doc
430         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
431         cd ..
432
433 help::
434         cd help
435         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
436         cd ..
437
438 doxygen.cfg: config.nmake doxygen.cfg.in
439         sed -e s/@VERSION@/$(VERSION)/ \
440             < doxygen.cfg.in > $@
441
442 doxygen-run:
443 !IFDEF DOXYGEN
444         $(DOXYGEN) doxygen.cfg
445 !ENDIF
446
447 doxygen: doxygen.cfg doxygen-run
448
449 ################################################################################
450 # Prepare build environment by downloading and installing required libraries
451 ################################################################################
452
453 # The required tools to build Ethereal.
454 #
455 # The 'find' tool is available both in \WINNT\System32 and in cygwin's /usr/bin.
456 # We only need the cygwin version (for some shell scripts).
457 # In the PATH, System32 is before cygwin's dir, so explicitly check for /usr/bin/find.
458 REQUIRED_TOOLS=\
459         $(CC) \
460         $(LINK) \
461         nmake \
462         $(SH)   \
463         $(YACC) \
464         $(LEX)  \
465         env     \
466         grep    \
467         /usr/bin/find   \
468         $(PERL) \
469         $(PYTHON)       \
470         sed     \
471         unzip   \
472         wget
473
474 verify_tools:
475         @$(SH) tools\win32-setup.sh --appverify $(REQUIRED_TOOLS)
476
477 # Download and install all the required libraries into WIRESHARK_LIBS.
478 # If you used this setup target before, consider doing a clean_setup.
479 setup: verify_tools
480 !IF "$(GTK2_INST_VERSION)" == "2.8"
481         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
482                 glib gtk2.8/glib-2.8.4-20051212.zip
483         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
484                 glib gtk2.8/glib-dev-2.8.4-20051212.zip
485 !ELSEIF "$(GTK2_INST_VERSION)" == "2.6"
486         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
487                 glib gtk2.6/glib-2.6.6.zip
488         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
489                 glib gtk2.6/glib-dev-2.6.6.zip
490 !ELSEIF "$(GTK2_INST_VERSION)" == "2.4"
491         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
492                 glib gtk2.4/glib-2.4.7.zip
493         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
494                 glib gtk2.4/glib-dev-2.4.7.zip
495 !ELSE
496         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
497                 glib glib-2.2.3-20040116.zip
498         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
499                 glib glib-dev-2.2.3-20040116.zip
500 !ENDIF
501 !IFDEF GTK1_DIR
502         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
503                 gtk+ gtk+-1.3.0-20030717.zip
504         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
505                 gtk+ gtk+-dev-1.3.0-20030115.zip
506 !ENDIF
507         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
508                 libiconv-1.9.1.bin.woe32 libiconv-1.9.1.bin.woe32.zip
509         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
510                 gettext-runtime-0.13.1 gettext-runtime-0.13.1.zip
511 !IFDEF NET_SNMP_DIR
512         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
513                 . net-snmp-5.3.1.zip
514 !ENDIF
515 !IFDEF KFW_DIR
516         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
517                 kfw-2.5 kfw-2.5.zip
518 !ENDIF
519 !IFDEF PCAP_DIR
520         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
521                 . WpdPack_3_1.zip
522 !ENDIF
523 !IFDEF ADNS_DIR
524         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
525                 . adns-1.0-win32-05.zip
526 !ENDIF
527 !IFDEF PCRE_DIR
528         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
529                 pcre-6.4 pcre-6.4-bin.zip
530         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
531                 pcre-6.4 pcre-6.4-lib.zip
532 !ENDIF
533 !IFDEF ZLIB_DIR
534         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
535                 zlib123-dll zlib123-dll.zip
536 !ENDIF
537 !IFDEF LUA_DIR
538         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
539                 . lua5_1_vc6.zip
540 !ENDIF
541 !IFDEF GNUTLS_DIR
542         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
543                 . gnutls-1.5.0-1.zip
544 !ENDIF
545 !IFDEF PORTAUDIO_DIR
546         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
547                 . portaudio_v18_1.zip
548 !ENDIF
549
550 !IFDEF GTK2_DIR
551 !IF "$(GTK2_INST_VERSION)" == "2.8"
552         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
553                 gtk2 gtk2.8/gtk+-2.8.9.zip
554         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
555                 gtk2 gtk2.8/gtk+-dev-2.8.9.zip
556         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
557                 gtk2 gtk2.8/cairo-1.0.2.zip
558         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
559                 gtk2 gtk2.8/cairo-dev-1.0.2.zip
560         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
561                 gtk2 gtk2.8/atk-1.10.3.zip
562         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
563                 gtk2 gtk2.8/atk-dev-1.10.3.zip
564         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
565                 gtk2 gtk2.8/libpng-1.2.8-bin.zip
566 !ELSEIF "$(GTK2_INST_VERSION)" == "2.6"
567         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
568                 gtk2 gtk2.6/gtk+-2.6.9.zip
569         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
570                 gtk2 gtk2.6/gtk+-dev-2.6.9.zip
571         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
572                 gtk2 gtk2.6/atk-1.9.0.zip
573         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
574                 gtk2 gtk2.6/atk-dev-1.9.0.zip
575 !ELSEIF "$(GTK2_INST_VERSION)" == "2.4"
576         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
577                 gtk2 gtk2.4/gtk+-2.4.14.zip
578         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
579                 gtk2 gtk2.4/gtk+-dev-2.4.14.zip
580         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
581                 gtk2 gtk2.4/atk-1.6.0.zip
582         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
583                 gtk2 gtk2.4/atk-dev-1.6.0.zip
584 !ELSE
585         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
586                 gtk2 gtk2/gtk+-2.2.4-20040124.zip
587         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
588                 gtk2 gtk2/gtk+-dev-2.2.4-20040124.zip
589         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
590                 gtk2 gtk2/atk-1.4.0.zip
591         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
592                 gtk2 gtk2/atk-dev-1.4.0.zip
593 !ENDIF
594 !IF "$(PANGO_INST_VERSION)" == "1.10"
595         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
596                 gtk2 gtk2.8/pango-1.10.1.zip
597         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
598                 gtk2 gtk2.8/pango-dev-1.10.1.zip
599 !ELSEIF "$(PANGO_INST_VERSION)" == "1.8"
600         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
601                 gtk2 gtk2.6/pango-1.8.2.zip
602         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
603                 gtk2 gtk2.6/pango-dev-1.8.2.zip
604 !ELSEIF "$(PANGO_INST_VERSION)" == "1.4"
605         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
606                 gtk2 gtk2.4/pango-1.4.1.zip
607         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
608                 gtk2 gtk2.4/pango-dev-1.4.1.zip
609 !ELSE
610         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
611                 gtk2 gtk2/pango-1.2.5-20040124.zip
612         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
613                 gtk2 gtk2/pango-dev-1.2.5-20040124.zip
614 !ENDIF
615 !ENDIF
616 !IFDEF GTK_WIMP_DIR
617         @$(SH) tools\win32-setup.sh --download "$(WIRESHARK_LIBS)" \
618                 gtk-wimp gtk-wimp/gtk-wimp-0.7.0-bin.zip
619 !ENDIF
620         @echo.
621         @echo Wireshark is ready to build.
622
623 # Cleanup files installed by the setup target. It will not remove the 
624 # downloaded zip files.
625 clean_setup:
626     rm -r -f $(WIRESHARK_LIBS)/glib
627     rm -r -f $(WIRESHARK_LIBS)/gtk+
628     rm -r -f $(WIRESHARK_LIBS)/libiconv-1.9.1.bin.woe32
629     rm -r -f $(WIRESHARK_LIBS)/gettext-runtime-0.13.1
630     rm -r -f $(WIRESHARK_LIBS)/zlib123-dll
631     rm -r -f $(WIRESHARK_LIBS)/gtk2
632     rm -r -f $(WIRESHARK_LIBS)/gtk-wimp
633
634 ################################################################################
635 # Prepare the source tree for running (t)wireshark directly from there.
636 ################################################################################
637
638 # "install-deps" will copy all dlls needed to run (t)wireshark
639 # to the source tree, so you can run (t)wireshark directly from there.
640 # Note that the gtk2 version of wireshark is called wireshark-gtk2.exe
641
642 install-deps: clean-deps install-gtk1-deps install-gtk2-deps
643         cd plugins
644         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake install-plugins
645         cd ..
646
647 install-gtk2-deps: install-required-deps
648 !IFDEF GTK2_DIR
649         set copycmd=/y
650         xcopy $(GTK2_DIR)\bin\libgdk-win32-2.0-0.dll . /d
651         xcopy $(GTK2_DIR)\bin\libgdk_pixbuf-2.0-0.dll . /d
652         xcopy $(GTK2_DIR)\bin\libgtk-win32-2.0-0.dll . /d
653         xcopy $(GTK2_DIR)\bin\libatk-1.0-0.dll . /d
654         xcopy $(GTK2_DIR)\bin\libpango-1.0-0.dll . /d
655         xcopy $(GTK2_DIR)\bin\libpangowin32-1.0-0.dll . /d
656         mkdir etc
657         mkdir etc\gtk-2.0
658         mkdir etc\pango
659         mkdir lib
660         mkdir lib\gtk-2.0
661         mkdir lib\gtk-2.0\$(GTK2_LIB_DIR)
662         mkdir lib\gtk-2.0\$(GTK2_LIB_DIR)\loaders
663         mkdir lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules
664         mkdir lib\pango
665         mkdir lib\pango\$(PANGO_LIB_DIR)
666         mkdir lib\pango\$(PANGO_LIB_DIR)\modules
667         xcopy $(GTK2_DIR)\etc\gtk-2.0\*.* etc\gtk-2.0 /d
668         xcopy $(GTK2_DIR)\etc\pango\pango.* etc\pango /d
669         xcopy $(GTK2_DIR)\lib\gtk-2.0\$(GTK2_LIB_DIR)\loaders\libpixbufloader-*.dll lib\gtk-2.0\$(GTK2_LIB_DIR)\loaders /d
670         xcopy $(GTK2_DIR)\lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules\im-*.dll lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules /d
671         xcopy $(GTK2_DIR)\lib\pango\$(PANGO_LIB_DIR)\modules\pango-*.dll lib\pango\$(PANGO_LIB_DIR)\modules /d
672 !IFDEF NEED_LIBPNG_DLL
673         xcopy $(GTK2_DIR)\bin\libpng13.dll . /d
674 !ENDIF
675 !IFDEF NEED_CAIRO_DLL
676         xcopy $(GTK2_DIR)\bin\libcairo-2.dll . /d
677         xcopy $(GTK2_DIR)\bin\libpangocairo-1.0-0.dll . /d
678 !ENDIF
679 !ENDIF
680
681 install-gtk1-deps: install-required-deps
682 !IFDEF GTK1_DIR
683         set copycmd=/y
684         xcopy $(GTK1_DIR)\lib\libgtk-0.dll . /d
685         xcopy $(GTK1_DIR)\lib\libgdk-0.dll . /d
686 !ENDIF
687
688 install-required-deps:
689         set copycmd=/y
690         xcopy wiretap\wiretap-$(WTAP_VERSION).dll . /d
691 !IFDEF ENABLE_LIBWIRESHARK
692         xcopy epan\libwireshark.dll . /d
693 !ENDIF
694         xcopy $(GLIB_DIR)\bin\libglib-2.0-0.dll . /d
695         xcopy $(GLIB_DIR)\bin\libgmodule-2.0-0.dll . /d
696         xcopy $(GLIB_DIR)\bin\libgobject-2.0-0.dll . /d
697         xcopy $(ICONV_DIR)\bin\iconv.dll . /d
698         xcopy $(GETTEXT_DIR)\bin\intl.dll . /d
699 !IFDEF ZLIB_DIR
700         xcopy $(ZLIB_DIR)\zlib1.dll . /d
701 !ENDIF
702 !IFDEF ADNS_DIR
703         xcopy $(ADNS_DIR)\adns_win32\LIB\adns_dll.dll . /d
704 !ENDIF
705 !IFDEF PCRE_DIR
706         xcopy $(PCRE_DIR)\bin\pcre.dll . /d
707 !ENDIF
708 !IFDEF KFW_DIR
709         xcopy $(KFW_DIR)\bin\comerr32.dll . /d
710         xcopy $(KFW_DIR)\bin\krb5_32.dll . /d
711 !ENDIF
712 !IFDEF GNUTLS_DIR
713         xcopy $(GNUTLS_DIR)\bin\libgcrypt-11.dll . /d
714         xcopy $(GNUTLS_DIR)\bin\libgnutls-14.dll . /d
715         xcopy $(GNUTLS_DIR)\bin\libgnutls-extra-14.dll . /d
716         xcopy $(GNUTLS_DIR)\bin\libgnutls-openssl-14.dll . /d
717         xcopy $(GNUTLS_DIR)\bin\libgpg-error-0.dll . /d
718         xcopy $(GNUTLS_DIR)\bin\libtasn1-3.dll . /d
719 !ENDIF
720
721 clean-deps:
722         rm -f *.dll
723         rm -rf etc
724         rm -rf lib
725         cd plugins
726         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean-deps
727         cd ..
728