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