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