--- /dev/null
+# Example Makefile for a stand-alone program using the libucw build system
+# (c) 2007 Martin Mares <mj@ucw.cz>
+# (c) 2008 Michal Vaner <vorner@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
+
+# Do not show strange errors if the BUILDSYS_PATH is not set
+# (means noone yet called configure and it reported above)
+ifdef BUILDSYS_PATH
+
+# We will use the libucw build system
+include $(BUILDSYS_PATH)/Maketop
+
+# Add the detected flags to all the global flags
+CFLAGS+=$(LIBUCW_CFLAGS)
+LIBS+=$(LIBUCW_LIBS)
+
+# Programs we want to compile
+PROGS+=$(o)/test
+
+# And how they are created
+$(o)/test: $(o)/test.o $(LIBUCW)
+
+# And finally the default rules of the build system
+include $(BUILDSYS_PATH)/Makebottom
+
+endif
--- /dev/null
+#!/usr/bin/perl
+# Configure script for the libucw example
+# (c) 2008 Michal Vaner <vorner@ucw.cz>
+# A lot copyed from ../external/configure
+# (c) 2007 Martin Mares <mj@ucw.cz>
+
+use warnings;
+use strict;
+
+our($srcdir, $libdir);
+BEGIN {
+ # Find the sources
+ my $pkgfile = "test.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.";
+ }
+ }
+ # Ask pkg-config for the rest of configure
+ $libdir=`pkg-config libucw --variable=perl_modules_dir`;
+ chomp $libdir;
+ die "libUCW not found. Is PKG_CONFIG_PATH set properly?" if $? || not defined $libdir;
+}
+use lib $libdir;
+use UCW::Configure;
+
+Init($srcdir, 'default.cfg');
+Log "### Configuring TestApp ###\n\n";
+Include Get("CONFIG");
+# What should be detected?
+require UCW::Configure::Build;
+require UCW::Configure::Paths;
+require UCW::Configure::C;
+require UCW::Configure::Pkg;
+# You could generate your own documentation, too
+# require UCW::Configure::Doc;
+
+# Get some libraries
+UCW::Configure::Pkg::PkgConfig("libucw") or Fail("libUCW is required");
+Finish();
+
+Log "\nConfigured, run `make' to build everything.\n";