## Makefile for building ethereal.exe with Microsoft C and nmake ## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake # # $Id: Makefile.nmake,v 1.405 2004/02/18 20:45:54 gerald Exp $ include config.nmake include ############### no need to modify below this line ######### CC = cl LINK= link LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS) CFLAGS=-DHAVE_CONFIG_H $(LOCAL_CFLAGS) $(GLIB_CFLAGS) /I. /Iwiretap \ $(ZLIB_CFLAGS) /I$(PCAP_DIR)\include \ /I$(NET_SNMP_DIR)\include /I$(NET_SNMP_DIR)\win32 \ $(ADNS_CFLAGS) $(PCRE_CFLAGS) -D_U_="" CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL .c.obj:: $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $< include Makefile.common DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) TETHEREAL_TAP_OBJECTS = $(TETHEREAL_TAP_SRC:.c=.obj) DISSECTOR_SUPPORT_OBJECTS = \ adler32.obj \ afn.obj \ asn1.obj \ column.obj \ crc32.obj \ crypt-des.obj \ crypt-md4.obj \ crypt-md5.obj \ crypt-rc4.obj \ follow.obj \ g711.obj \ h225-persistentdata.obj \ in_cksum.obj \ ipproto.obj \ packet-dcerpc-nt.obj \ prefs.obj \ ptvcursor.obj \ reassemble.obj \ req_resp_hdrs.obj \ t35.obj \ tap.obj \ util.obj \ xdlc.obj \ xmlstub.obj ETHEREAL_COMMON_OBJECTS = \ $(DISSECTOR_SUPPORT_OBJECTS) \ capture_stop_conditions.obj \ capture-wpcap.obj \ cfile.obj \ conditions.obj \ disabled_protos.obj \ getopt.obj \ pcap-util.obj \ print.obj \ ps.obj \ range.obj \ register.obj \ ringbuffer.obj \ timestats.obj \ version_info.obj ethereal_OBJECTS = \ $(DISSECTOR_OBJECTS) \ $(ETHEREAL_COMMON_OBJECTS) \ alert_box.obj \ capture.obj \ file.obj \ filters.obj \ proto_hier_stats.obj \ summary.obj tethereal_OBJECTS = \ $(DISSECTOR_OBJECTS) \ $(ETHEREAL_COMMON_OBJECTS) \ $(TETHEREAL_TAP_OBJECTS) \ tethereal-tap-register.obj \ tethereal.obj dftest_OBJECTS = \ $(DISSECTOR_OBJECTS) \ $(DISSECTOR_SUPPORT_OBJECTS) \ dftest.obj randpkt_OBJECTS = \ randpkt.obj EXTRA_OBJECTS = \ # snprintf.obj \ # strerror.obj \ mkstemp.obj \ strptime.obj ethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ epan\ethereal.lib \ epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \ wsock32.lib user32.lib \ $(ADNS_LIBS) \ $(PCRE_LIBS) \ $(ZLIB_LIBS) \ $(NET_SNMP_DIR)\win32\lib\netsnmp.lib # $(PCAP_DIR)\lib\wpcap.lib tethereal_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ epan\ethereal.lib \ epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \ wsock32.lib user32.lib \ $(GLIB_LIBS) \ $(ADNS_LIBS) \ $(PCRE_LIBS) \ $(ZLIB_LIBS) \ $(NET_SNMP_DIR)\win32\lib\netsnmp.lib editcap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wsock32.lib user32.lib \ $(GLIB_LIBS) mergecap_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ wsock32.lib user32.lib \ $(GLIB_LIBS) dftest_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib epan\ethereal.lib \ epan\dfilter\dfilter.lib epan\ftypes\ftypes.lib \ wsock32.lib user32.lib \ wiretap\wiretap-$(WTAP_VERSION).lib \ $(GLIB_LIBS) \ $(PCRE_LIBS) \ $(ZLIB_LIBS) randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \ user32.lib \ $(GLIB_LIBS) \ $(NET_SNMP_DIR)\win32\lib\netsnmp.lib EXECUTABLES=ethereal.exe ethereal-gtk2.exe tethereal.exe editcap.exe mergecap.exe text2pcap.exe RESOURCES=image\ethereal.res image\tethereal.res image\editcap.res image\mergecap.res image\text2pcap.res all: tools wiretap epan image $(EXECUTABLES) $(RESOURCES) doc packaging: all cd packaging cd nsis nmake -f makefile.nmake cd .. cd .. seperate_packaging: all cd packaging cd nsis !IFDEF GTK1_DIR nmake -f makefile.nmake GTK1_ONLY="USE" !ENDIF !IFDEF GTK2_DIR nmake -f makefile.nmake GTK2_ONLY="USE" !ENDIF cd .. cd .. $(RESOURCES): image wiretap\wiretap-$(WTAP_VERSION).lib: wiretap !IFNDEF GTK1_DIR ethereal.exe : !ELSE ethereal.exe : config.h cvsversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk\libui.lib plugins @echo Linking $@ $(LINK) @<< /OUT:ethereal.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(ethereal_LIBS) $(GTK1_LIBS) gtk\libui.lib $(ethereal_OBJECTS) $(EXTRA_OBJECTS) image\ethereal.res << !ENDIF !IFNDEF GTK2_DIR ethereal-gtk2.exe : !ELSE ethereal-gtk2.exe : config.h cvsversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk2 image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk2.tmp\libui.lib plugins @echo Linking $@ $(LINK) @<< /OUT:ethereal-gtk2.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(ethereal_LIBS) $(GTK2_LIBS) gtk2.tmp\libui.lib $(ethereal_OBJECTS) $(EXTRA_OBJECTS) image\ethereal.res << !ENDIF tethereal.exe : config.h cvsversion.h $(tethereal_OBJECTS) $(EXTRA_OBJECTS) epan image\tethereal.res wiretap\wiretap-$(WTAP_VERSION).lib plugins @echo Linking $@ $(LINK) @<< /OUT:tethereal.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(tethereal_LIBS) $(tethereal_OBJECTS) $(EXTRA_OBJECTS) image\tethereal.res << editcap.exe : config.h editcap.obj getopt.obj wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res @echo Linking $@ $(LINK) @<< /OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console editcap.obj getopt.obj $(editcap_LIBS) image\editcap.res << mergecap.exe : config.h cvsversion.h mergecap.obj getopt.obj wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res @echo Linking $@ $(LINK) @<< /OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj getopt.obj $(mergecap_LIBS) image\mergecap.res << text2pcap.exe : config.h text2pcap.obj text2pcap-scanner.obj getopt.obj strptime.obj image\text2pcap.res @echo Linking $@ $(LINK) @<< /OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj getopt.obj strptime.obj image\text2pcap.res << dftest.exe : $(dftest_OBJECTS) $(EXTRA_OBJECTS) $(LINK) @<< /OUT:dftest.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dftest_LIBS) $(dftest_OBJECTS) $(EXTRA_OBJECTS) << randpkt.exe : $(randpkt_OBJECTS) $(EXTRA_OBJECTS) $(LINK) @<< /OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS) << config.h : config.h.win32 config.nmake sed -e s/@VERSION@/$(VERSION)/ \ -e "s/@HAVE_GNU_ADNS@/$(ADNS_CONFIG)/" \ -e "s/@HAVE_PCRE@/$(PCRE_CONFIG)/" \ -e "s/@HAVE_LIBZ@/$(ZLIB_CONFIG)/" \ -e "s/@HAVE_LIBPCAP@/$(WINPCAP_CONFIG)/" \ -e "s/@HAVE_PCAP_FINDALLDEVS@/$(PCAP_FINDALLDEVS_CONFIG)/" \ -e "s/@WPCAP_CONSTIFIED@/$(WPCAP_CONSTIFIED_CONFIG)/" \ < config.h.win32 > $@ ps.c : rdps.exe print.ps rdps print.ps ps.c # # Build the version string # cvsversion.h: $(PERL) make-version.pl # # The header files listed here are built from x11-fields using Perl; # we declare a dependency here so that they get built. # packet-x11.obj : packet-x11.c x11-declarations.h x11-register-info.h # # Build various header files for the X11 dissector. # x11-declarations.h x11-register-info.h: x11-fields process-x11-fields.pl $(PERL) process-x11-fields.pl proto_register_aarp, etc.). # # Formatting conventions: The name of the proto_register_* routines must # start in column zero, or must be preceded only by "void " starting in # column zero, and must not be inside #if. # # We assume that all dissector routines are in "packet-XXX.c" files. # # For some unknown reason, having a big "for" loop in the Makefile # to scan all the "packet-XXX.c" files doesn't work with some "make"s; # they seem to pass only the first few names in the list to the shell, # for some reason. # # Therefore, we have a script to generate the "register.c" file. # # The first argument is the name of the file to write. # The second argument is the directory in which the source files live. # All subsequent arguments are the files to scan. # # On Windows, however, that script runs slowly, as multiple greps # and seds are run for each input file, so, if Python is present # (as indicated by PYTHON being defined), we run a faster Python # script to do that work instead. That script doesn't take the name # of the file to write as an argument; it always writes to # "register.c". # register.c: $(DISSECTOR_SRC) !IFDEF PYTHON @echo Making register.c (using python) @$(PYTHON) make-reg-dotc.py . $(DISSECTOR_SRC) !ELSE @echo Making register.c (using sh) @$(SH) make-reg-dotc register.c . $(DISSECTOR_SRC) !ENDIF # # Build "tethereal-tap-register.c", which contains a function # "register_all_tap_listeners()" # that calls the register routines for all tehtereal tap listeners. # # We do this by grepping through sources. # # Formatting conventions: The name of the tap_listener_register_* # routines must start in column zero, or must be preceded only by # "void " starting in column zero, and must not be inside #if. # # The first argument is the name of the file to write. # The second argument is the directory in which the source files live. # All subsequent arguments are the files to scan. # tethereal-tap-register.c: $(TETHEREAL_TAP_SRC) make-tapreg-dotc @echo Making tethereal-tap-register.c @$(SH) make-tapreg-dotc tethereal-tap-register.c . $(TETHEREAL_TAP_SRC) text2pcap-scanner.c : text2pcap-scanner.l $(LEX) -otext2pcap-scanner.c text2pcap-scanner.l gtk2_distclean: rm -f gtk2.tmp/*.* if exist gtk2.tmp rmdir gtk2.tmp clean: gtk2_distclean rm -f $(ethereal_OBJECTS) $(tethereal_OBJECTS) $(EXTRA_OBJECTS) \ $(EXECUTABLES) $(PDB_FILE) \ editcap.obj mergecap.obj text2pcap.obj \ text2pcap-scanner.obj text2pcap-scanner.c rdps.obj \ rdps.pdb config.h ps.c \ rdps.exe rdps.ilk dftest.obj dftest.exe randpkt.obj randpkt.ext \ $(RESOURCES) cd wiretap $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../gtk $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../epan $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../plugins $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../tools $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../image $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../doc $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../help $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../packaging/nsis $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake clean cd ../.. # Call distclean only, if you would like to remove ALL generated files. # Be sure to have python and perl installed to regenerate them. distclean: clean gtk2_distclean rm -f $(BUILT_SOURCES) \ packet-ncp2222.c register.c tethereal-tap-register.c cd wiretap $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../gtk $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../epan $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../plugins $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../tools $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../image $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../doc $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../help $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../packaging/nsis $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake distclean cd ../.. tools:: cd tools $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd .. image:: cd image $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd .. wiretap:: cd wiretap $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd .. gtk:: help config.h cvsversion.h cd gtk $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake GTK_CFLAGS="$(GTK1_CFLAGS)" GTK_LIBS="$(GTK1_LIBS)" libui.lib cd .. # copy all required files to gtk2.tmp (but only when newer than existing) and compile in that dir gtk2:: help config.h cvsversion.h if not exist gtk2.tmp mkdir gtk2.tmp cd gtk cp --update --preserve Makefile.* *.c *.h ..\gtk2.tmp cd ..\gtk2.tmp $(MAKE) /$(MAKEFLAGS) /f Makefile.nmake GTK_CFLAGS="$(GTK2_CFLAGS)" GTK_LIBS="$(GTK2_LIBS)" libui.lib cd .. epan:: cd epan $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd .. plugins:: cd plugins $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd .. doc:: cd doc $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd .. help:: cd help $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake cd ..