21aebd2229d20b9d2c590997dc1f8bdadbea341b
[metze/wireshark/wip.git] / plugins / asn1 / Makefile.am
1 # Makefile.am
2 # Automake file for ASN.1 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 if HAVE_WARNINGS_AS_ERRORS
32 AM_CFLAGS = -Werror
33 endif
34
35 plugindir = @plugindir@
36
37 plugin_LTLIBRARIES = asn1.la
38
39 asn1_la_SOURCES = \
40         plugin.c \
41         moduleinfo.h \
42         $(SRC_FILES)    \
43         $(HEADER_FILES)
44
45 asn1_la_LDFLAGS = -module -avoid-version
46 asn1_la_LIBADD = @PLUGIN_LIBS@
47
48 # Libs must be cleared, or else libtool won't create a shared module.
49 # If your module needs to be linked against any particular libraries,
50 # add them here.
51 LIBS =
52
53 #
54 # Build plugin.c, which contains the plugin version[] string, a
55 # function plugin_register() that calls the register routines for all
56 # protocols, and a function plugin_reg_handoff() that calls the handoff
57 # registration routines for all protocols.
58 #
59 # We do this by scanning sources.  If that turns out to be too slow,
60 # maybe we could just require every .o file to have an register routine
61 # of a given name (packet-aarp.o -> proto_register_aarp, etc.).
62 #
63 # Formatting conventions:  The name of the proto_register_* routines an
64 # proto_reg_handoff_* routines must start in column zero, or must be
65 # preceded only by "void " starting in column zero, and must not be
66 # inside #if.
67 #
68 # REGISTER_SRC_FILES is assumed to have all the files that need to be scanned.
69 #
70 # For some unknown reason, having a big "for" loop in the Makefile
71 # to scan all the files doesn't work with some "make"s; they seem to
72 # pass only the first few names in the list to the shell, for some
73 # reason.
74 #
75 # Therefore, we have a script to generate the plugin.c file.
76 # The shell script runs slowly, as multiple greps and seds are run
77 # for each input file; this is especially slow on Windows.  Therefore,
78 # if Python is present (as indicated by PYTHON being defined), we run
79 # a faster Python script to do that work instead.
80 #
81 # The first argument is the directory in which the source files live.
82 # The second argument is "plugin", to indicate that we should build
83 # a plugin.c file for a plugin.
84 # All subsequent arguments are the files to scan.
85 #
86 plugin.c: $(REGISTER_SRC_FILES) Makefile.common $(top_srcdir)/tools/make-dissector-reg \
87     $(top_srcdir)/tools/make-dissector-reg.py
88         @if test -n "$(PYTHON)"; then \
89                 echo Making plugin.c with python ; \
90                 $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
91                     plugin $(REGISTER_SRC_FILES) ; \
92         else \
93                 echo Making plugin.c with shell script ; \
94                 $(top_srcdir)/tools/make-dissector-reg $(srcdir) \
95                     $(plugin_src) plugin $(REGISTER_SRC_FILES) ; \
96         fi
97
98 #
99 # Currently plugin.c can be included in the distribution because
100 # we always build all protocol dissectors. We used to have to check
101 # whether or not to build the snmp dissector. If we again need to
102 # variably build something, making plugin.c non-portable, uncomment
103 # the dist-hook line below.
104 #
105 # Oh, yuk.  We don't want to include "plugin.c" in the distribution, as
106 # its contents depend on the configuration, and therefore we want it
107 # to be built when the first "make" is done; however, Automake insists
108 # on putting *all* source into the distribution.
109 #
110 # We work around this by having a "dist-hook" rule that deletes
111 # "plugin.c", so that "dist" won't pick it up.
112 #
113 #dist-hook:
114 #       @rm -f $(distdir)/plugin.c
115
116 CLEANFILES = \
117         asn1 \
118         *~
119
120 MAINTAINERCLEANFILES = \
121         Makefile.in     \
122         plugin.c
123
124 EXTRA_DIST = \
125         Makefile.common         \
126         Makefile.nmake          \
127         moduleinfo.nmake        \
128         plugin.rc.in            \
129         CMakeLists.txt
130
131 checkapi:
132         $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build \
133                 $(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)