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