Add a Makefile.am.inc file, to hold rules etc. used by multiple
[obnox/wireshark/wip.git] / wiretap / Makefile.am
index 1c25e50d981122d8bc1c37785ae3e50a8a2305cd..982526e86b135f64f15b24d9cf8cba61d340684d 100644 (file)
@@ -3,8 +3,8 @@
 #
 # $Id$
 #
-# Ethereal - Network traffic analyzer
-# By Gerald Combs <gerald@ethereal.com>
+# 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
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+include ../Makefile.am.inc
+
 ACLOCAL_AMFLAGS = `../aclocal-flags`
 
+include Makefile.common
+
+noinst_LTLIBRARIES = libwiretap_generated.la
 lib_LTLIBRARIES = libwiretap.la
-libwiretap_la_LDFLAGS = -version-info 0:1:0
+libwiretap_la_LDFLAGS = -version-info 0:1:0 @LDFLAGS_SHAREDLIB@
+
+if HAVE_WARNINGS_AS_ERRORS
+AM_NON_GENERATED_CFLAGS = -Werror
+endif
 
 CLEANFILES = \
        libwiretap.a            \
        libwiretap.la           \
+       libwiretap_generated.a  \
+       libwiretap_generated.la \
        *~
 
 MAINTAINERCLEANFILES = \
-       ascend-grammar.c \
-       ascend-grammar.h
+       $(GENERATED_FILES)      \
+       Makefile.in             \
+       aclocal.m4              \
+       config.h.in             \
+       configure
 
+#Since code generated by lex may trigger gcc warnings, we are now generating two
+#libraries.  A single library is generated with the lex code without the barrier
+#"stop on warning". An other library is generated from the remaining source
+#files with the "stop on warning" barrier.
 libwiretap_la_SOURCES = \
-       airopeek9.c             \
-       airopeek9.h             \
-       ascend-grammar.y        \
-       ascend-scanner.l        \
-       ascend.c                \
-       ascend.h                \
-       ascend-int.h            \
-       atm.c                   \
-       atm.h                   \
-       buffer.c                \
-       buffer.h                \
-       cosine.h                \
-       cosine.c                \
-       csids.c                 \
-       csids.h                 \
-       dbs-etherwatch.c        \
-       dbs-etherwatch.h        \
-       erf.c                   \
-       erf.h                   \
-       etherpeek.c             \
-       etherpeek.h             \
-       file_access.c           \
-       file_wrappers.c         \
-       file_wrappers.h         \
-       hcidump.c               \
-       hcidump.h               \
-       i4btrace.c              \
-       i4btrace.h              \
-       i4b_trace.h             \
-       iptrace.c               \
-       iptrace.h               \
-       lanalyzer.c             \
-       lanalyzer.h             \
-       libpcap.c               \
-       libpcap.h               \
-       netmon.c                \
-       netmon.h                \
-       nettl.c                 \
-       nettl.h                 \
-       network_instruments.c   \
-       network_instruments.h   \
-       netxray.c               \
-       netxray.h               \
-       ngsniffer.c             \
-       ngsniffer.h             \
-       pppdump.c               \
-       pppdump.h               \
-       radcom.c                \
-       radcom.h                \
-       snoop.c                 \
-       snoop.h                 \
-       toshiba.c               \
-       toshiba.h               \
-       eyesdn.c                \
-       eyesdn.h                \
-       visual.c                \
-       visual.h                \
-       vms.c                   \
-       vms.h                   \
-       wtap.c                  \
-       wtap.h                  \
-       wtap-capture.h          \
-       wtap-int.h              \
-       5views.c                \
-       5views.h
+       $(NONGENERATED_C_FILES) \
+       $(NONGENERATED_HEADER_FILES)
+libwiretap_la_CFLAGS = $(AM_NON_GENERATED_CFLAGS)
+
+libwiretap_generated_la_SOURCES = \
+       $(GENERATED_C_FILES)
 
 EXTRA_DIST = \
        README.developer        \
-       ascend-grammar.c        \
-       ascend-grammar.h        \
-       ascend-scanner.c        \
        config.h.win32          \
+       Makefile.common         \
        Makefile.nmake          \
-       wtap.def
+       wtap.def                \
+       file_util.c             \
+       $(GENERATOR_SOURCES)    \
+       $(GENERATED_FILES)
 
-# Any POSIX-compatible YACC should honor the -p flag
-AM_YFLAGS=-d -p ascend
+libwiretap_la_LIBADD = libwiretap_generated.la
+libwiretap_la_DEPENDENCIES = libwiretap_generated.la
 
-ascend-scanner.c : ascend-scanner.l
-       $(LEX) -Pascend -oascend-scanner.c $(srcdir)/ascend-scanner.l
+ascend-grammar.c : ascend-grammar.y
+       @if [ -z "$(YACC)" ]; then \
+               echo "Neither bison nor byacc has been found"; \
+               exit 1; \
+       fi
+       $(YACC) -d -p ascend -o ascend-grammar.c $(srcdir)/ascend-grammar.y