From 5a20021ee682f539426c0f8fbb4cc68bc4771c81 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 13 Mar 1999 17:41:49 +0000 Subject: [PATCH] updated depdemo --- depdemo/Makefile.am | 27 +++++++++++---------------- depdemo/configure.in | 15 ++++++++++++++- depdemo/l1/Makefile.am | 7 +++++++ depdemo/{ => l1}/l1.c | 6 +++--- depdemo/{ => l1}/l1.h | 0 depdemo/l2/Makefile.am | 8 ++++++++ depdemo/{ => l2}/l2.c | 10 +++++----- depdemo/{ => l2}/l2.h | 0 depdemo/l3/Makefile.am | 8 ++++++++ depdemo/{ => l3}/l3.c | 14 +++++++------- depdemo/{ => l3}/l3.h | 0 depdemo/l4/Makefile.am | 8 ++++++++ depdemo/{ => l4}/l4.c | 12 ++++++------ depdemo/{ => l4}/l4.h | 0 depdemo/main.c | 6 +++--- 15 files changed, 80 insertions(+), 41 deletions(-) create mode 100644 depdemo/l1/Makefile.am rename depdemo/{ => l1}/l1.c (92%) rename depdemo/{ => l1}/l1.h (100%) create mode 100644 depdemo/l2/Makefile.am rename depdemo/{ => l2}/l2.c (89%) rename depdemo/{ => l2}/l2.h (100%) create mode 100644 depdemo/l3/Makefile.am rename depdemo/{ => l3}/l3.c (85%) rename depdemo/{ => l3}/l3.h (100%) create mode 100644 depdemo/l4/Makefile.am rename depdemo/{ => l4}/l4.c (87%) rename depdemo/{ => l4}/l4.h (100%) diff --git a/depdemo/Makefile.am b/depdemo/Makefile.am index ccf3891a..04b4aaf9 100644 --- a/depdemo/Makefile.am +++ b/depdemo/Makefile.am @@ -2,27 +2,22 @@ # AUTOMAKE_OPTIONS = no-dependencies foreign -lib_LTLIBRARIES = libl1.la libl2.la libl3.la libl4.la -libl1_la_SOURCES = l1.c l1.h sysdep.h -libl2_la_SOURCES = l2.c l2.h sysdep.h -libl2_la_LIBADD = libl1.la -libl3_la_SOURCES = l3.c l3.h sysdep.h -libl3_la_LIBADD = libl1.la libl2.la -libl4_la_SOURCES = l4.c l4.h sysdep.h -libl4_la_LIBADD = libl3.la +SUBDIRS = l1 l2 l3 l4 +EXTRA_DIST = sysdep.h + bin_PROGRAMS = depdemo depdemo.static depdemo_SOURCES = main.c -depdemo_LDADD = libl1.la libl2.la libl4.la \ - libl3.la # remove this! -depdemo_DEPENDENCIES = libl1.la libl2.la libl4.la +depdemo_LDADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la \ + $(top_builddir)/l4/libl4.la +depdemo_DEPENDENCIES = $(top_builddir)/l1/libl1.la \ + $(top_builddir)/l2/libl2.la $(top_builddir)/l4/libl4.la -depdemo_static_SOURCES = main.c -depdemo_static_LDADD = libl1.la libl2.la libl4.la \ - libl3.la # remove this! -depdemo_static_DEPENDENCIES = libl1.la libl2.la libl4.la -depdemo_static_LDFLAGS = -static +depdemo_static_SOURCES = $(depdemo_SOURCES) +depdemo_static_LDADD = $(depdemo_LDADD) +depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES) +depdemo_static_LDFLAGS = $(STATIC) $(OBJECTS): libtool libtool: $(LIBTOOL_DEPS) diff --git a/depdemo/configure.in b/depdemo/configure.in index 67438a71..bfd04c2b 100644 --- a/depdemo/configure.in +++ b/depdemo/configure.in @@ -7,9 +7,22 @@ AC_EXEEXT AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) +if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then + STATIC=-static +else + STATIC= +fi +AC_SUBST(STATIC) + AC_CHECK_HEADERS(math.h) AC_CHECK_LIBM dnl Output the makefile -AC_OUTPUT(Makefile) +AC_OUTPUT( +Makefile +l1/Makefile +l2/Makefile +l3/Makefile +l4/Makefile +) diff --git a/depdemo/l1/Makefile.am b/depdemo/l1/Makefile.am new file mode 100644 index 00000000..c5a22ed4 --- /dev/null +++ b/depdemo/l1/Makefile.am @@ -0,0 +1,7 @@ +# A brief demonstration of inter-library dependencies +# + +INCLUDES = -I$(top_srcdir) + +lib_LTLIBRARIES = libl1.la +libl1_la_SOURCES = l1.c l1.h diff --git a/depdemo/l1.c b/depdemo/l1/l1.c similarity index 92% rename from depdemo/l1.c rename to depdemo/l1/l1.c index d5fe6c87..2a428ba2 100644 --- a/depdemo/l1.c +++ b/depdemo/l1/l1.c @@ -17,17 +17,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "l1.h" +#include "l1/l1.h" #include int var_l1; int -func_l1(int ident) +func_l1(int indent) { int i; - for (i = 0; i < ident; i++) + for (i = 0; i < indent; i++) putchar(' '); printf("l1\n"); return 0; diff --git a/depdemo/l1.h b/depdemo/l1/l1.h similarity index 100% rename from depdemo/l1.h rename to depdemo/l1/l1.h diff --git a/depdemo/l2/Makefile.am b/depdemo/l2/Makefile.am new file mode 100644 index 00000000..6509f3b0 --- /dev/null +++ b/depdemo/l2/Makefile.am @@ -0,0 +1,8 @@ +# A brief demonstration of inter-library dependencies +# + +INCLUDES = -I$(top_srcdir) + +lib_LTLIBRARIES = libl2.la +libl2_la_SOURCES = l2.c l2.h +libl2_la_LIBADD = $(top_builddir)/l1/libl1.la diff --git a/depdemo/l2.c b/depdemo/l2/l2.c similarity index 89% rename from depdemo/l2.c rename to depdemo/l2/l2.c index ce728d07..b9539fc0 100644 --- a/depdemo/l2.c +++ b/depdemo/l2/l2.c @@ -17,21 +17,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "l2.h" +#include "l2/l2.h" -#include "l1.h" +#include "l1/l1.h" #include int var_l2; int -func_l2(int ident) +func_l2(int indent) { int i; - for (i = 0; i < ident; i++) + for (i = 0; i < indent; i++) putchar(' '); printf("l2\n"); - func_l1(ident+1); + func_l1(indent+1); return 0; } diff --git a/depdemo/l2.h b/depdemo/l2/l2.h similarity index 100% rename from depdemo/l2.h rename to depdemo/l2/l2.h diff --git a/depdemo/l3/Makefile.am b/depdemo/l3/Makefile.am new file mode 100644 index 00000000..ed28ea14 --- /dev/null +++ b/depdemo/l3/Makefile.am @@ -0,0 +1,8 @@ +# A brief demonstration of inter-library dependencies +# + +INCLUDES = -I$(top_srcdir) + +lib_LTLIBRARIES = libl3.la +libl3_la_SOURCES = l3.c l3.h +libl3_la_LIBADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la diff --git a/depdemo/l3.c b/depdemo/l3/l3.c similarity index 85% rename from depdemo/l3.c rename to depdemo/l3/l3.c index f2c89780..d085b56a 100644 --- a/depdemo/l3.c +++ b/depdemo/l3/l3.c @@ -17,23 +17,23 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "l3.h" +#include "l3/l3.h" -#include "l1.h" -#include "l2.h" +#include "l1/l1.h" +#include "l2/l2.h" #include int var_l3; int -func_l3(int ident) +func_l3(int indent) { int i; - for (i = 0; i < ident; i++) + for (i = 0; i < indent; i++) putchar(' '); printf("l3\n"); - func_l1(ident+1); - func_l2(ident+1); + func_l1(indent+1); + func_l2(indent+1); return 0; } diff --git a/depdemo/l3.h b/depdemo/l3/l3.h similarity index 100% rename from depdemo/l3.h rename to depdemo/l3/l3.h diff --git a/depdemo/l4/Makefile.am b/depdemo/l4/Makefile.am new file mode 100644 index 00000000..1bfea223 --- /dev/null +++ b/depdemo/l4/Makefile.am @@ -0,0 +1,8 @@ +# A brief demonstration of inter-library dependencies +# + +INCLUDES = -I$(top_srcdir) + +lib_LTLIBRARIES = libl4.la +libl4_la_SOURCES = l4.c l4.h +libl4_la_LIBADD = $(top_builddir)/l3/libl3.la diff --git a/depdemo/l4.c b/depdemo/l4/l4.c similarity index 87% rename from depdemo/l4.c rename to depdemo/l4/l4.c index 94019b93..d44f5016 100644 --- a/depdemo/l4.c +++ b/depdemo/l4/l4.c @@ -17,9 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "l4.h" +#include "l4/l4.h" -#include "l3.h" +#include "l3/l3.h" #include #ifdef HAVE_MATH_H @@ -29,15 +29,15 @@ USA. */ int var_l4; int -func_l4(int ident) +func_l4(int indent) { int i; - for (i = 0; i < ident; i++) + for (i = 0; i < indent; i++) putchar(' '); printf("l4\n"); - func_l3(ident+1); - for (i = 0; i <= ident; i++) + func_l3(indent+1); + for (i = 0; i <= indent; i++) putchar(' '); printf("libm [sin(1.5) = %f]\n", sin(1.5)); return 0; diff --git a/depdemo/l4.h b/depdemo/l4/l4.h similarity index 100% rename from depdemo/l4.h rename to depdemo/l4/l4.h diff --git a/depdemo/main.c b/depdemo/main.c index 7becd4a6..a27032a3 100644 --- a/depdemo/main.c +++ b/depdemo/main.c @@ -17,9 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "l1.h" -#include "l2.h" -#include "l4.h" +#include "l1/l1.h" +#include "l2/l2.h" +#include "l4/l4.h" #include #include