]> mj.ucw.cz Git - libucw.git/commitdiff
Moved the tests of linking with Sherlock libraries to free/libs/examples/.
authorMartin Mares <mj@ucw.cz>
Thu, 26 Jul 2007 09:18:24 +0000 (11:18 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 26 Jul 2007 09:18:24 +0000 (11:18 +0200)
free/libs/examples/external/Makefile [new file with mode: 0644]
free/libs/examples/external/test.c [new file with mode: 0644]
free/libs/examples/internal/Makefile [new file with mode: 0644]
free/libs/examples/internal/configure [new file with mode: 0755]
free/libs/examples/internal/defconfig [new file with mode: 0644]
free/libs/examples/internal/test.c [new file with mode: 0644]

diff --git a/free/libs/examples/external/Makefile b/free/libs/examples/external/Makefile
new file mode 100644 (file)
index 0000000..0cb26a1
--- /dev/null
@@ -0,0 +1,8 @@
+# Example Makefile for a stand-alone program using libucw
+
+CFLAGS:=$(shell pkg-config --cflags libucw)
+LDLIBS:=$(shell pkg-config --libs libucw)
+
+all: test
+
+test: test.c
diff --git a/free/libs/examples/external/test.c b/free/libs/examples/external/test.c
new file mode 100644 (file)
index 0000000..2a03b29
--- /dev/null
@@ -0,0 +1,8 @@
+#include "lib/lib.h"
+
+int main(void)
+{
+  log_init("test");
+  msg(L_INFO, "Hoooot!");
+  return 0;
+}
diff --git a/free/libs/examples/internal/Makefile b/free/libs/examples/internal/Makefile
new file mode 100644 (file)
index 0000000..153088a
--- /dev/null
@@ -0,0 +1,32 @@
+# Example Makefile for a stand-alone program using the libucw build system
+# (c) 2007 Martin Mares <mj@ucw.cz>
+
+# The default target
+all: runtree programs
+
+# Include configuration
+s=.
+-include obj/config.mk
+obj/config.mk:
+       @echo "You need to run configure first." && false
+
+# We will use the libucw build system
+include $(s)/build/Maketop
+
+# Set up names of common libraries (to avoid forward references in rules)
+LIBLANG=$(o)/lang/liblang.pc
+LIBCHARSET=$(o)/charset/libcharset.pc
+LIBIMAGES=$(o)/images/libimages.pc
+
+# Include makefiles of libraries we wish to use
+include $(s)/lib/Makefile
+include $(s)/charset/Makefile
+include $(s)/lang/Makefile
+include $(s)/images/Makefile
+
+# Programs we want to compile
+PROGS+=$(o)/test
+$(o)/test: $(o)/test.o $(LIBUCW) $(LIBLANG) $(LIBCHARSET) $(LIBIMAGES)
+
+# And finally the default rules of the build system
+include $(s)/build/Makebottom
diff --git a/free/libs/examples/internal/configure b/free/libs/examples/internal/configure
new file mode 100755 (executable)
index 0000000..8cbed35
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+# Configure script for the libucw example
+# (c) 2007 Martin Mares <mj@ucw.cz>
+
+use warnings;
+use strict;
+
+our $srcdir;
+BEGIN {
+       my $pkgfile = "lib/wildmatch.c";
+       if (!defined ($srcdir = $ENV{"SRCDIR"})) {
+               if (-f $pkgfile) {
+                       $srcdir=".";
+               } elsif ($0 =~ m@^(.*)/configure$@ && -f "$1/$pkgfile") {
+                       $srcdir=$1;
+               } else {
+                       die "Don't know how to find myself. Please set SRCDIR manually.";
+               }
+       }
+       require "$srcdir/lib/perl/Configure.pm";
+       UCW::Configure::import UCW::Configure;
+}
+
+Init($srcdir, "defconfig");
+Log "### Configuring TestApp ###\n\n";
+Include Get("CONFIG");
+Include "lib/autoconf.cfg";
+Finish();
+
+Log "\nConfigured, run `make' to build everything.\n";
diff --git a/free/libs/examples/internal/defconfig b/free/libs/examples/internal/defconfig
new file mode 100644 (file)
index 0000000..1723d12
--- /dev/null
@@ -0,0 +1,22 @@
+# Default configuration file for our test application
+
+# Version string used by all Sherlock libraries
+Set("SHERLOCK_VERSION" => "0.0");
+
+# We want to build all libraries shared
+Set("CONFIG_SHARED");
+
+# Liblang settings
+Set("CONFIG_LANG");
+Set("MAX_WORD_LEN" => 64);
+
+# Libimages settings
+Set("CONFIG_IMAGES");
+Set("CONFIG_IMAGES_LIBJPEG");
+Set("CONFIG_IMAGES_LIBPNG");
+Set("CONFIG_IMAGES_LIBUNGIF");
+UnSet("CONFIG_IMAGES_LIBGIF");
+UnSet("CONFIG_IMAGES_LIBMAGICK");
+
+# Return success
+1;
diff --git a/free/libs/examples/internal/test.c b/free/libs/examples/internal/test.c
new file mode 100644 (file)
index 0000000..2a03b29
--- /dev/null
@@ -0,0 +1,8 @@
+#include "lib/lib.h"
+
+int main(void)
+{
+  log_init("test");
+  msg(L_INFO, "Hoooot!");
+  return 0;
+}