wireshark/Makefile.nmake

442 lines
12 KiB
Makefile
Raw Normal View History

## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
#
# $Id: Makefile.nmake,v 1.397 2004/01/24 20:01:35 ulfl Exp $
include config.nmake
include <win32.mak>
############### 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_SRC = \
tap-ansi_astat.c \
tap-bootpstat.c \
tap-dcerpcstat.c \
tap-gsm_astat.c \
tap-h225counter.c \
tap-h225rassrt.c \
tap-httpstat.c \
tap-iostat.c \
tap-iousers.c \
tap-mgcpstat.c \
tap-protocolinfo.c \
tap-protohierstat.c \
tap-rpcstat.c \
tap-rpcprogs.c \
tap-smbsids.c \
tap-smbstat.c \
tap-wspstat.c
TETHEREAL_TAP_OBJECTS = $(TETHEREAL_TAP_SRC:.c=.obj)
DISSECTOR_SUPPORT_OBJECTS = \
adler32.obj \
There is really no need to have the BGP dissector and the LDP dissector have two independent "value_string" tables mapping RFC 1700 address family numbers to names, nor is there any need to have the BGP dissector and the PIM dissector have two independent sets of #defines for RFC 1700 address family numbers; put a single "value_string" table in "afn.c" and put a declaration of it, and #defines for the address family numbers, into "afn.h", and have the dissectors use that. Move the #define for PGM into "ipproto.h", and add an entry for it in the "value_string" table in "ipproto.c". Have the PGM dissector use the standard Ethereal mechanisms for resolving addresses, and have it use "value_string" tables for mapping option types, the OPX bits, and packet types to strings. Use "bytes_to_str()" to turn byte arrays into strings of hex digits. Pass the packet type string to "dissect_pgmopts()" as an argument, rather than making it a global. Don't use "proto_tree_add_XXX_format" routines if you can possibly just use "proto_tree_add_XXX"; give various fields the correct radix and type, and VALS() strings if necessary, to make that happen (and to make filtering on them more pleasant). Put the type, length, and total length of the options into the protocol tree as separate fields. Don't have separate type, length, and OPX fields for every type of option; one field will suffice. Don't format a string with "sprintf()" and then pass that string to "col_add_fstr()" with a format of "%s" and the string as an argument - "col_add_fstr()" can format strings itself (that's what the "f" stands for). Don't byte-swap and then un-byte-swap IPv4 address fields in the header, just leave them network byte order to start with. Use the correct fields for "proto_tree_add_XXX", rather than using the same field multiple times. Quit early if an address family identifier isn't AFNUM_INET, as that means the structure we use to dissect the header doesn't match the actual header. svn path=/trunk/; revision=3761
2001-07-21 10:27:13 +00:00
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
BUILT_SOURCES = \
cvsversion.h \
x11-declarations.h \
x11-register-info.h
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) \
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) \
$(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) \
$(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)
randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
user32.lib \
$(GLIB_LIBS) \
$(NET_SNMP_DIR)\win32\lib\netsnmp.lib
EXECUTABLES=ethereal.exe ethereal2.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
$(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
ethereal2.exe :
!ELSE
ethereal2.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:ethereal2.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 <x11-fields
packet-ncp2222.c : ncp2222.py
!IFDEF PYTHON
@echo Making packet-ncp2222.c
$(PYTHON) ncp2222.py -o packet-ncp2222.c
!ELSE
@echo Faking packet-ncp2222.c...
@echo Python is required to build the NCP disector
@echo Hiding packet-ncp.c...
mv packet-ncp.c packet-ncp.c.save
touch packet-ncp.c $@
!ENDIF
#
# Build "register.c", which contains a function "register_all_protocols()"
# that calls the register routines for all protocols.
#
# We do this by grepping through sources. If that turns out to be too slow,
# maybe we could just require every .o file to have an register routine
# of a given name (packet-aarp.o -> 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::
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 ..