[ltt-dev] [PATCH 1/4] Remove some duplicate code in the build system

Pierre-Marc Fournier pierre-marc.fournier at polymtl.ca
Tue Aug 11 22:21:35 EDT 2009


Merged all 4 patches in this set.

Thanks!

pmf

Benjamin Poirier wrote:
> Centralize CFLAGS, LDFLAGS
> Use some common automake directives for modules
> 
> Signed-off-by: Benjamin Poirier <benjamin.poirier at polymtl.ca>
> ---
> 
> Here's an updated re-spin
> 
>  configure.in                                       |   13 +++++----
>  ltt/Makefile.am                                    |    2 +-
>  lttv/Makefile.am                                   |    1 -
>  lttv/lttv/Makefile.am                              |   18 +-----------
>  lttv/modules/examples/Makefile.am                  |   10 +++---
>  lttv/modules/gui/common.am                         |   27 ++++++++++++++++++++
>  lttv/modules/gui/controlflow/Makefile.am           |   10 +------
>  lttv/modules/gui/detailedevents/Makefile.am        |   10 +------
>  lttv/modules/gui/diskperformance/Makefile.am       |   10 +------
>  lttv/modules/gui/filter/Makefile.am                |   10 +------
>  lttv/modules/gui/histogram/Makefile.am             |   10 +------
>  lttv/modules/gui/interrupts/Makefile.am            |   10 +------
>  lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am |   10 +------
>  lttv/modules/gui/resourceview/Makefile.am          |   10 +------
>  lttv/modules/gui/statistics/Makefile.am            |   10 +------
>  lttv/modules/gui/tracecontrol/Makefile.am          |   11 +------
>  lttv/modules/gui/tutorial/Makefile.am              |   10 +------
>  lttv/modules/text/Makefile.am                      |   11 +++-----
>  18 files changed, 59 insertions(+), 134 deletions(-)
>  create mode 100644 lttv/modules/gui/common.am
> 
> diff --git a/configure.in b/configure.in
> index c48c3aa..89acdb3 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -60,9 +60,13 @@ AC_HEADER_STDC
>  
>  pkg_modules="gtk+-2.0 >= 2.0.0"
>  PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
> -PACKAGE_CFLAGS="-Wall -Wformat"
> -AC_SUBST(PACKAGE_CFLAGS)
> -AC_SUBST(PACKAGE_LIBS)
> +
> +PACKAGE_CFLAGS="$PACKAGE_CFLAGS -Wall -Wformat"
> +MODULE_CFLAGS="$PACKAGE_CFLAGS -fvisibility=hidden"
> +MODULE_LDFLAGS="-module -avoid-version"
> +AC_SUBST([PACKAGE_CFLAGS])
> +AC_SUBST([MODULE_CFLAGS])
> +AC_SUBST([MODULE_LDFLAGS])
>  
>  # Checks for typedefs, structures, and compiler characteristics.
>  AC_HEADER_STDBOOL
> @@ -89,9 +93,6 @@ top_lttvwindowdir="\$(top_srcdir)/lttv/modules/gui/lttvwindow"
>  
>  DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_builddir) -I\$(top_lttvdir) -I\$(top_lttvwindowdir)"
>  
> -#CPPFLAGS="${GLIB_CFLAGS}"
> -#AC_SUBST(CPPFLAGS)
> -
>  lttincludedir="${includedir}/ltt"
>  lttvincludedir="${includedir}/lttv"
>  lttvwindowincludedir="${includedir}/lttvwindow"
> diff --git a/ltt/Makefile.am b/ltt/Makefile.am
> index 8f17b09..aab53f9 100644
> --- a/ltt/Makefile.am
> +++ b/ltt/Makefile.am
> @@ -6,7 +6,7 @@
>  
>  #libdir = ${lttlibdir}
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> +AM_CFLAGS = $(PACKAGE_CFLAGS)
>  LIBS += $(GLIB_LIBS)
>  LIBS += $(THREAD_LIBS)
>  
> diff --git a/lttv/Makefile.am b/lttv/Makefile.am
> index 8e473bb..8370b90 100644
> --- a/lttv/Makefile.am
> +++ b/lttv/Makefile.am
> @@ -2,4 +2,3 @@
>  # themselves to libraries compiled here but not installed in the system.
>  SUBDIRS = lttv modules
>  
> -modules_CFLAGS = -fvisibility=hidden
> diff --git a/lttv/lttv/Makefile.am b/lttv/lttv/Makefile.am
> index 170f4d5..24caa31 100644
> --- a/lttv/lttv/Makefile.am
> +++ b/lttv/lttv/Makefile.am
> @@ -1,4 +1,5 @@
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> +AM_CFLAGS= $(PACKAGE_CFLAGS)
> +
>  LIBS += $(THREAD_LIBS)
>  LIBS += $(POPT_LIBS) $(GLIB_LIBS) -lgobject-2.0 -L${top_builddir}/ltt\
>            -llttvtraceread
> @@ -24,25 +25,10 @@ lttv-gui: lttv-gui.sh
>  
>  INCLUDES = \
>  	-DPACKAGE_PLUGIN_DIR=\""$(lttvplugindir)"\" \
> -	@PACKAGE_CFLAGS@ \
>  	$(DEFAULT_INCLUDES)
>  
>  libdir = ${lttvplugindir}
>  
> -lttvinclude_HEADERS = \
> -	attribute.h\
> -	hook.h\
> -	iattribute.h\
> -	lttv.h\
> -	module.h\
> -	option.h\
> -	state.h\
> -	stats.h\
> -	tracecontext.h\
> -	traceset.h\
> -	filter.h\
> -	print.h
> -
>  #noinst_HEADERS = \
>  #	filter.h
>  
> diff --git a/lttv/modules/examples/Makefile.am b/lttv/modules/examples/Makefile.am
> index 82f7ec9..c90c0d1 100644
> --- a/lttv/modules/examples/Makefile.am
> +++ b/lttv/modules/examples/Makefile.am
> @@ -4,14 +4,14 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -libdir = ${lttvplugindir}
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> +AM_CFLAGS = $(PACKAGE_CFLAGS)
> +AM_LDFLAGS = $(MODULE_LDFLAGS)
> +
>  LIBS += $(GLIB_LIBS)
>  
> +libdir = ${lttvplugindir}
> +
>  lib_LTLIBRARIES = libsampledep.la libsamplemodule.la libsamplemodule2.la
> -libsampledep_la_LDFLAGS = -module -avoid-version
>  libsampledep_la_SOURCES = sampledep.c
> -libsamplemodule_la_LDFLAGS = -module -avoid-version
>  libsamplemodule_la_SOURCES = samplemodule.c
> -libsamplemodule2_la_LDFLAGS = -module -avoid-version
>  libsamplemodule2_la_SOURCES = samplemodule2.c
> diff --git a/lttv/modules/gui/common.am b/lttv/modules/gui/common.am
> new file mode 100644
> index 0000000..a0fda89
> --- /dev/null
> +++ b/lttv/modules/gui/common.am
> @@ -0,0 +1,27 @@
> +# vim: set syntax=automake:
> +# This file is part of the Linux Trace Toolkit viewer
> +# Copyright (C) 2003-2004 Mathieu Desnoyers
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License Version 2 as
> +# published by the Free Software Foundation;
> +#
> +# 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., 59 Temple Place - Suite 330, Boston,
> +# MA 02111-1307, USA.
> +
> +AM_CFLAGS = $(MODULE_CFLAGS)
> +AM_CFLAGS += $(GTK_CFLAGS)
> +AM_LDFLAGS = $(MODULE_LDFLAGS)
> +LIBS += $(GLIB_LIBS)
> +LIBS += $(THREAD_LIBS)
> +LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> +
> +libdir = ${lttvplugindir}
> +
> diff --git a/lttv/modules/gui/controlflow/Makefile.am b/lttv/modules/gui/controlflow/Makefile.am
> index 2f3cc0c..86a48cd 100644
> --- a/lttv/modules/gui/controlflow/Makefile.am
> +++ b/lttv/modules/gui/controlflow/Makefile.am
> @@ -22,17 +22,9 @@
>  # Created by Mathieu Desnoyers on September 27, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libguicontrolflow.la
> -libguicontrolflow_la_LDFLAGS = -module -avoid-version
>  libguicontrolflow_la_SOURCES = 	module.c eventhooks.c cfv.c processlist.c\
>  				drawing.c drawitem.c lttv_plugin_cfv.c
>  
> diff --git a/lttv/modules/gui/detailedevents/Makefile.am b/lttv/modules/gui/detailedevents/Makefile.am
> index 51a63d6..a417fab 100644
> --- a/lttv/modules/gui/detailedevents/Makefile.am
> +++ b/lttv/modules/gui/detailedevents/Makefile.am
> @@ -23,17 +23,9 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libguievents.la
> -libguievents_la_LDFLAGS = -module -avoid-version
>  libguievents_la_SOURCES = events.c lttv_plugin_evd.c
>  
>  noinst_HEADERS =	lttv_plugin_evd.h events.h
> diff --git a/lttv/modules/gui/diskperformance/Makefile.am b/lttv/modules/gui/diskperformance/Makefile.am
> index 4c2c771..3d30a5b 100644
> --- a/lttv/modules/gui/diskperformance/Makefile.am
> +++ b/lttv/modules/gui/diskperformance/Makefile.am
> @@ -23,17 +23,9 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libdiskperformance.la
> -libdiskperformance_la_LDFLAGS = -module -avoid-version
>  libdiskperformance_la_SOURCES = diskperformance.c
>  
>  EXTRA_DIST = \
> diff --git a/lttv/modules/gui/filter/Makefile.am b/lttv/modules/gui/filter/Makefile.am
> index 79d86fd..7d3c7ff 100644
> --- a/lttv/modules/gui/filter/Makefile.am
> +++ b/lttv/modules/gui/filter/Makefile.am
> @@ -4,17 +4,9 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -LIBS += $(THREAD_LIBS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libguifilter.la
> -libguifilter_la_LDFLAGS = -module -avoid-version
>  libguifilter_la_SOURCES = filter.c
>  
>  EXTRA_DIST = \
> diff --git a/lttv/modules/gui/histogram/Makefile.am b/lttv/modules/gui/histogram/Makefile.am
> index a40c59b..dfb1975 100644
> --- a/lttv/modules/gui/histogram/Makefile.am
> +++ b/lttv/modules/gui/histogram/Makefile.am
> @@ -23,17 +23,9 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libguihistogram.la
> -libguihistogram_la_LDFLAGS = -module -avoid-version
>  libguihistogram_la_SOURCES = histomodule.c histoeventhooks.c histocfv.c \
>  			histobuttonwidget.c histodrawing.c histodrawitem.c
>  
> diff --git a/lttv/modules/gui/interrupts/Makefile.am b/lttv/modules/gui/interrupts/Makefile.am
> index c564049..e1c530e 100644
> --- a/lttv/modules/gui/interrupts/Makefile.am
> +++ b/lttv/modules/gui/interrupts/Makefile.am
> @@ -23,17 +23,9 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libinterrupts.la
> -libinterrupts_la_LDFLAGS = -module -avoid-version
>  libinterrupts_la_SOURCES = interrupts.c
>  
>  EXTRA_DIST = \
> diff --git a/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am b/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
> index be55264..ddccc4c 100644
> --- a/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
> +++ b/lttv/modules/gui/lttvwindow/lttvwindow/Makefile.am
> @@ -1,16 +1,10 @@
>  ## Process this file with automake to produce Makefile.in
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS)
> +include ../../common.am
>  
>  INCLUDES = \
>  	-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
>  	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
> -	@PACKAGE_CFLAGS@ \
>  	$(DEFAULT_INCLUDES)
>  
>  #libdir = ${lttvplugindir}
> @@ -45,5 +39,5 @@ lttvwindowinclude_HEADERS = \
>  	lttv_plugin_tab.h \
>  	lttv_plugin.h
>  
> -liblttvwindow_la_LIBADD = @PACKAGE_LIBS@ $(INTLLIBS)
> +liblttvwindow_la_LIBADD = $(INTLLIBS)
>  
> diff --git a/lttv/modules/gui/resourceview/Makefile.am b/lttv/modules/gui/resourceview/Makefile.am
> index eea691a..e22738c 100644
> --- a/lttv/modules/gui/resourceview/Makefile.am
> +++ b/lttv/modules/gui/resourceview/Makefile.am
> @@ -22,17 +22,9 @@
>  # Created by Mathieu Desnoyers on September 27, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libresourceview.la
> -libresourceview_la_LDFLAGS = -module -avoid-version
>  libresourceview_la_SOURCES = 	module.c eventhooks.c cfv.c processlist.c drawing.c drawitem.c lttv_plugin_cfv.c
>  
>  noinst_HEADERS = eventhooks.h cfv.h processlist.h drawing.h drawitem.h lttv_plugin_cfv.h
> diff --git a/lttv/modules/gui/statistics/Makefile.am b/lttv/modules/gui/statistics/Makefile.am
> index f6568c5..9418a73 100644
> --- a/lttv/modules/gui/statistics/Makefile.am
> +++ b/lttv/modules/gui/statistics/Makefile.am
> @@ -4,17 +4,9 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libguistatistics.la
> -libguistatistics_la_LDFLAGS = -module -avoid-version
>  libguistatistics_la_SOURCES = statistics.c
>  
>  EXTRA_DIST = \
> diff --git a/lttv/modules/gui/tracecontrol/Makefile.am b/lttv/modules/gui/tracecontrol/Makefile.am
> index 96a13df..2865e69 100644
> --- a/lttv/modules/gui/tracecontrol/Makefile.am
> +++ b/lttv/modules/gui/tracecontrol/Makefile.am
> @@ -4,19 +4,12 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> +include ../common.am
> +
>  AM_CFLAGS += -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_BIN_DIR=\""$(bindir)"\"
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
>  LIBS += $(UTIL_LIBS)
>  
> -libdir = ${lttvplugindir}
> -
>  lib_LTLIBRARIES = libguitracecontrol.la
> -libguitracecontrol_la_LDFLAGS = -module -avoid-version
>  libguitracecontrol_la_SOURCES = tracecontrol.c
>  
>  EXTRA_DIST = \
> diff --git a/lttv/modules/gui/tutorial/Makefile.am b/lttv/modules/gui/tutorial/Makefile.am
> index 7aed5b4..372facf 100644
> --- a/lttv/modules/gui/tutorial/Makefile.am
> +++ b/lttv/modules/gui/tutorial/Makefile.am
> @@ -23,17 +23,9 @@
>  # Created by Mathieu Desnoyers on May 6, 2003
>  #
>  
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> -AM_CFLAGS += $(GTK_CFLAGS)
> -AM_CFLAGS += -fvisibility=hidden
> -LIBS += $(GLIB_LIBS)
> -LIBS += $(THREAD_LIBS)
> -LIBS += $(GTK_LIBS) -L${top_builddir}/lttv/modules/gui/lttvwindow/lttvwindow -llttvwindow
> -
> -libdir = ${lttvplugindir}
> +include ../common.am
>  
>  lib_LTLIBRARIES = libtutorial.la
> -libtutorial_la_LDFLAGS = -module -avoid-version
>  libtutorial_la_SOURCES = tutorial.c
>  
>  EXTRA_DIST = \
> diff --git a/lttv/modules/text/Makefile.am b/lttv/modules/text/Makefile.am
> index 0e91ebe..697181a 100644
> --- a/lttv/modules/text/Makefile.am
> +++ b/lttv/modules/text/Makefile.am
> @@ -1,19 +1,16 @@
> -AM_CFLAGS = $(GLIB_CFLAGS) 
> +AM_CFLAGS = $(MODULE_CFLAGS)
> +AM_LDFLAGS = $(MODULE_LDFLAGS)
> +
>  LIBS += $(THREAD_LIBS)
>  LIBS += $(GLIB_LIBS) -lgobject-2.0 -L${top_builddir}/ltt -llttvtraceread
> -
>  libdir = ${lttvplugindir}
>  
>  lib_LTLIBRARIES = libtextDump.la libbatchAnalysis.la libtextFilter.la libprecomputeState.la libdepanalysis.la
> -libtextDump_la_LDFLAGS = -module -avoid-version
> +
>  libtextDump_la_SOURCES = textDump.c
> -libbatchAnalysis_la_LDFLAGS = -module -avoid-version
>  libbatchAnalysis_la_SOURCES = batchAnalysis.c
> -libtextFilter_la_LDFLAGS = -module -avoid-version
>  libtextFilter_la_SOURCES = textFilter.c
> -libprecomputeState_la_LDFLAGS = -module -avoid-version
>  libprecomputeState_la_SOURCES = precomputeState.c
> -libdepanalysis_la_LDFLAGS = -module -avoid-version
>  libdepanalysis_la_SOURCES = depanalysis.c sstack.c
>  
>  noinst_HEADERS = \





More information about the lttng-dev mailing list