2 # nmake file for mate plugin
7 include ..\..\config.nmake
8 include moduleinfo.nmake
10 include Makefile.common
12 LEMON=..\..\tools\lemon
14 CFLAGS=/DHAVE_CONFIG_H /I../.. /I../../wiretap $(GLIB_CFLAGS) /I$(LEMON)\
15 /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)
18 $(CC) $(CFLAGS) -Fdmate.pdb -c $<
20 LDFLAGS = $(PLUGIN_LDFLAGS)
22 !IFDEF ENABLE_LIBWIRESHARK
23 LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wiretap\wiretap-$(WTAP_VERSION).lib
24 CFLAGS=/DHAVE_WIN32_LIBWIRESHARK_LIB /D_NEED_VAR_IMPORT_ $(CFLAGS)
26 DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
28 DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)
30 OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj
32 RESOURCE=$(PLUGIN_NAME).res
34 all: $(PLUGIN_NAME).dll
36 $(PLUGIN_NAME).rc : moduleinfo.nmake
37 sed -e s/@PLUGIN_NAME@/$(PLUGIN_NAME)/ \
38 -e s/@RC_MODULE_VERSION@/$(RC_MODULE_VERSION)/ \
39 -e s/@RC_VERSION@/$(RC_VERSION)/ \
40 -e s/@MODULE_VERSION@/$(MODULE_VERSION)/ \
41 -e s/@PACKAGE@/$(PACKAGE)/ \
42 -e s/@VERSION@/$(VERSION)/ \
45 $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE)
46 link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
47 $(GLIB_LIBS) $(RESOURCE)
49 # Build plugin.c, which contains the plugin version[] string, a
50 # function plugin_register() that calls the register routines for all
51 # protocols, and a function plugin_reg_handoff() that calls the handoff
52 # registration routines for all protocols.
54 # We do this by scanning sources. If that turns out to be too slow,
55 # maybe we could just require every .o file to have an register routine
56 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
58 # Formatting conventions: The name of the proto_register_* routines an
59 # proto_reg_handoff_* routines must start in column zero, or must be
60 # preceded only by "void " starting in column zero, and must not be
63 # DISSECTOR_SRC is assumed to have all the files that need to be scanned.
65 # For some unknown reason, having a big "for" loop in the Makefile
66 # to scan all the files doesn't work with some "make"s; they seem to
67 # pass only the first few names in the list to the shell, for some
70 # Therefore, we have a script to generate the plugin.c file.
71 # The shell script runs slowly, as multiple greps and seds are run
72 # for each input file; this is especially slow on Windows. Therefore,
73 # if Python is present (as indicated by PYTHON being defined), we run
74 # a faster Python script to do that work instead.
76 # The first argument is the directory in which the source files live.
77 # The second argument is "plugin", to indicate that we should build
78 # a plugin.c file for a plugin.
79 # All subsequent arguments are the files to scan.
81 plugin.c: $(DISSECTOR_SRC)
83 @echo Making plugin.c (using python)
84 @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC)
86 @echo Making plugin.c (using sh)
87 @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC)
93 rm -f $(OBJECTS) $(RESOURCE) plugin.c *.pdb \
94 $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \
95 $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc
97 # We remove the generated files with "distclean" because one of them,
98 # "mate_parser.c", needs different #includes for UN*X and Windows
99 # (UN*X versions of Flex make it include <unistd.h>, but that's a
100 # UN*X-only header), so if you're going to build from source, you need
101 # to build "mate_parser.c" from "mate_parser.l" with Flex.
102 # This might not be necessary for "mate_grammar.{c,h}", but we handle them
106 rm -f mate_parser.c mate_grammar.c mate_grammar.h mate_grammar.out
108 maintainer-clean: distclean
110 mate_parser.c : mate_parser.l
111 $(LEX) -Pdf_ -omate_parser.c mate_parser.l
113 mate_grammar.h : mate_grammar.c
114 mate_grammar.c : mate_grammar.lemon $(LEMON)\lemon.exe
115 $(LEMON)\lemon.exe t=$(LEMON)\lempar.c mate_grammar.lemon
119 $(MAKE) /$(MAKEFLAGS) -f makefile.nmake
120 cd ../../plugins/mate