diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-02-05 21:10:56 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-02-05 21:10:56 +0000 |
commit | c521263a6bbffdb27520aba64ee4ba06c3a4953e (patch) | |
tree | ad10382e8ed8434d830bf4a5f9b6aead0e79780d | |
parent | 37146b8bfd465215ea0d1c9e2a8ec38de6f18cd1 (diff) |
Put NODIST_ at the beginning of macros containing NODIST, paralleling
the nodist_ convention for Automake variables.
Regularize the lists of source files, dividing them according to several
attributes. Build composite lists in a plugins/Makefile.common.inc
file, to be included by plugin Makefile.common files, and use the
composite lists as appropriate in Makefile.am and Makefile.nmake.
svn path=/trunk/; revision=47502
-rw-r--r-- | plugins/Makefile.am | 1 | ||||
-rw-r--r-- | plugins/Makefile.common.inc | 115 | ||||
-rw-r--r-- | plugins/mate/Makefile.am | 34 | ||||
-rw-r--r-- | plugins/mate/Makefile.common | 47 | ||||
-rw-r--r-- | plugins/mate/Makefile.nmake | 57 |
5 files changed, 203 insertions, 51 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 7d4dc05543..32096ac397 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -43,6 +43,7 @@ plugindir = @plugindir@ EXTRA_DIST = \ $(_CUSTOM_EXTRA_DIST_) \ plugins.vcproj \ + Makefile.common.inc \ Makefile.nmake \ Custom.make.example \ Custom.m4.example \ diff --git a/plugins/Makefile.common.inc b/plugins/Makefile.common.inc new file mode 100644 index 0000000000..191dd29d0b --- /dev/null +++ b/plugins/Makefile.common.inc @@ -0,0 +1,115 @@ +# +# Common definitions for plugin Makefile.common files +# +# $Id$ +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# Copyright 1998 Gerald Combs +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# +# Source files are divided up along several axes: +# +# C vs. C++ - this is used on Windows to generated lists of object files +# with .c=.obj or .cpp=.obj +# +# Dissector vs. non-dissector - dissector files are scanned for +# registration functions, non-dissector files aren't. +# +# Generated and distributed, generated and not distributed, and not +# generated - "make maintainer-clean" on UN*X and "nmake distclean" +# on Windows remove all generated files, "make distclean" on UN*X +# removes all not-distributed generated files, and non-distributed +# generated files aren't put into the distribution. +# + +# +# All distributed generated dissector source files. +# +GENERATED_DISSECTOR_SRC_FILES = \ + $(GENERATED_DISSECTOR_C_FILES) \ + $(GENERATED_DISSECTOR_CPP_FILES) + +# +# All distributed generated non-dissector source files. +# +GENERATED_SUPPORT_SRC_FILES = \ + $(GENERATED_SUPPORT_C_FILES) \ + $(GENERATED_SUPPORT_CPP_FILES) + +# +# All distributed generated source files. +# +GENERATED_SRC_FILES = \ + $(GENERATED_DISSECTOR_SRC_FILES) \ + $(GENERATED_SUPPORT_SRC_FILES) + +# +# All non-distributed generated dissector source files. +# +NODIST_GENERATED_DISSECTOR_SRC_FILES = \ + $(NODIST_GENERATED_DISSECTOR_C_FILES) \ + $(NODIST_GENERATED_DISSECTOR_CPP_FILES) + +# +# All non-distributed generated non-dissector source files. +# +NODIST_GENERATED_SUPPORT_SRC_FILES = \ + $(NODIST_GENERATED_SUPPORT_C_FILES) \ + $(NODIST_GENERATED_SUPPORT_CPP_FILES) + +# +# All non-distributed generated source files. +# +NODIST_GENERATED_SRC_FILES = \ + $(NODIST_GENERATED_DISSECTOR_SRC_FILES) \ + $(NODIST_GENERATED_SUPPORT_SRC_FILES) + +# +# All distributed dissector source files. +# +DISSECTOR_SRC_FILES = \ + $(DISSECTOR_C_FILES) \ + $(DISSECTOR_CPP_FILES) + +# +# All distributed non-dissector source files. +# +SUPPORT_SRC_FILES = \ + $(SUPPORT_C_FILES) \ + $(SUPPORT_CPP_FILES) + +# +# All non-distributed non-dissector source files. +# +NODIST_SUPPORT_SRC_FILES = \ + $(NODIST_SUPPORT_C_FILES) \ + $(NODIST_SUPPORT_CPP_FILES) + +# +# All distributed source files. +# +SRC_FILES = \ + $(DISSECTOR_SRC_FILES) \ + $(SUPPORT_SRC_FILES) + +# +# All non-distributed source files. +# +NODIST_SRC_FILES = \ + $(NODIST_DISSECTOR_SRC_FILES) \ + $(NODIST_SUPPORT_SRC_FILES) diff --git a/plugins/mate/Makefile.am b/plugins/mate/Makefile.am index e65fbdc590..6147353e25 100644 --- a/plugins/mate/Makefile.am +++ b/plugins/mate/Makefile.am @@ -35,14 +35,12 @@ plugin_LTLIBRARIES = mate.la mate_la_SOURCES = \ plugin.c \ moduleinfo.h \ - $(DISSECTOR_SRC) \ - $(DISSECTOR_SUPPORT_SRC) \ - $(DISSECTOR_INCLUDES) + $(SRC_FILES) \ + $(HEADER_FILES) nodist_mate_la_SOURCES = \ - $(DISSECTOR_NODIST_SRC) \ - $(DISSECTOR_SUPPORT_NODIST_SRC) \ - $(DISSECTOR_NODIST_INCLUDES) + $(NODIST_SRC_FILES) \ + $(NODIST_HEADER_FILES) mate_la_LDFLAGS = -module -avoid-version mate_la_LIBADD = @PLUGIN_LIBS@ @@ -67,7 +65,8 @@ LIBS = # preceded only by "void " starting in column zero, and must not be # inside #if. # -# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# DISSECTOR_SRC_FILES and NODIST_DISSECTOR_SRC_FILES are assumed to have +# all the files that need to be scanned. # # For some unknown reason, having a big "for" loop in the Makefile # to scan all the files doesn't work with some "make"s; they seem to @@ -85,16 +84,16 @@ LIBS = # a plugin.c file for a plugin. # All subsequent arguments are the files to scan. # -plugin.c: $(DISSECTOR_SRC) Makefile.common $(top_srcdir)/tools/make-dissector-reg \ +plugin.c: $(DISSECTOR_SRC_FILES) $(NODIST_DISSECTOR_SRC_FILES) Makefile.common $(top_srcdir)/tools/make-dissector-reg \ $(top_srcdir)/tools/make-dissector-reg.py @if test -n "$(PYTHON)"; then \ echo Making plugin.c with python ; \ $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \ - plugin $(DISSECTOR_SRC) ; \ + plugin $(DISSECTOR_SRC_FILES) $(NODIST_DISSECTOR_SRC_FILES) ; \ else \ echo Making plugin.c with shell script ; \ $(top_srcdir)/tools/make-dissector-reg $(srcdir) \ - $(plugin_src) plugin $(DISSECTOR_SRC) ; \ + $(plugin_src) plugin $(DISSECTOR_SRC_FILES) $(NODIST_DISSECTOR_SRC_FILES) ; \ fi # @@ -120,14 +119,14 @@ CLEANFILES = \ *~ DISTCLEANFILES = \ - mate_grammar.out \ - mate_grammar.c \ - mate_grammar.h + mate_grammar.out \ + $(NODIST_GENERATED_SRC_FILES) \ + $(NODIST_GENERATED_HEADER_FILES) MAINTAINERCLEANFILES = \ - Makefile.in \ - mate_parser.c \ - mate_parser_lex.h \ + Makefile.in \ + $(GENERATED_SRC_FILES) \ + $(GENERATED_HEADER_FILES) \ plugin.c EXTRA_DIST = \ @@ -154,4 +153,5 @@ mate_grammar.c mate_grammar.h : mate_grammar.lemon mate.h mate_util.h $(LEMON)/l mate_grammar.h : mate_grammar.c checkapi: - $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build $(DISSECTOR_SRC) $(DISSECTOR_INCLUDES) + $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build \ + $(SRC_FILES) $(NODIST_SRC_FILES) $(HEADER_FILES) diff --git a/plugins/mate/Makefile.common b/plugins/mate/Makefile.common index e585b4c3e2..2f3a1e4f08 100644 --- a/plugins/mate/Makefile.common +++ b/plugins/mate/Makefile.common @@ -33,9 +33,15 @@ PLUGIN_NAME = mate # from a tarball (e.g., make and a C compiler are assumed to be present, # but Flex isn't). # -GENERATED_DISSECTOR_SUPPORT_C_FILES = \ +GENERATED_DISSECTOR_C_FILES = + +GENERATED_DISSECTOR_CPP_FILES = + +GENERATED_SUPPORT_C_FILES = \ mate_parser.c +GENERATED_SUPPORT_CPP_FILES = + GENERATED_HEADER_FILES = \ mate_parser_lex.h @@ -43,35 +49,52 @@ GENERATED_HEADER_FILES = \ # We distribute Lemon with Wireshark, so we don't distribute the files # it produces. # -GENERATED_DISSECTOR_SUPPORT_NODIST_C_FILES = \ +NODIST_GENERATED_DISSECTOR_C_FILES = + +NODIST_GENERATED_DISSECTOR_CPP_FILES = + +NODIST_GENERATED_SUPPORT_C_FILES = \ mate_grammar.c -GENERATED_NODIST_HEADER_FILES = \ +NODIST_GENERATED_SUPPORT_CPP_FILES = + +NODIST_GENERATED_HEADER_FILES = \ mate_grammar.h # the dissector sources (without any helpers) -DISSECTOR_SRC = \ - $(GENERATED_DISSECTOR_SRC) \ +DISSECTOR_C_FILES = \ + $(GENERATED_DISSECTOR_C_FILES) \ packet-mate.c +DISSECTOR_CPP_FILES = \ + $(GENERATED_DISSECTOR_CPP_FILES) + # Dissector helpers that are distributed. They're included in the source # files in this directory, but they're not dissectors themselves, i.e. # they're not used to generate "register.c"). -DISSECTOR_SUPPORT_SRC = \ - $(GENERATED_DISSECTOR_SUPPORT_C_FILES) \ +SUPPORT_C_FILES = \ + $(GENERATED_SUPPORT_C_FILES) \ mate_setup.c \ mate_runtime.c \ mate_util.c +SUPPORT_CPP_FILES = \ + $(GENERATED_SUPPORT_CPP_FILES) + # Dissector helpers that aren't distributed. -DISSECTOR_SUPPORT_NODIST_SRC = \ - $(GENERATED_DISSECTOR_SUPPORT_NODIST_C_FILES) +NODIST_SUPPORT_C_FILES = \ + $(NODIST_GENERATED_SUPPORT_C_FILES) + +NODIST_SUPPORT_CPP_FILES = \ + $(NODIST_GENERATED_SUPPORT_CPP_FILES) # Headers. -DISSECTOR_INCLUDES = \ +HEADER_FILES = \ $(GENERATED_HEADER_FILES) \ mate.h \ mate_util.h -DISSECTOR_NODIST_INCLUDES = \ - $(GENERATED_NODIST_HEADER_FILES) +NODIST_HEADER_FILES = \ + $(NODIST_GENERATED_HEADER_FILES) + +include ../Makefile.common.inc diff --git a/plugins/mate/Makefile.nmake b/plugins/mate/Makefile.nmake index 0ad0a7df02..3c20c8757e 100644 --- a/plugins/mate/Makefile.nmake +++ b/plugins/mate/Makefile.nmake @@ -30,16 +30,27 @@ LDFLAGS = $(PLUGIN_LDFLAGS) LINK_PLUGIN_WITH=..\..\epan\libwireshark.lib ..\..\wsutil\libwsutil.lib CFLAGS=/D_NEED_VAR_IMPORT_ $(CFLAGS) -DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj) +DISSECTOR_OBJECTS = \ + $(DISSECTOR_C_FILES:.c=.obj) \ + $(DISSECTOR_CPP_FILES:.cpp=.obj) -DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj) +NODIST_DISSECTOR_OBJECTS = \ + $(NODIST_DISSECTOR_C_FILES:.c=.obj) \ + $(NODIST_DISSECTOR_CPP_FILES:.cpp=.obj) -DISSECTOR_SUPPORT_NODIST_OBJECTS = $(DISSECTOR_SUPPORT_NODIST_SRC:.c=.obj) +SUPPORT_OBJECTS = \ + $(SUPPORT_C_FILES:.c=.obj) \ + $(SUPPORT_CPP_FILES:.cpp=.obj) + +NODIST_SUPPORT_OBJECTS = \ + $(NODIST_SUPPORT_C_FILES:.c=.obj) \ + $(NODIST_SUPPORT_CPP_FILES:.cpp=.obj) OBJECTS = \ $(DISSECTOR_OBJECTS) \ - $(DISSECTOR_SUPPORT_OBJECTS) \ - $(DISSECTOR_SUPPORT_NODIST_OBJECTS) \ + $(NODIST_DISSECTOR_OBJECTS) \ + $(SUPPORT_OBJECTS) \ + $(NODIST_SUPPORT_OBJECTS) \ plugin.obj RESOURCE=$(PLUGIN_NAME).res @@ -75,7 +86,8 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # preceded only by "void " starting in column zero, and must not be # inside #if. # -# DISSECTOR_SRC is assumed to have all the files that need to be scanned. +# DISSECTOR_SRC_FILES and NODIST_DISSECTOR_SRC_FILES are assumed to have +# all the files that need to be scanned. # # For some unknown reason, having a big "for" loop in the Makefile # to scan all the files doesn't work with some "make"s; they seem to @@ -94,13 +106,13 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # All subsequent arguments are the files to scan. # !IFDEF PYTHON -plugin.c: $(DISSECTOR_SRC) moduleinfo.h Makefile.common ../../tools/make-dissector-reg.py +plugin.c: $(DISSECTOR_SRC_FILES) moduleinfo.h Makefile.common ../../tools/make-dissector-reg.py @echo Making plugin.c (using python) - @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC) + @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC_FILES) $(NODIST_DISSECTOR_SRC_FILES) !ELSE -plugin.c: $(DISSECTOR_SRC) moduleinfo.h Makefile.common ../../tools/make-dissector-reg +plugin.c: $(DISSECTOR_SRC_FILES) moduleinfo.h Makefile.common ../../tools/make-dissector-reg @echo Making plugin.c (using sh) - @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) + @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC_FILES) $(NODIST_DISSECTOR_SRC_FILES) !ENDIF !ENDIF @@ -110,20 +122,20 @@ clean: $(PLUGIN_NAME).dll $(PLUGIN_NAME).dll.manifest $(PLUGIN_NAME).lib \ $(PLUGIN_NAME).exp $(PLUGIN_NAME).rc -# We remove the generated files with "distclean" because one of them, -# "mate_parser.c", needs different #includes for UN*X and Windows -# (UN*X versions of Flex make it include <unistd.h>, but that's a -# UN*X-only header), so if you're going to build from source, you need -# to build "mate_parser.c" from "mate_parser.l" with Flex. -# This might not be necessary for "mate_grammar.{c,h}", but we handle them -# the same for now. +# We remove the generated files with "distclean" because files generated +# by Flex need different #includes for UN*X and Windows (UN*X versions of +# Flex make it include <unistd.h>, but that's a UN*X-only header), so if +# you're going to build from source, you need to re-generate the files +# from the distribution that were generated by Flex. +# +# This might not be necessary for files generated by other tools not +# distributed with Wireshark, but we handle them the same for now. # distclean: clean - rm -f $(GENERATED_DISSECTOR_SRC) \ + rm -f $(GENERATED_SRC_FILES) \ $(GENERATED_HEADER_FILES) \ - $(GENERATED_NODIST_DISSECTOR_SRC) \ - $(GENERATED_NODIST_DISSECTOR_SUPPORT_SRC) \ - $(GENERATED_NODIST_HEADER_FILES) \ + $(NODIST_GENERATED_SRC_FILES) \ + $(NODIST_GENERATED_HEADER_FILES) \ mate_grammar.out maintainer-clean: distclean @@ -145,4 +157,5 @@ $(LEMON)\lemon.exe: cd ../plugins/mate checkapi: - $(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput -build $(DISSECTOR_SRC) $(DISSECTOR_INCLUDES) + $(PERL) ../../tools/checkAPIs.pl -g abort -g termoutput -build \ + $(SRC_FILES) $(NODIST_SRC_FILES) $(HEADER_FILES) |