Move dissectors to epan/dissectors directory.
[obnox/wireshark/wip.git] / Makefile.nmake
1 ## Makefile for building ethereal.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) -D_U_=""
20
21 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
22
23 .c.obj::
24         $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
25
26 PLATFORM_SRC = capture-wpcap.c
27
28 include Makefile.common
29
30 include epan\Makefile.common
31
32 BUILT_SOURCES = $(BUILT_SOURCES) \
33         svnversion.h
34
35
36 ethereal_OBJECTS = $(ethereal_SOURCES:.c=.obj)
37 tethereal_OBJECTS = $(tethereal_SOURCES:.c=.obj)
38 dftest_OBJECTS = $(dftest_SOURCES:.c=.obj)
39
40 randpkt_OBJECTS = $(randpkt_SOURCES:.c=.obj)
41
42 EXTRA_OBJECTS = \
43 #       snprintf.obj    \
44 #       strerror.obj    \
45         mkstemp.obj     \
46         strptime.obj
47
48 ethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
49         wsock32.lib user32.lib shell32.lib \
50         $(NET_SNMP_DIR)\win32\lib\netsnmp.lib \
51 !IFDEF ENABLE_LIBETHEREAL
52         epan\libethereal.lib \
53 !ELSE
54         epan\dissectors\dissectors.lib \
55         epan\ethereal.lib \
56         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
57         $(ADNS_LIBS) \
58         $(PCRE_LIBS) \
59         $(ZLIB_LIBS)
60 !ENDIF
61 #       $(PCAP_DIR)\lib\wpcap.lib
62
63 tethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
64         wsock32.lib user32.lib \
65         $(GLIB_LIBS) \
66         $(NET_SNMP_DIR)\win32\lib\netsnmp.lib \
67 !IFDEF ENABLE_LIBETHEREAL
68         epan\libethereal.lib \
69 !ELSE
70         epan\dissectors\dissectors.lib \
71         epan\ethereal.lib \
72         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
73         $(ADNS_LIBS) \
74         $(PCRE_LIBS) \
75         $(ZLIB_LIBS)
76 !ENDIF
77
78 editcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
79         wsock32.lib user32.lib \
80         $(GLIB_LIBS)
81
82 mergecap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
83         wsock32.lib user32.lib \
84         $(GLIB_LIBS)
85
86 dftest_LIBS=  wiretap\wiretap-$(WTAP_VERSION).lib \
87         wsock32.lib user32.lib \
88         $(GLIB_LIBS) \
89         $(NET_SNMP_DIR)\win32\lib\netsnmp.lib \
90 !IFDEF ENABLE_LIBETHEREAL
91         epan\libethereal.lib \
92 !ELSE
93         epan\dissectors\dissectors.lib \
94         epan\ethereal.lib \
95         epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \
96         $(ADNS_LIBS) \
97         $(PCRE_LIBS) \
98         $(ZLIB_LIBS)    
99 !ENDIF
100
101 randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
102         user32.lib \
103         $(GLIB_LIBS) \
104         $(NET_SNMP_DIR)\win32\lib\netsnmp.lib
105
106 EXECUTABLES=ethereal.exe ethereal-gtk2.exe tethereal.exe editcap.exe mergecap.exe text2pcap.exe
107
108 RESOURCES=image\ethereal.res image\libethereal.res image\tethereal.res image\editcap.res image\mergecap.res image\text2pcap.res
109
110 all: config.h tools image wiretap epan $(EXECUTABLES) $(RESOURCES) doc
111
112 packaging: all
113         cd packaging
114         cd nsis
115         nmake -f makefile.nmake
116         cd ..
117         cd ..
118
119 separate_packaging: all
120         cd packaging
121         cd nsis
122 !IFDEF GTK1_DIR
123         nmake -f makefile.nmake GTK1_ONLY="USE"
124 !ENDIF
125 !IFDEF GTK2_DIR
126         nmake -f makefile.nmake GTK2_ONLY="USE"
127 !ENDIF
128         cd ..
129         cd ..
130
131 $(RESOURCES): image
132
133 wiretap\wiretap-$(WTAP_VERSION).lib: wiretap
134
135 !IFNDEF GTK1_DIR
136 ethereal.exe    : 
137 !ELSE
138 ethereal.exe    : config.h svnversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk\libui.lib plugins
139         @echo Linking $@
140         $(LINK) @<<
141                 /OUT:ethereal.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(ethereal_LIBS) $(GTK1_LIBS) gtk\libui.lib $(ethereal_OBJECTS) $(EXTRA_OBJECTS) image\ethereal.res
142 <<
143 !ENDIF
144
145 !IFNDEF GTK2_DIR
146 ethereal-gtk2.exe       : 
147 !ELSE
148 ethereal-gtk2.exe       : config.h svnversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk2 image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk2.tmp\libui.lib plugins
149         @echo Linking $@
150         $(LINK) @<<
151                 /OUT:ethereal-gtk2.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(ethereal_LIBS) $(GTK2_LIBS) gtk2.tmp\libui.lib $(ethereal_OBJECTS) $(EXTRA_OBJECTS) image\ethereal.res
152 <<
153 !ENDIF
154
155 tethereal.exe   : config.h svnversion.h $(tethereal_OBJECTS) $(EXTRA_OBJECTS) epan image\tethereal.res wiretap\wiretap-$(WTAP_VERSION).lib plugins
156         @echo Linking $@
157         $(LINK) @<<
158                 /OUT:tethereal.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(tethereal_LIBS) $(tethereal_OBJECTS) $(EXTRA_OBJECTS) image\tethereal.res
159 <<
160
161 editcap.exe     : config.h editcap.obj getopt.obj wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res
162         @echo Linking $@
163         $(LINK) @<<
164                 /OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console editcap.obj getopt.obj $(editcap_LIBS) image\editcap.res
165 <<
166
167 mergecap.exe    : config.h svnversion.h mergecap.obj merge.obj getopt.obj wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
168         @echo Linking $@
169         $(LINK) @<<
170                 /OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj getopt.obj $(mergecap_LIBS) image\mergecap.res
171 <<
172
173 text2pcap.exe   : config.h text2pcap.obj text2pcap-scanner.obj getopt.obj strptime.obj image\text2pcap.res
174         @echo Linking $@
175         $(LINK) @<<
176                 /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj getopt.obj strptime.obj image\text2pcap.res
177 <<
178
179 dftest.exe      : $(dftest_OBJECTS) $(EXTRA_OBJECTS) epan
180         $(LINK) @<<
181                 /OUT:dftest.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dftest_LIBS) $(dftest_OBJECTS) $(EXTRA_OBJECTS)
182 <<
183
184 randpkt.exe     : $(randpkt_OBJECTS) $(EXTRA_OBJECTS)
185         $(LINK) @<<
186                 /OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS)
187 <<
188
189 config.h        : config.h.win32 config.nmake
190         sed -e s/@VERSION@/$(VERSION)/ \
191             -e "s/@HAVE_GNU_ADNS@/$(ADNS_CONFIG)/" \
192             -e "s/@HAVE_PCRE@/$(PCRE_CONFIG)/" \
193             -e "s/@HAVE_LIBZ@/$(ZLIB_CONFIG)/" \
194             -e "s/@HAVE_LIBPCAP@/$(WINPCAP_CONFIG)/" \
195             -e "s/@HAVE_PCAP_FINDALLDEVS@/$(PCAP_FINDALLDEVS_CONFIG)/" \
196             -e "s/@HAVE_LIBETHEREALDLL@/$(LIBETHEREAL_CONFIG)/" \
197             -e "s/@WPCAP_CONSTIFIED@/$(WPCAP_CONSTIFIED_CONFIG)/" \
198             -e "s/@HAVE_LIBETHEREALDLL@/$(LIBETHEREAL_CONFIG)/" \
199             < config.h.win32 > $@
200
201 ps.c    : rdps.exe print.ps
202         rdps print.ps ps.c
203
204
205 #
206 # Build the version string
207 #
208 svnversion.h:
209         $(PERL) make-version.pl
210
211 #
212 # Build the short version of the authors file for the about dialog
213 #
214 AUTHORS-SHORT: AUTHORS make-authors-short.pl
215         $(PERL) make-authors-short.pl < AUTHORS > AUTHORS-SHORT
216
217
218 #
219 # The header files listed here are built from x11-fields using Perl;
220 # we declare a dependency here so that they get built.
221 #
222 packet-x11.obj  : packet-x11.c x11-declarations.h x11-register-info.h
223
224 #
225 # Build various header files for the X11 dissector.
226 #
227 x11-declarations.h x11-register-info.h: x11-fields process-x11-fields.pl
228         $(PERL) process-x11-fields.pl <x11-fields
229
230 packet-ncp2222.c : ncp2222.py
231 !IFDEF PYTHON
232         @echo Making packet-ncp2222.c
233         $(PYTHON) ncp2222.py -o packet-ncp2222.c
234 !ELSE
235         @echo Faking packet-ncp2222.c...
236         @echo Python is required to build the NCP disector
237         @echo Hiding packet-ncp.c...
238         mv packet-ncp.c packet-ncp.c.save
239         touch packet-ncp.c $@
240 !ENDIF
241
242 #
243 # Build "tethereal-tap-register.c", which contains a function 
244 # "register_all_tap_listeners()"
245 # that calls the register routines for all tehtereal tap listeners.
246 #
247 # We do this by grepping through sources.
248 #
249 # Formatting conventions:  The name of the tap_listener_register_* 
250 # routines must start in column zero, or must be preceded only by 
251 # "void " starting in column zero, and must not be inside #if.
252 #
253 # The first argument is the name of the file to write.
254 # The second argument is the directory in which the source files live.
255 # All subsequent arguments are the files to scan.
256 #
257 tethereal-tap-register.c: $(TETHEREAL_TAP_SRC) make-tapreg-dotc
258         @echo Making tethereal-tap-register.c
259         @$(SH) make-tapreg-dotc tethereal-tap-register.c . $(TETHEREAL_TAP_SRC)
260
261 text2pcap-scanner.c : text2pcap-scanner.l
262         $(LEX) -otext2pcap-scanner.c text2pcap-scanner.l
263
264 gtk2_distclean:
265         rm -f gtk2.tmp/*.*
266         if exist gtk2.tmp rmdir gtk2.tmp
267
268 clean: gtk2_distclean
269         rm -f $(ethereal_OBJECTS) $(tethereal_OBJECTS) $(EXTRA_OBJECTS) \
270                 $(EXECUTABLES) $(PDB_FILE) \
271                 editcap.obj mergecap.obj text2pcap.obj getopt.obj\
272                 text2pcap-scanner.obj text2pcap-scanner.c rdps.obj \
273                 rdps.pdb config.h ps.c AUTHORS-SHORT \
274                 rdps.exe rdps.ilk dftest.obj dftest.exe randpkt.obj randpkt.ext \
275                 $(RESOURCES)
276         cd wiretap
277         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
278         cd ../gtk
279         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
280         cd ../epan
281         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
282         cd ../plugins
283         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
284         cd ../tools
285         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
286         cd ../image
287         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
288         cd ../doc
289         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
290         cd ../help
291         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
292         cd ../packaging/nsis
293         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean
294         cd ../..
295
296 # Call distclean only, if you would like to remove ALL generated files.
297 # Be sure to have python and perl installed to regenerate them.
298 distclean: clean gtk2_distclean
299         rm -f $(BUILT_SOURCES) \
300                 packet-ncp2222.c tethereal-tap-register.c 
301         cd wiretap
302         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
303         cd ../gtk
304         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
305         cd ../epan
306         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
307         cd ../plugins
308         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
309         cd ../tools
310         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
311         cd ../image
312         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
313         cd ../doc
314         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
315         cd ../help
316         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
317         cd ../packaging/nsis
318         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean
319         cd ../..
320
321 tools::
322         cd tools
323         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
324         cd ..
325
326 image::
327         cd image
328         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
329         cd ..
330
331 wiretap::
332         cd wiretap
333         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
334         cd ..
335
336 gtk:: help config.h svnversion.h AUTHORS-SHORT doxygen
337         cd gtk
338         $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake GTK_CFLAGS="$(GTK1_CFLAGS)" GTK_LIBS="$(GTK1_LIBS)" libui.lib
339         cd ..
340
341 # copy all required files to gtk2.tmp (but only when newer than existing) and compile in that dir
342 gtk2:: help config.h svnversion.h AUTHORS-SHORT
343         if not exist gtk2.tmp mkdir gtk2.tmp
344         cd gtk
345         cp --update --preserve Makefile.* *.c *.h ..\gtk2.tmp
346         cd ..\gtk2.tmp
347         $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake GTK_CFLAGS="$(GTK2_CFLAGS)" GTK_LIBS="$(GTK2_LIBS)" libui.lib
348         cd ..
349
350 epan:: $(RESOURCES) packet-ncp2222.c x11-declarations.h x11-register-info.h doxygen
351         cd epan
352         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
353         cd ..
354
355 plugins::
356         cd plugins
357         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
358         cd ..
359
360 doc::
361         cd doc
362         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
363         cd ..
364
365 help::
366         cd help
367         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
368         cd ..
369
370 doxygen.cfg: config.nmake doxygen.cfg.in
371         sed -e s/@VERSION@/$(VERSION)/ \
372             < doxygen.cfg.in > $@
373
374 doxygen-run:
375 !IFDEF DOXYGEN
376         $(DOXYGEN) doxygen.cfg
377 !ENDIF
378
379 doxygen: doxygen.cfg doxygen-run
380
381 REQUIRED_APPS=\
382         $(SH)   \
383         $(YACC) \
384         $(LEX)  \
385         grep    \
386         $(PERL) \
387         $(PYTHON)       \
388         sed     \
389         unzip   \
390         wget
391
392 verify_apps:
393         @$(SH) tools\win32-setup.sh --appverify $(REQUIRED_APPS)
394
395 setup: verify_apps
396 !IF "$(GTK2_INST_VERSION)" == "2.4"
397         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
398                 glib gtk2.4/glib-2.4.2.zip
399         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
400                 glib gtk2.4/glib-dev-2.4.2.zip
401 !ELSE
402         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
403                 glib glib-2.2.3-20040116.zip
404         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
405                 glib glib-dev-2.2.3-20040116.zip
406 !ENDIF
407 !IFDEF GTK1_DIR
408         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
409                 gtk+ gtk+-1.3.0-20030717.zip
410         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
411                 gtk+ gtk+-dev-1.3.0-20030115.zip
412 !ENDIF
413         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
414                 libiconv-1.9.1.bin.woe32 libiconv-1.9.1.bin.woe32.zip
415         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
416                 gettext-runtime-0.13.1 gettext-runtime-0.13.1.zip
417 !IFDEF NET_SNMP_DIR
418         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
419                 . net-snmp-5.1.zip
420 !ENDIF
421 !IFDEF PCAP_DIR
422         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
423                 . wpdpack_3_0.zip
424 !ENDIF
425 !IFDEF ADNS_DIR
426         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
427                 . adns-1.0-win32-03.zip
428 !ENDIF
429 !IFDEF PCRE_DIR
430         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
431                 . pcre-4.4.zip
432 !ENDIF
433 !IFDEF ZLIB_DIR
434         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
435                 zlib121-dll zlib121-dll.zip
436 !ENDIF
437 !IFDEF GTK2_DIR
438 !IF "$(GTK2_INST_VERSION)" == "2.4"
439         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
440                 gtk2 gtk2.4/gtk+-2.4.3.zip
441         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
442                 gtk2 gtk2.4/gtk+-dev-2.4.3.zip
443         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
444                 gtk2 gtk2.4/atk-1.6.0.zip
445         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
446                 gtk2 gtk2.4/atk-dev-1.6.0.zip
447 !ELSE
448         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
449                 gtk2 gtk2/gtk+-2.2.4-20040124.zip
450         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
451                 gtk2 gtk2/gtk+-dev-2.2.4-20040124.zip
452         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
453                 gtk2 gtk2/atk-1.4.0.zip
454         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
455                 gtk2 gtk2/atk-dev-1.4.0.zip
456 !ENDIF
457 !IF "$(PANGO_INST_VERSION)" == "1.4"
458         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
459                 gtk2 gtk2.4/pango-1.4.0.zip
460         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
461                 gtk2 gtk2.4/pango-dev-1.4.0.zip
462 !ELSE
463         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
464                 gtk2 gtk2/pango-1.2.5-20040124.zip
465         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
466                 gtk2 gtk2/pango-dev-1.2.5-20040124.zip
467 !ENDIF
468 !ENDIF
469 !IFDEF GTK_WIMP_DIR
470         @$(SH) tools\win32-setup.sh --download "$(ETHEREAL_LIBS)" \
471                 gtk-wimp gtk2/gtk-wimp-0.5.4-bin.zip
472 !ENDIF
473         @echo.
474         @echo Ethereal is ready to build.
475
476 update_plugin_api: config.h
477         cd plugins
478         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake xyzzy
479         cd ..
480