354df4a2f27eb09f92b3ef1133217081c40f40f4
[metze/wireshark/wip.git] / epan / dissectors / 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
8 ############### no need to modify below this line #########
9
10 include Custom.nmake
11
12 include Makefile.common
13
14 CFLAGS=-WX -DHAVE_CONFIG_H /I. /I.. /I../.. $(GLIB_CFLAGS) \
15         $(ZLIB_CFLAGS) \
16         $(PCRE_CFLAGS) $(GNUTLS_CFLAGS) $(NETTLE_CFLAGS) \
17         $(KFW_CFLAGS) $(AIRPCAP_CFLAGS) $(GEOIP_CFLAGS) \
18         /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
19
20 CVARSDLL=-DWIN32 -DNULL=0 -D_MT -D_DLL
21
22 .c.obj::
23    $(CC) $(CVARSDLL) $(CFLAGS) -Fd.\ -c $<
24
25 DISSECTOR_OBJECTS = \
26         $(ALL_DISSECTORS_SRC:.c=.obj)
27
28 DISSECTOR_SUPPORT_OBJECTS = \
29         $(DISSECTOR_SUPPORT_SRC:.c=.obj)
30
31 dissectors.lib: register.obj packet-ncp2222.c $(GENERATED_HEADER_FILES) ../../config.h $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS)
32         @echo Linking dissectors.lib $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS)
33         link /lib /out:dissectors.lib $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS)
34
35 !IF "$(MSVC_VARIANT)" != "MSVC2005EE" && "$(MSVC_VARIANT)" != "MSVC2005" && "$(MSVC_VARIANT)" != "MSVC2008EE" && "$(MSVC_VARIANT)" != "MSVC2008"
36 # Disable debug for large dissectors
37 packet-rrc.obj : packet-rrc.c
38    $(CC) $(CVARSDLL) $(CFLAGS) /Zd /Fd.\ -c $?
39 !ENDIF
40
41 #
42 # Build register.c, which contains a function register_all_protocols()
43 # that calls the register routines for all protocols and a function
44 # register_all_protocol_handoffs() that calls the handoff registration
45 # routines for all protocols.
46 #
47 # We do this by scanning through sources.  If that turns out to be too slow,
48 # maybe we could just require every .o file to have an register routine
49 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
50 #
51 # Formatting conventions:  The name of the proto_register_* routines and
52 # proto_reg_handoff_* routines must start in column zero, or must be
53 # preceded only by "void " starting in column zero, and must not be
54 # inside #if.
55 #
56 # DISSECTOR_SRC is assumed to have all the files that need to be scanned.
57 #
58 # For some unknown reason, having a big "for" loop in the Makefile
59 # to scan all the files doesn't work with some "make"s; they seem to
60 # pass only the first few names in the list to the shell, for some
61 # reason.
62 #
63 # Therefore, we have a script to generate the register.c file.
64 # The shell script runs slowly, as multiple greps and seds are run
65 # for each input file; this is especially slow on Windows.  Therefore,
66 # if Python is present (as indicated by PYTHON being defined), we run
67 # a faster Python script to do that work instead.
68 #
69 # The first argument is the directory in which the source files live.
70 # The second argument is "dissectors", to indicate that we should build
71 # a register.c file for libwireshark.
72 # All subsequent arguments are the files to scan.
73 #
74
75 register.c: $(ALL_DISSECTORS_SRC)
76 !IFDEF PYTHON
77         @echo Making register.c (using python)
78         @$(PYTHON) "../../tools/make-dissector-reg.py" . dissectors $(ALL_DISSECTORS_SRC)
79 !ELSE
80         @echo Making register.c (using sh)
81         @$(SH) ../../tools/make-dissector-reg . dissectors $(ALL_DISSECTORS_SRC) \
82 !ENDIF
83
84 packet-ncp2222.c : ..\..\tools/ncp2222.py
85 !IFDEF PYTHON
86         @echo Making packet-ncp2222.c
87         $(PYTHON) "../../tools/ncp2222.py" -o packet-ncp2222.c
88 !ELSE
89         @echo Faking packet-ncp2222.c...
90         @echo Python is required to build the NCP disector
91         @echo Hiding packet-ncp.c...
92         mv packet-ncp.c packet-ncp.c.save
93         touch packet-ncp.c $@
94 !ENDIF
95
96 packet-ncp2222.obj: packet-ncp2222.inc
97
98 # Target to rebuild the X11 dissector header files.
99 # See README.X11 before using this--it requires the xcb and mesa source.
100 x11-dissector: ..\..\tools/process-x11-fields.pl x11-fields ..\..\tools/process-x11-xcb.pl
101         $(PERL) ../../tools/process-x11-fields.pl < x11-fields
102         $(PERL) ../../tools/process-x11-xcb.pl
103
104 clean:
105         rm -f dissectors.lib *.pdb register.c-tmp register-cache.pkl \
106                 $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS)
107
108 distclean: clean
109
110 maintainer-clean: distclean
111         rm -f $(GENERATED_FILES)
112
113 checkapi:
114         $(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput \
115                 $(ALL_DISSECTORS_SRC) \
116                 packet-dcerpc-nt.c