2 # Automake file for MATE Wireshark plugin
4 # Wireshark - Network traffic analyzer
5 # By Gerald Combs <gerald@wireshark.org>
6 # Copyright 1998 Gerald Combs
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License
10 # as published by the Free Software Foundation; either version 2
11 # of the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 include $(top_srcdir)/Makefile.am.inc
25 AM_CPPFLAGS = -I$(top_srcdir)
27 include Makefile.common
30 # XXX - how to make this apply only to clean files?
32 #if HAVE_WARNINGS_AS_ERRORS
36 plugindir = @plugindir@
38 plugin_LTLIBRARIES = mate.la
46 nodist_mate_la_SOURCES = \
48 $(NODIST_HEADER_FILES)
50 mate_la_LDFLAGS = -module -avoid-version
51 mate_la_LIBADD = @PLUGIN_LIBS@
53 # Libs must be cleared, or else libtool won't create a shared module.
54 # If your module needs to be linked against any particular libraries,
59 # Build plugin.c, which contains the plugin version[] string, a
60 # function plugin_register() that calls the register routines for all
61 # protocols, and a function plugin_reg_handoff() that calls the handoff
62 # registration routines for all protocols.
64 # We do this by scanning sources. If that turns out to be too slow,
65 # maybe we could just require every .o file to have an register routine
66 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
68 # Formatting conventions: The name of the proto_register_* routines an
69 # proto_reg_handoff_* routines must start in column zero, or must be
70 # preceded only by "void " starting in column zero, and must not be
73 # REGISTER_SRC_FILES is assumed to have all the files that need to be scanned.
75 # For some unknown reason, having a big "for" loop in the Makefile
76 # to scan all the files doesn't work with some "make"s; they seem to
77 # pass only the first few names in the list to the shell, for some
80 # Therefore, we have a script to generate the plugin.c file.
81 # The shell script runs slowly, as multiple greps and seds are run
82 # for each input file; this is especially slow on Windows. Therefore,
83 # if Python is present (as indicated by PYTHON being defined), we run
84 # a faster Python script to do that work instead.
86 # The first argument is the directory in which the source files live.
87 # The second argument is "plugin", to indicate that we should build
88 # a plugin.c file for a plugin.
89 # All subsequent arguments are the files to scan.
91 plugin.c: $(REGISTER_SRC_FILES) Makefile.common $(top_srcdir)/tools/make-dissector-reg \
92 $(top_srcdir)/tools/make-dissector-reg.py
93 @if test -n "$(PYTHON)"; then \
94 echo Making plugin.c with python ; \
95 $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
96 plugin $(REGISTER_SRC_FILES) ; \
98 echo Making plugin.c with shell script ; \
99 $(top_srcdir)/tools/make-dissector-reg $(srcdir) \
100 $(plugin_src) plugin $(REGISTER_SRC_FILES) ; \
104 # Currently plugin.c can be included in the distribution because
105 # we always build all protocol dissectors. We used to have to check
106 # whether or not to build the snmp dissector. If we again need to
107 # variably build something, making plugin.c non-portable, uncomment
108 # the dist-hook line below.
110 # Oh, yuk. We don't want to include "plugin.c" in the distribution, as
111 # its contents depend on the configuration, and therefore we want it
112 # to be built when the first "make" is done; however, Automake insists
113 # on putting *all* source into the distribution.
115 # We work around this by having a "dist-hook" rule that deletes
116 # "plugin.c", so that "dist" won't pick it up.
119 # @rm -f $(distdir)/plugin.c
127 $(NODIST_SRC_FILES) \
128 $(NODIST_HEADER_FILES)
130 MAINTAINERCLEANFILES = \
132 $(GENERATED_SRC_FILES) \
133 $(GENERATED_HEADER_FILES) \
145 RUNLEX = $(top_srcdir)/tools/runlex.sh
147 LEMON = $(top_builddir)/tools/lemon
149 mate_parser_lex.h : mate_parser.c
151 mate_parser.lo : mate_grammar.h
153 mate_grammar.h : mate_grammar.c
154 mate_grammar.c : mate_grammar.lemon mate.h mate_util.h $(LEMON)/lemon$(EXEEXT)
155 $(AM_V_LEMON)$(LEMON)/lemon$(EXEEXT) t=$(srcdir)/$(LEMON)/lempar.c $(srcdir)/mate_grammar.lemon || \
156 (rm -f grammar.c grammar.h ; false)
159 $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build \
160 -sourcedir=$(srcdir) \
161 $(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)