From 9f3522cdcbde1916052fd7ce788f93523d263578 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 26 Jul 2007 11:18:24 +0200 Subject: [PATCH] Moved the tests of linking with Sherlock libraries to free/libs/examples/. --- free/libs/examples/external/Makefile | 8 +++++++ free/libs/examples/external/test.c | 8 +++++++ free/libs/examples/internal/Makefile | 32 +++++++++++++++++++++++++++ free/libs/examples/internal/configure | 30 +++++++++++++++++++++++++ free/libs/examples/internal/defconfig | 22 ++++++++++++++++++ free/libs/examples/internal/test.c | 8 +++++++ 6 files changed, 108 insertions(+) create mode 100644 free/libs/examples/external/Makefile create mode 100644 free/libs/examples/external/test.c create mode 100644 free/libs/examples/internal/Makefile create mode 100755 free/libs/examples/internal/configure create mode 100644 free/libs/examples/internal/defconfig create mode 100644 free/libs/examples/internal/test.c diff --git a/free/libs/examples/external/Makefile b/free/libs/examples/external/Makefile new file mode 100644 index 00000000..0cb26a12 --- /dev/null +++ b/free/libs/examples/external/Makefile @@ -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 index 00000000..2a03b291 --- /dev/null +++ b/free/libs/examples/external/test.c @@ -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 index 00000000..153088af --- /dev/null +++ b/free/libs/examples/internal/Makefile @@ -0,0 +1,32 @@ +# Example Makefile for a stand-alone program using the libucw build system +# (c) 2007 Martin Mares + +# 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 index 00000000..8cbed351 --- /dev/null +++ b/free/libs/examples/internal/configure @@ -0,0 +1,30 @@ +#!/usr/bin/perl +# Configure script for the libucw example +# (c) 2007 Martin Mares + +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 index 00000000..1723d128 --- /dev/null +++ b/free/libs/examples/internal/defconfig @@ -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 index 00000000..2a03b291 --- /dev/null +++ b/free/libs/examples/internal/test.c @@ -0,0 +1,8 @@ +#include "lib/lib.h" + +int main(void) +{ + log_init("test"); + msg(L_INFO, "Hoooot!"); + return 0; +} -- 2.39.2