MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / plugins / mate / Makefile.nmake
blobf16846b0b26abcacc8aff3e54f537b79d5432a66
1 # Makefile.nmake
2 # nmake file for mate plugin
4 # $Id$
7 include ..\..\config.nmake
8 include ..\..\Makefile.nmake.inc
10 include moduleinfo.nmake
12 include Makefile.common
14 LEMON=..\..\tools\lemon
16 # We use DIRTY_CFLAGS to get around flex's non-LLP64-compliant output
17 DIRTY_CFLAGS=\
18         $(STANDARD_CFLAGS) \
19         /I../.. $(GLIB_CFLAGS) /I$(LEMON) \
20         /I$(PCAP_DIR)\include
22 CFLAGS=$(WARNINGS_ARE_ERRORS) $(DIRTY_CFLAGS)
24 .c.obj::
25         $(CC) $(CFLAGS) -Fd.\ -c $<
27 LDFLAGS = $(PLUGIN_LDFLAGS)
29 !IFDEF ENABLE_LIBWIRESHARK
30 LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib
31 CFLAGS=$(CFLAGS)
33 OBJECTS = $(C_FILES:.c=.obj) $(CPP_FILES:.cpp=.obj) plugin.obj
35 RESOURCE=$(PLUGIN_NAME).res
37 all: $(PLUGIN_NAME).dll
39 $(PLUGIN_NAME).rc : moduleinfo.nmake
40         sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \
41         -e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \
42         -e s/@RC_VERSION@/$(RC_VERSION)/ \
43         -e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \
44         -e s/@PACKAGE@/$(PACKAGE)/ \
45         -e s/@VERSION@/$(VERSION)/ \
46         -e s/@MSVC_VARIANT@/$(MSVC_VARIANT)/ \
47         < plugin.rc.in > $@
49 $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE)
50         link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
51         $(GLIB_LIBS) $(RESOURCE)
54 # Build plugin.c, which contains the plugin version[] string, a
55 # function plugin_register() that calls the register routines for all
56 # protocols, and a function plugin_reg_handoff() that calls the handoff
57 # registration routines for all protocols.
59 # We do this by scanning sources.  If that turns out to be too slow,
60 # maybe we could just require every .o file to have an register routine
61 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
63 # Formatting conventions:  The name of the proto_register_* routines an
64 # proto_reg_handoff_* routines must start in column zero, or must be
65 # preceded only by "void " starting in column zero, and must not be
66 # inside #if.
68 # REGISTER_SRC_FILES is assumed to have all the files that need to be scanned.
70 # For some unknown reason, having a big "for" loop in the Makefile
71 # to scan all the files doesn't work with some "make"s; they seem to
72 # pass only the first few names in the list to the shell, for some
73 # reason.
75 # Therefore, we have a script to generate the plugin.c file.
76 # The shell script runs slowly, as multiple greps and seds are run
77 # for each input file; this is especially slow on Windows.  Therefore,
78 # if Python is present (as indicated by PYTHON being defined), we run
79 # a faster Python script to do that work instead.
81 # The first argument is the directory in which the source files live.
82 # The second argument is "plugin", to indicate that we should build
83 # a plugin.c file for a plugin.
84 # All subsequent arguments are the files to scan.
86 !IFDEF PYTHON
87 plugin.c: $(REGISTER_SRC_FILES) moduleinfo.h Makefile.common ../../tools/make-dissector-reg.py
88         @echo Making plugin.c (using python)
89         @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(REGISTER_SRC_FILES) $(NODIST_REGISTER_SRC_FILES)
90 !ELSE
91 plugin.c: $(REGISTER_SRC_FILES) moduleinfo.h Makefile.common ../../tools/make-dissector-reg
92         @echo Making plugin.c (using sh)
93         @$(SH) ../../tools/make-dissector-reg . plugin $(REGISTER_SRC_FILES) $(NODIST_REGISTER_SRC_FILES)
94 !ENDIF
96 !ENDIF
98 clean:
99         rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb *.sbr \
100             $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
101             $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
104 # We remove the Flex-generated files with "distclean" because files
105 # generated by Flex need different #includes for UN*X and Windows (UN*X
106 # versions of Flex make it include <unistd.h>, but that's a UN*X-only
107 # header), so if you're going to build from source, you need to re-generate
108 # the files from the distribution that were generated by Flex.
110 distclean: clean
111         rm -f $(FLEX_GENERATED_SRC_FILES) \
112                 $(FLEX_GENERATED_HEADER_FILES) \
113                 $(NODIST_SRC_FILES) \
114                 $(NODIST_HEADER_FILES) \
115                 mate_grammar.out
117 maintainer-clean: distclean
118         rm -f $(GENERATED_SRC_FILES) \
119                 $(GENERATED_HEADER_FILES)
121 RUNLEX = ..\..\tools\runlex.sh
124 # In order to generate mate_parser_lex.h, we need to run Flex on
125 # mate_parser.l; that's done by generating mate_parser.c.
127 mate_parser_lex.h : mate_parser.c
130 # We compile this specially because it's Flex-generated and thus
131 # "warnings are errors" will fail because there's a bunch of
132 # warnings we can't eliminate.
134 # It depends on mate_grammar.h to force mate_grammar.h to be
135 # built before we try to compile it, as mate_parser.c includes
136 # mate_grammar.h, and mate_grammar.h is not distributed with
137 # the source (it's generated with Lemon).  That means we can't
138 # use $?, as that would make it try to compile mate_grammar.h.
140 mate_parser.obj : mate_grammar.h
141 mate_parser.obj : mate_parser.c
142         $(CC) $(DIRTY_CFLAGS) -Fd.\ -c mate_parser.c
144 mate_grammar.h : mate_grammar.c
145 mate_grammar.c : mate_grammar.lemon $(LEMON)\lemon.exe
146         $(LEMON)\lemon.exe t=$(LEMON)\lempar.c mate_grammar.lemon
148 $(LEMON)\lemon.exe:
149         cd ../../tools
150         $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake lemon
151         cd ../plugins/mate
153 checkapi:
154         $(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput -build \
155                 $(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)