2 # Include file with common automake definitions for plugins
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.
25 PLUGIN_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS) $(GLIB_CFLAGS)
29 PLUGIN_LDFLAGS = -module -avoid-version
32 # Source files are divided up along several axes:
34 # C vs. C++ - this is used on Windows to generated lists of object files
35 # with .c=.obj or .cpp=.obj
37 # Register vs. non-register - register files are scanned for registration
38 # functions, non-register files aren't.
40 # Flex-generated, Lemon-generated, and non-generated:
42 # we distribute non-generated files, as they're part of the source,
43 # and distribute Flex-generated files, as we don't require that
44 # people have Flex installed and don't distribute it ourself and
45 # thus can't guarantee that we can run Flex in the build process,
46 # but we don't distribute Lemon-generated files, as we distribute
47 # Lemon and can run it in the build process;
49 # "make maintainer-clean" on UN*X remove all generated files;
51 # "make distclean" on UN*X removes Lemon-generated files, as they're
52 # not in the distribution, but not Flex-generated files, as they
53 # are in the distribution;
55 # "make distclean" on Windows removes both Lemon-generated and
56 # Flex-generated files, as the Flex-generated files in the
57 # distribution were generated by Flex on UN*X, and won't compile
60 # Flex-generated files can't be built with full warnings
61 # turned on, and can't be run through the checkAPI scripts,
62 # as they generate code that won't pass (we've tweaked
63 # Lemon to generate code that will pass).
67 # All source files to be scanned for registration routines.
69 REGISTER_SRC_FILES = \
70 $(FLEX_GENERATED_REGISTER_C_FILES) \
71 $(FLEX_GENERATED_REGISTER_CPP_FILES) \
72 $(LEMON_GENERATED_REGISTER_C_FILES) \
73 $(LEMON_GENERATED_REGISTER_CPP_FILES) \
74 $(NONGENERATED_REGISTER_C_FILES) \
75 $(NONGENERATED_REGISTER_CPP_FILES)
78 # All distributed source files.
81 $(FLEX_GENERATED_C_FILES) \
82 $(FLEX_GENERATED_CPP_FILES) \
83 $(NONGENERATED_C_FILES) \
84 $(NONGENERATED_CPP_FILES)
87 # All non-distributed source files.
90 $(LEMON_GENERATED_C_FILES) \
91 $(LEMON_GENERATED_CPP_FILES)
94 # All non-distributed header files.
96 NODIST_HEADER_FILES = \
97 $(LEMON_GENERATED_HEADER_FILES)
100 # All Flex-generated source files.
102 FLEX_GENERATED_SRC_FILES = \
103 $(FLEX_GENERATED_C_FILES) \
104 $(FLEX_GENERATED_CPP_FILES)
107 # All Lemon-generated source files.
109 LEMON_GENERATED_SRC_FILES = \
110 $(LEMON_GENERATED_C_FILES) \
111 $(LEMON_GENERATED_CPP_FILES)
114 # All generated source files.
116 GENERATED_SRC_FILES = \
117 $(FLEX_GENERATED_SRC_FILES) \
118 $(LEMON_GENERATED_SRC_FILES)
121 # All generated header files.
123 GENERATED_HEADER_FILES = \
124 $(FLEX_GENERATED_HEADER_FILES) \
125 $(LEMON_GENERATED_HEADER_FILES)
128 # All "clean" source files; they can be compiled with the regular
129 # warning options, including -Werror with GCC-compatible compilers,
130 # and can be run through checkAPI. Neither Flex-generated nor
131 # Lemon-generated files can currently be guaranteed to be clean.
134 $(NONGENERATED_C_FILES) \
135 $(NONGENERATED_CPP_FILES)
139 $(FLEX_GENERATED_C_FILES) \
140 $(LEMON_GENERATED_C_FILES) \
141 $(NONGENERATED_C_FILES)
145 $(FLEX_GENERATED_CPP_FILES) \
146 $(LEMON_GENERATED_CPP_FILES) \
147 $(NONGENERATED_CPP_FILES)
150 # Build plugin.c, which contains the plugin version[] string, a
151 # function plugin_register() that calls the register routines for all
152 # protocols, and a function plugin_reg_handoff() that calls the handoff
153 # registration routines for all protocols.
155 # We do this by scanning sources. If that turns out to be too slow,
156 # maybe we could just require every .o file to have an register routine
157 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
159 # Formatting conventions: The name of the proto_register_* routines an
160 # proto_reg_handoff_* routines must start in column zero, or must be
161 # preceded only by "void " starting in column zero, and must not be
164 # REGISTER_SRC_FILES is assumed to have all the files that need to be scanned.
166 # For some unknown reason, having a big "for" loop in the Makefile
167 # to scan all the files doesn't work with some "make"s; they seem to
168 # pass only the first few names in the list to the shell, for some
171 # Therefore, we use a script to generate the register.c file.
172 # The first argument is the directory in which the source files live.
173 # The second argument is "plugin", to indicate that we should build
174 # a plugin.c file for a plugin.
175 # All subsequent arguments are the files to scan.
177 plugin.c: $(REGISTER_SRC_FILES) $(top_srcdir)/tools/make-dissector-reg.py
178 @echo Making plugin.c
179 @$(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
180 plugin $(REGISTER_SRC_FILES)
183 # Currently plugin.c can be included in the distribution because
184 # we always build all protocol dissectors. We used to have to check
185 # whether or not to build the snmp dissector. If we again need to
186 # variably build something, making plugin.c non-portable, uncomment
187 # the dist-hook line below.
189 # Oh, yuk. We don't want to include "plugin.c" in the distribution, as
190 # its contents depend on the configuration, and therefore we want it
191 # to be built when the first "make" is done; however, Automake insists
192 # on putting *all* source into the distribution.
194 # We work around this by having a "dist-hook" rule that deletes
195 # "plugin.c", so that "dist" won't pick it up.
198 # @rm -f $(distdir)/plugin.c
201 $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build \
202 -sourcedir=$(srcdir) \
203 $(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)