Ethereal-dev: [Ethereal-dev] Separating the dissectors into a library

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Mon, 3 Jun 2002 02:50:44 +0200
I've make some changes to the toplevel Makefile.am as part of my plan to
eventually put all the files in DISSECTOR_SRC and DISSECTOR_COMMON_SRC
into epan/proto/. This patch puts all the dissectors into their own library
(libproto.a). I've also put those file I think are helper files into this
new library. I'd be happy if someone would check if my choice of files is
OK. But I'd like to have some feedback on the following questions before
really starting:
1) Is that really a good idea?
2) Ideally, I should put register.o or register-static.o into
   libproto as well. Can I be sure that only one version is used?
   How do I find out which one?
3) Should register.c and register-static.c be added to BUILT_SOURCES?

 Ciao
      Jörg

PS: This is my first attempt at playing with automake, so I expect
    I've found some suboptimal solutions (aka made some errors :-)

Index: ethereal/Makefile.am
===================================================================
RCS file: /cvsroot/ethereal/Makefile.am,v
retrieving revision 1.439
diff -u -r1.439 Makefile.am
--- Makefile.am	2002/06/02 12:32:08	1.439
+++ Makefile.am	2002/06/03 00:25:54
@@ -331,6 +331,44 @@
 	packet-ypxfr.c \
 	packet-zebra.c
 
+DISSECTOR_COMMON_SRC = \
+	aftypes.h      \
+	alignment.h    \
+	afn.c          \
+	afn.h          \
+	asn1.c         \
+	asn1.h         \
+	bridged_pids.h \
+	etypes.h       \
+	follow.c       \
+	follow.h       \
+	format-oid.h   \
+	greproto.h     \
+	in_cksum.c     \
+	in_cksum.h     \
+	ipproto.c      \
+	ipproto.h      \
+	llcsaps.h      \
+	nlpid.h        \
+	oui.h          \
+	ppptypes.h     \
+	ptvcursor.c	\
+	ptvcursor.h	\
+	reassemble.c   \
+	reassemble.h   \
+	register.h     \
+	rpc_defrag.h   \
+	smb.h          \
+	util.c         \
+	util.h         \
+	x11-declarations.h \
+	x11-register-info.h \
+	x264_prt_id.h  \
+	xdlc.c         \
+	xdlc.h         \
+	xmlstub.c      \
+	xmlstub.h
+
 if HAVE_PLUGINS
 plugin_src = \
 	plugins/gryphon/packet-gryphon.c \
@@ -479,13 +517,6 @@
 	packet-ypxfr.h 
 
 ETHEREAL_COMMON_SRC = \
-	aftypes.h      \
-	alignment.h    \
-	afn.c          \
-	afn.h          \
-	asn1.c         \
-	asn1.h         \
-	bridged_pids.h \
 	column.c       \
 	column.h       \
 	color.h        \
@@ -493,21 +524,8 @@
 	conditions.h   \
 	capture_stop_conditions.h   \
 	capture_stop_conditions.c   \
-	etypes.h       \
-	follow.c       \
-	follow.h       \
-	format-oid.h   \
-	greproto.h     \
-	in_cksum.c     \
-	in_cksum.h     \
-	ipproto.c      \
-	ipproto.h      \
-	llcsaps.h      \
-	nlpid.h        \
-	oui.h          \
 	pcap-util.c    \
 	pcap-util.h    \
-	ppptypes.h     \
 	prefs.c        \
 	prefs.h        \
 	prefs-int.h    \
@@ -515,31 +533,14 @@
 	print.h        \
 	ps.c           \
 	ps.h           \
-	ptvcursor.c	\
-	ptvcursor.h	\
-	reassemble.c   \
-	reassemble.h   \
-	register.h     \
 	ringbuffer.c   \
-	ringbuffer.h   \
-	rpc_defrag.h   \
-	smb.h          \
-	util.c         \
-	util.h         \
-	x11-declarations.h \
-	x11-register-info.h \
-	x264_prt_id.h  \
-	xdlc.c         \
-	xdlc.h         \
-	xmlstub.c      \
-	xmlstub.h
+	ringbuffer.h
 
 BUILT_SOURCES = \
 	x11-declarations.h \
 	x11-register-info.h
 
 ethereal_SOURCES = \
-	$(DISSECTOR_SRC) \
 	$(ETHEREAL_COMMON_SRC) \
 	register.c     \
 	capture.c      \
@@ -560,7 +561,6 @@
 	ui_util.h
 
 ethereal_static_SOURCES = \
-	$(DISSECTOR_SRC) \
 	$(ETHEREAL_COMMON_SRC) \
 	register-static.c     \
 	capture.c      \
@@ -593,6 +593,12 @@
 	strptime.c	\
 	strptime.h
 
+noinst_LIBRARIES = libproto.a
+
+libproto_a_SOURCES = \
+        $(DISSECTOR_SRC) \
+        $(DISSECTOR_COMMON_SRC)
+
 # Optional objects that I know how to build. These will be
 # linked into the ethereal executable.
 # They will also be linked into the tethereal executable; if this
@@ -607,6 +613,7 @@
 # Additional libs that I know how to build. These will be
 # linked into the ethereal executable.
 ethereal_additional_libs = \
+	libproto.a		\
 	wiretap/libwiretap.a	\
 	gtk/libui.a		\
 	epan/libethereal.a	\
@@ -649,13 +656,11 @@
 ethereal_static_LDFLAGS = -Wl,-static
 
 tethereal_SOURCES = \
-	$(DISSECTOR_SRC) \
 	$(ETHEREAL_COMMON_SRC) \
 	register.c     \
 	tethereal.c
 
 tethereal_static_SOURCES = \
-	$(DISSECTOR_SRC) \
 	$(ETHEREAL_COMMON_SRC) \
 	register-static.c     \
 	tethereal.c
@@ -663,6 +668,7 @@
 # Additional libs that I know how to build. These will be
 # linked into the tethereal executable.
 tethereal_additional_libs =		\
+	libproto.a			\
 	wiretap/libwiretap.a		\
 	epan/libethereal.a		\
 	epan/ftypes/libftypes.a		\
@@ -676,7 +682,7 @@
 
 tethereal_static_DEPENDENCIES = \
 	$(ethereal_optional_objects)	\
-	$(tethereal_additional_libs)	
+	$(tethereal_additional_libs)
 
 # This automake variable adds to the link-line for the executable
 tethereal_LDADD = wiretap/libwiretap.a	\
@@ -785,12 +791,12 @@
 
 
 dftest_SOURCES = \
-	$(DISSECTOR_SRC) \
 	$(ETHEREAL_COMMON_SRC) \
 	register.c     \
 	dftest.c
 
 dftest_additional_libs =		\
+	libproto.a			\
 	wiretap/libwiretap.a		\
 	epan/libethereal.a		\
 	epan/ftypes/libftypes.a		\
@@ -813,7 +819,8 @@
 dftest_LDFLAGS = -export-dynamic
 
 CLEANFILES =	\
-	idl2eth
+	idl2eth \
+	libproto.a
 
 DISTCLEANFILES =	\
 	register.c	\
--
Joerg Mayer                                          <jmayer@xxxxxxxxx>
I found out that "pro" means "instead of" (as in proconsul). Now I know
what proactive means.