--- /dev/null
+#!/bin/bash
+#
+# A tool which builds a list of dependent libraries from the list
+# of pkg-config files.
+#
+# (c) 2007 Martin Mares <mj@ucw.cz>, placed under GNU LGPL
+#
+
+set -e
+
+shift
+SEEN=
+while [ -n "$1" ] ; do
+ case "$1" in
+ *.pc) if [ -n "$SEEN" ] ; then echo -n ", " ; fi
+ echo -n "`basename $1 .pc`"
+ SEEN=1
+ ;;
+ *) ;;
+ esac
+ shift
+done
--- /dev/null
+#!/bin/bash
+#
+# A preprocessor for linker arguments, which replaces references to .pc
+# files by results of the proper calls to pkg-config.
+#
+# (c) 2007 Martin Mares <mj@ucw.cz>, placed under GNU LGPL
+#
+
+set -e
+
+PC=
+while [ -n "$1" ] ; do
+ case "$1" in
+ *.pc) PC="$PC `basename $1 .pc`"
+ ;;
+ *) echo -n " $1"
+ ;;
+ esac
+ shift
+done
+if [ -n "$PC" ] ; then
+ echo -n " "
+ PKG_CONFIG_PATH="$PKG_CONFIG_PATH:obj/pkg-config" pkg-config --libs $PC
+fi
-# Makefile for the Sherlock Charset Library (c) 1997--2002 Martin Mares <mj@ucw.cz>
+# Makefile for the Sherlock Charset Library (c) 1997--2007 Martin Mares <mj@ucw.cz>
DIRS+=charset
$(o)/charset/libcharset.a: $(addsuffix .o,$(addprefix $(o)/charset/,$(LIBCHARSET_MODS)))
$(o)/charset/libcharset.so: $(addsuffix .oo,$(addprefix $(o)/charset/,$(LIBCHARSET_MODS)))
+$(o)/charset/libcharset.pc: $(LIBUCW)
INCLUDES+=$(o)/charset/.include-stamp
$(o)/charset/.include-stamp: $(addprefix $(s)/charset/,$(LIBCHARSET_INCLUDES))
--- /dev/null
+# pkg-config metadata for libcharset
+
+Name: libcharset
+Description: Character set conversion library
+Version: @SHERLOCK_VERSION@
+Libs: -Lobj/charset -lcharset
+Requires: @DEPS@
CONFIGS+=images
LIBIMAGES_MODS=math config context image scale color io-main
LIBIMAGES_INCLUDES=images.h error.h color.h math.h
+export LIBIMAGES_LIBS=
ifdef CONFIG_SHERLOCK
LIBIMAGES_MODS+=object
LIBIMAGES_INCLUDES+=signature.h
endif
-LIBIMAGES_LIBS=-lm -lpthread
-
ifdef CONFIG_IMAGES_LIBJPEG
LIBIMAGES_MODS+=io-libjpeg
LIBIMAGES_LIBS+=-ljpeg
$(o)/images/libimages.a: $(addsuffix .o,$(addprefix $(o)/images/,$(LIBIMAGES_MODS)))
$(o)/images/libimages.so: $(addsuffix .oo,$(addprefix $(o)/images/,$(LIBIMAGES_MODS)))
+$(o)/images/libimages.pc: $(LIBUCW)
-$(o)/images/image-tool: $(o)/images/image-tool.o $(LIBIMAGES) $(LIBIMAGES_DEPS)
-$(o)/images/image-tool: LIBS+=$(LIBIMAGES_LIBS)
-
-$(o)/images/color-tool: $(o)/images/color-tool.o $(LIBIMAGES) $(LIBIMAGES_DEPS)
-$(o)/images/color-tool: LIBS+=$(LIBIMAGES_LIBS)
-
-$(o)/images/image-dup-test: $(o)/images/image-dup-test.o $(LIBIMAGES) $(LIBIMAGES_DEPS)
-$(o)/images/image-dup-test: LIBS+=$(LIBIMAGES_LIBS)
-
-$(o)/images/image-sim-test: $(o)/images/image-sim-test.o $(LIBIMAGES) $(LIBIMAGES_DEPS)
-$(o)/images/image-sim-test: LIBS+=$(LIBIMAGES_LIBS)
+$(o)/images/image-tool: $(o)/images/image-tool.o $(LIBIMAGES)
+$(o)/images/color-tool: $(o)/images/color-tool.o $(LIBIMAGES)
+$(o)/images/image-dup-test: $(o)/images/image-dup-test.o $(LIBIMAGES)
+$(o)/images/image-sim-test: $(o)/images/image-sim-test.o $(LIBIMAGES)
TESTS+=$(o)/images/image-test.test
-$(o)/images/image-test: $(o)/images/image-test.o $(LIBIMAGES) $(LIBIMAGES_DEPS)
-$(o)/images/image-test: LIBS+=$(LIBIMAGES_LIBS)
+$(o)/images/image-test: $(o)/images/image-test.o $(LIBIMAGES)
$(o)/images/image-test.test: $(o)/images/image-test
TESTS+=$(o)/images/color.test
-$(o)/images/color-t: $(LIBIMAGES) $(LIBIMAGES_DEPS)
-$(o)/images/color-t: LIBS+=$(LIBIMAGES_LIBS) $(LIBIMAGES_DEPS)
+$(o)/images/color-t: $(LIBIMAGES)
$(o)/images/color.test: $(o)/images/color-t
INCLUDES+=$(o)/images/.include-stamp
--- /dev/null
+# pkg-config metadata for libimages
+
+Name: libimages
+Description: Sherlock image library
+Version: @SHERLOCK_VERSION@
+Libs: -Lobj/images -limages -lm -lpthread @LIBIMAGES_LIBS@
+Requires: @DEPS@
ifdef CONFIG_UCW_THREADS
# Some modules require threading
-LIBS+=-lpthread
LIBUCW_MODS+=threads-conf workqueue
LIBUCW_INCLUDES+=workqueue.h semaphore.h
endif
include $(s)/lib/getopt/Makefile
endif
-LIBUCW=$(o)/lib/libucw.$(LS)
+LIBUCW=$(o)/lib/libucw.pc
LIBUCW_MOD_PATHS=$(addprefix $(o)/lib/,$(LIBUCW_MODS))
$(o)/lib/libucw.a: $(addsuffix .o,$(LIBUCW_MOD_PATHS))
--- /dev/null
+# pkg-config metadata for libucw
+
+#ifdef CONFIG_UCW_THREADS
+threads=-lpthread
+#endif
+
+Name: libucw
+Description: A library of utility functions and data structures
+Version: @SHERLOCK_VERSION@
+Libs: -Lobj/lib -lucw ${threads}