Here, test this out - everything should work the same, except that
there are --enable-gui and --enable-opensync flags that will configure
those directories and include them in all the recursive targets.  I
also fixed all the Makefiles so that make dist generates a tarball
similar to the release ones, and got out of source tree builds to
work.

There are two things I'm not happy with: I had to put a set of
variable exports in configure.ac when a subdirectory is enabled, so
that they build and link against the source tree - I couldn't find a
more elegant way to get that behaviour.  The other thing is that when
the subdirectories aren't enabled (and they aren't by default), they
won't be included in make dist.  I figure this is ok since you don't
use make dist to generate your release tarballs anyway, but I added a
check that will warn prominently when the conditionally enabled
subdirectories are missing from the dist.  According to the
documentation, the only other workaround is to manually include them
in the dist instead of echoing a warning.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- Makefile.am	6 Jan 2007 04:42:56 -0000	1.5
+++ Makefile.am	3 Sep 2007 16:07:49 -0000
@@ -1,14 +1,36 @@
 
-EXTRA_DIST = COPYING ChangeLog README
+EXTRA_DIST = COPYING ChangeLog README \
+	buildgen.sh \
+	data \
+	doc \
+	hotplug \
+	maintainer \
+	rpm \
+	udev
 
 SUBDIRS = . src tools examples man
+# conditionally configured nested subdirectories are listed in $(subdirs)
+SUBDIRS += $(subdirs)
 
 pkgconfig_DATA = libbarry-0.pc
 
 all-local:
-	rm -f barry
-	ln -s src barry
+	rm -f $(top_builddir)/barry
+	ln -s $(top_srcdir)/src $(top_builddir)/barry
 
 clean-local:
-	rm -f barry
+	rm -f $(top_builddir)/barry
 
+# these directories will be tested for during make dist to warn if they are
+# missing
+CONDITIONAL_SUBDIRS = gui opensync-plugin
+dist-hook:
+	rm -rf `find $(distdir) -name CVS`
+	@for subdir in $(CONDITIONAL_SUBDIRS); do \
+		if test ! -d $(distdir)/$$subdir; then \
+			echo "###############################################################################"; \
+			echo "WARNING: The $$subdir subdirectory has been omitted!"; \
+			echo "rerun configure with --enable-$$subdir, then run make dist again"; \
+			echo "###############################################################################"; \
+		else :; fi \
+	done
Index: configure.ac
===================================================================
RCS file: /cvsroot/barry/barry/configure.ac,v
retrieving revision 1.18
diff -u -r1.18 configure.ac
--- configure.ac	18 Aug 2007 19:45:41 -0000	1.18
+++ configure.ac	3 Sep 2007 16:07:49 -0000
@@ -108,5 +108,20 @@
                  examples/Makefile
                  man/Makefile
                  libbarry-0.pc])
-AC_OUTPUT
 
+# nested packages
+AC_ARG_ENABLE([gui], [AC_HELP_STRING([--enable-gui], [build the gui])])
+if test "$enable_gui" = yes; then
+	AC_CONFIG_SUBDIRS([gui])
+fi
+AC_ARG_ENABLE([opensync-plugin], [AC_HELP_STRING([--enable-opensync], [build the opensync plugin])])
+if test "$enable_opensync_plugin" = yes; then
+	AC_CONFIG_SUBDIRS([opensync-plugin])
+fi
+if test "$enable_gui" = yes || test "$enable_opensync_plugin" = yes; then
+	export CXXFLAGS="-I`pwd` $CXXFLAGS"
+	export LDFLAGS="-L`pwd`/src $LDFLAGS"
+	export PKG_CONFIG_PATH="`pwd`:$PKG_CONFIG_PATH"
+fi
+
+AC_OUTPUT
Index: debian/control
===================================================================
RCS file: /cvsroot/barry/barry/debian/control,v
retrieving revision 1.4
diff -u -r1.4 control
--- debian/control	8 Jun 2007 18:45:23 -0000	1.4
+++ debian/control	3 Sep 2007 16:07:49 -0000
@@ -2,7 +2,7 @@
 Section: misc
 Priority: optional
 Maintainer: Chris Frey <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 4.0.0), libusb-dev, libssl-dev, libboost-serialization-dev, libtar-dev
+Build-Depends: debhelper (>= 4.0.0), pkg-config, libusb-dev, libssl-dev, libboost-serialization-dev, libtar-dev, libgtkmm-2.4-dev, libglademm-2.4-dev, libopensync-dev
 Standards-Version: 3.6.1
 
 Package: libbarry
Index: debian/rules
===================================================================
RCS file: /cvsroot/barry/barry/debian/rules,v
retrieving revision 1.8
diff -u -r1.8 rules
--- debian/rules	14 Jun 2007 21:19:48 -0000	1.8
+++ debian/rules	3 Sep 2007 16:07:49 -0000
@@ -63,8 +63,8 @@
 	rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
 
 	# Add here commands to clean up after the build process.
-	$(MAKE) distclean
-	(cd gui && $(MAKE) distclean)
+	-$(MAKE) distclean
+	-(cd gui && $(MAKE) distclean)
 
 	dh_clean  --exclude ./src/Makefile.orig
 
Index: gui/Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/gui/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- gui/Makefile.am	13 Jan 2007 07:43:12 -0000	1.1
+++ gui/Makefile.am	3 Sep 2007 16:07:50 -0000
@@ -1,5 +1,5 @@
 
-EXTRA_DIST = COPYING ChangeLog README
+EXTRA_DIST = COPYING ChangeLog README buildgen.sh
 
 SUBDIRS = . src
 
Index: gui/src/Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/gui/src/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- gui/src/Makefile.am	16 Aug 2007 21:42:58 -0000	1.5
+++ gui/src/Makefile.am	3 Sep 2007 16:07:50 -0000
@@ -6,16 +6,13 @@
 AM_CXXFLAGS = -ansi -Wall -g
 AM_CPPFLAGS = -DBARRYBACKUP_GLADEDIR='"$(gladedir)"'
 
-glade_DATA = \
+dist_glade_DATA = \
 	BackupWindow.glade \
 	DeviceSelectDlg.glade \
 	DatabaseSelectDlg.glade \
 	PasswordDlg.glade \
 	ConfigDlg.glade
 
-EXTRA_DIST = \
-	$(glade_DATA)
-
 bin_PROGRAMS = barrybackup
 
 barrybackup_SOURCES = \
@@ -31,3 +28,15 @@
 	tarfile-ops-nt.cc \
 	util.cc
 
+noinst_HEADERS= \
+	BackupWindow.h \
+	ConfigDlg.h \
+	ConfigFile.h \
+	DatabaseSelectDlg.h \
+	DeviceIface.h \
+	DeviceSelectDlg.h \
+	PasswordDlg.h \
+	tarfile.h \
+	util.h
+
+EXTRA_DIST = barry-gui.glade
Index: man/Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/man/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- man/Makefile.am	3 Feb 2007 20:57:59 -0000	1.2
+++ man/Makefile.am	3 Sep 2007 16:07:50 -0000
@@ -1,3 +1 @@
-
-man_MANS = bcharge.1 btool.1
-
+dist_man_MANS = bcharge.1 btool.1
Index: opensync-plugin/Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/opensync-plugin/Makefile.am,v
retrieving revision 1.1
diff -u -r1.1 Makefile.am
--- opensync-plugin/Makefile.am	8 Jul 2006 03:56:59 -0000	1.1
+++ opensync-plugin/Makefile.am	3 Sep 2007 16:07:50 -0000
@@ -1,24 +1,8 @@
-## Process this file with automake to produce Makefile.in
-
 SUBDIRS = src
 
 EXTRA_DIST = \
-	autogen.sh
-
-
-## The distclean files are just there so we can ship the example correctly. Remove these ##
-DISTCLEANFILES = \
-	aclocal.m4 \
-	config.status \
-	Makefile.in \
-	stamp-h1 \
-	config.h \
-	configure \
-	config.h.in \
-	Makefile \
-	config.log \
-	src/Makefile \
-	src/Makefile.in
+	buildgen.sh \
+	patches
 
-distclean-local:
-	rm -rf autom4te.cache
\ No newline at end of file
+dist-hook:
+	 rm -rf `find $(distdir) -name CVS`
Index: opensync-plugin/src/Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/opensync-plugin/src/Makefile.am,v
retrieving revision 1.9
diff -u -r1.9 Makefile.am
--- opensync-plugin/src/Makefile.am	21 Jul 2007 03:36:48 -0000	1.9
+++ opensync-plugin/src/Makefile.am	3 Sep 2007 16:07:50 -0000
@@ -10,7 +10,7 @@
 
 EXTRA_DIST = barry_sync.h
 
-config_DATA = barry-sync
+dist_config_DATA = barry-sync
 
 opensyncheader_HEADER = barry_sync.h
 
Index: opensync-plugin/src/barry-sync
===================================================================
RCS file: /cvsroot/barry/barry/opensync-plugin/src/barry-sync,v
retrieving revision 1.2
diff -u -r1.2 barry-sync
--- opensync-plugin/src/barry-sync	27 Jul 2007 04:07:26 -0000	1.2
+++ opensync-plugin/src/barry-sync	3 Sep 2007 16:07:50 -0000
@@ -1,5 +1,5 @@
 #
-# This is the default configuration file for the bary-sync opensync plugin.
+# This is the default configuration file for the barry-sync opensync plugin.
 # Comments are preceded by a '#' mark at the beginning of a line.
 # The config format is a set of lines of <keyword> <values>.
 #
Index: src/Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/src/Makefile.am,v
retrieving revision 1.23
diff -u -r1.23 Makefile.am
--- src/Makefile.am	18 Aug 2007 05:13:17 -0000	1.23
+++ src/Makefile.am	3 Sep 2007 16:07:50 -0000
@@ -25,9 +25,9 @@
 # Only ever increment the first 2 numbers in this version:
 LIB_BARRY_VERSION = 0:9:0
 
-# Disable the default -I. -I$(srcdir) -I$(topdir), etc, as our includes
-# are proper anyway. :-)
-DEFAULT_INCLUDES =
+# Disable the default -I. -I$(srcdir) -I$(topdir), etc, but $(top_builddir) is
+# needed for config.h
+DEFAULT_INCLUDES = -I$(top_builddir)
 #INCLUDES = @PACKAGE_CXXFLAGS@ [EMAIL PROTECTED]@
 INCLUDES = $(LIBUSB_CFLAGS) $(OPENSSL_CFLAGS)
 #AM_CXXFLAGS = -ansi -Wall -fno-strict-aliasing -g -D__DEBUG_MODE__
@@ -108,6 +108,15 @@
 libbarry_la_LIBADD = $(LTLIBOBJS) $(LIBUSB_LIBS) $(OPENSSL_LIBS)
 libbarry_la_LDFLAGS = -version-info ${LIB_BARRY_VERSION}
 
+noinst_HEADERS = cbarry.h \
+	record-internal.h \
+	strnlen.h
+
+EXTRA_DIST = convo.awk \
+	Doxyfile \
+	legal.txt \
+	Makefile.orig
+
 ##if DO_TEST
 ##	bin_PROGRAMS += test-base64 test-data test-time
 ##
Index: src/endian.h
===================================================================
RCS file: /cvsroot/barry/barry/src/endian.h,v
retrieving revision 1.5
diff -u -r1.5 endian.h
--- src/endian.h	17 May 2007 21:41:15 -0000	1.5
+++ src/endian.h	3 Sep 2007 16:07:50 -0000
@@ -24,7 +24,7 @@
 
 // The Blackberry is little endian in its USB data.  Fortunately,
 // this makes conversion easy on the x86...
-#include "../config.h"
+#include "config.h"
 
 #ifndef WORDS_BIGENDIAN
 #define btohs(x) x			// for uint16_t
Index: src/strnlen.h
===================================================================
RCS file: /cvsroot/barry/barry/src/strnlen.h,v
retrieving revision 1.1
diff -u -r1.1 strnlen.h
--- src/strnlen.h	18 Aug 2007 05:13:17 -0000	1.1
+++ src/strnlen.h	3 Sep 2007 16:07:50 -0000
@@ -22,7 +22,7 @@
 #ifndef __BARRY_STRNLEN_H__
 #define __BARRY_STRNLEN_H__
 
-#include "../config.h"
+#include "config.h"
 #include <string.h>
 
 // this is always defined by configure, if not, then the autoconf
Index: src/version.cc
===================================================================
RCS file: /cvsroot/barry/barry/src/version.cc,v
retrieving revision 1.6
diff -u -r1.6 version.cc
--- src/version.cc	9 Aug 2007 20:30:56 -0000	1.6
+++ src/version.cc	3 Sep 2007 16:07:50 -0000
@@ -20,7 +20,7 @@
 */
 
 #include "version.h"
-#include "../config.h"
+#include "config.h"
 
 #ifdef WORDS_BIGENDIAN
 #define BARRY_VERSION_STRING	"Barry library version 0.9 (big endian)"
Index: tools/Makefile.am
===================================================================
RCS file: /cvsroot/barry/barry/tools/Makefile.am,v
retrieving revision 1.9
diff -u -r1.9 Makefile.am
--- tools/Makefile.am	9 Mar 2007 02:58:56 -0000	1.9
+++ tools/Makefile.am	3 Sep 2007 16:07:50 -0000
@@ -1,3 +1,4 @@
+EXTRA_DIST = Makefile.plain
 
 #DEFAULT_INCLUDES =
 INCLUDES = $(LIBUSB_CFLAGS)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to