# HG changeset patch
# User Akos Ladanyi <ladanyi@tmit.bme.hu>
# Date 1238591915 -3600
# Node ID eda12d8ac95313c837f493e8fd2ca49adc49de26
# Parent  dad9db81ade216d40c4df1b4fb6fc52480abb17a
Add 'demo' make target for building the demo programs

diff -r dad9db81ade2 -r eda12d8ac953 INSTALL
--- a/INSTALL	Wed Apr 01 17:17:47 2009 +0100
+++ b/INSTALL	Wed Apr 01 14:18:35 2009 +0100
@@ -27,8 +27,8 @@
    3. `make'
 
       This command compiles the non-template part of LEMON into libemon.a
-      file. It also compiles the programs in the tools and demo subdirectories
-      when enabled.
+      file. It also compiles the programs in the tools subdirectory by
+      default.
 
    4. `make check'
 
@@ -75,14 +75,6 @@
 
   Set the installation prefix to PREFIX. By default it is /usr/local.
 
---enable-demo
-
-   Build the examples in the demo subdirectory.
-
---disable-demo
-
-   Do not build the examples in the demo subdirectory (default).
-
 --enable-tools
 
    Build the programs in the tools subdirectory (default).
diff -r dad9db81ade2 -r eda12d8ac953 Makefile.am
--- a/Makefile.am	Wed Apr 01 17:17:47 2009 +0100
+++ b/Makefile.am	Wed Apr 01 14:18:35 2009 +0100
@@ -39,9 +39,13 @@
 include lemon/Makefile.am
 include test/Makefile.am
 include doc/Makefile.am
-include demo/Makefile.am
 include tools/Makefile.am
 
+DIST_SUBDIRS = demo
+
+demo:
+	$(MAKE) $(AM_MAKEFLAGS) -C demo
+
 MRPROPERFILES = \
 	aclocal.m4 \
 	config.h.in \
@@ -68,4 +72,4 @@
 	zcat $(PACKAGE)-$(VERSION).tar.gz | \
 	bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
 
-.PHONY: mrproper dist-bz2 distcheck-bz2
+.PHONY: demo mrproper dist-bz2 distcheck-bz2
diff -r dad9db81ade2 -r eda12d8ac953 configure.ac
--- a/configure.ac	Wed Apr 01 17:17:47 2009 +0100
+++ b/configure.ac	Wed Apr 01 14:18:35 2009 +0100
@@ -64,19 +64,6 @@
 AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"])
 AM_CONDITIONAL([HAVE_MIP], [test x"$lx_mip_found" = x"yes"])
 
-dnl Disable/enable building the demo programs.
-AC_ARG_ENABLE([demo],
-AS_HELP_STRING([--enable-demo], [build the demo programs])
-AS_HELP_STRING([--disable-demo], [do not build the demo programs @<:@default@:>@]),
-              [], [enable_demo=no])
-AC_MSG_CHECKING([whether to build the demo programs])
-if test x"$enable_demo" != x"no"; then
-  AC_MSG_RESULT([yes])
-else
-  AC_MSG_RESULT([no])
-fi
-AM_CONDITIONAL([WANT_DEMO], [test x"$enable_demo" != x"no"])
-
 dnl Disable/enable building the binary tools.
 AC_ARG_ENABLE([tools],
 AS_HELP_STRING([--enable-tools], [build additional tools @<:@default@:>@])
@@ -110,6 +97,7 @@
 
 AC_CONFIG_FILES([
 Makefile
+demo/Makefile
 cmake/version.cmake
 doc/Doxyfile
 lemon/lemon.pc
@@ -132,7 +120,6 @@
 echo SOPLEX support................ : $lx_soplex_found
 echo CLP support................... : $lx_clp_found
 echo
-echo Build demo programs........... : $enable_demo
 echo Build additional tools........ : $enable_tools
 echo
 echo The packace will be installed in
diff -r dad9db81ade2 -r eda12d8ac953 demo/Makefile.am
--- a/demo/Makefile.am	Wed Apr 01 17:17:47 2009 +0100
+++ b/demo/Makefile.am	Wed Apr 01 14:18:35 2009 +0100
@@ -1,16 +1,17 @@
-EXTRA_DIST += \
-	demo/CMakeLists.txt \
-	demo/digraph.lgf
+AM_CXXFLAGS = $(WARNINGCXXFLAGS)
 
-if WANT_DEMO
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
+LDADD = $(top_builddir)/lemon/libemon.la
 
-noinst_PROGRAMS += \
-	demo/arg_parser_demo \
-	demo/graph_to_eps_demo \
-	demo/lgf_demo
+EXTRA_DIST = \
+	CMakeLists.txt \
+	digraph.lgf
 
-endif WANT_DEMO
+noinst_PROGRAMS = \
+	arg_parser_demo \
+	graph_to_eps_demo \
+	lgf_demo
 
-demo_arg_parser_demo_SOURCES = demo/arg_parser_demo.cc
-demo_graph_to_eps_demo_SOURCES = demo/graph_to_eps_demo.cc
-demo_lgf_demo_SOURCES = demo/lgf_demo.cc
+arg_parser_demo_SOURCES = arg_parser_demo.cc
+graph_to_eps_demo_SOURCES = graph_to_eps_demo.cc
+lgf_demo_SOURCES = lgf_demo.cc
diff -r dad9db81ade2 -r eda12d8ac953 doc/groups.dox
--- a/doc/groups.dox	Wed Apr 01 17:17:47 2009 +0100
+++ b/doc/groups.dox	Wed Apr 01 14:18:35 2009 +0100
@@ -671,8 +671,8 @@
 Some demo programs are listed here. Their full source codes can be found in
 the \c demo subdirectory of the source tree.
 
-It order to compile them, use <tt>--enable-demo</tt> configure option when
-build the library.
+In order to compile them, use the <tt>make demo</tt> or the
+<tt>make check</tt> commands.
 */
 
 /**
diff -r dad9db81ade2 -r eda12d8ac953 scripts/mk-release.sh
--- a/scripts/mk-release.sh	Wed Apr 01 17:17:47 2009 +0100
+++ b/scripts/mk-release.sh	Wed Apr 01 14:18:35 2009 +0100
@@ -14,7 +14,7 @@
 echo '*****************************************************************'
 
 autoreconf -vif
-./configure --enable-demo
+./configure
 
 make
 make html
diff -r dad9db81ade2 -r eda12d8ac953 test/Makefile.am
--- a/test/Makefile.am	Wed Apr 01 17:17:47 2009 +0100
+++ b/test/Makefile.am	Wed Apr 01 14:18:35 2009 +0100
@@ -37,6 +37,8 @@
 	test/time_measure_test \
 	test/unionfind_test
 
+test_test_tools_pass_DEPENDENCIES = demo
+
 if HAVE_LP
 check_PROGRAMS += test/lp_test
 endif HAVE_LP