summaryrefslogtreecommitdiffstats
path: root/test cases/common/230 external project/libfoo/configure
blob: 0e4aa72b22b9fc7815d19554b8b3cd361b88f1b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /bin/sh

srcdir=$(dirname "$0")

for i in "$@"
do
case $i in
    --prefix=*)
    PREFIX="${i#*=}"
    shift
    ;;
    --libdir=*)
    LIBDIR="${i#*=}"
    shift
    ;;
    --includedir=*)
    INCDIR="${i#*=}"
    shift
    ;;
    --libext=*)
    LIBEXT="${i#*=}"
    shift
    ;;
    *)
    shift
    ;;
esac
done

DEP_ARGS=$(pkg-config --cflags --libs somelib)

cat > Makefile << EOL
all: libfoo.$LIBEXT

libfoo.$LIBEXT:
	$CC "$srcdir/libfoo.c" -shared -fPIC $DEP_ARGS -o \$@

install: libfoo.$LIBEXT
	mkdir -p "\$(DESTDIR)$LIBDIR";
	mkdir -p "\$(DESTDIR)$LIBDIR/pkgconfig";
	mkdir -p "\$(DESTDIR)$INCDIR";
	cp \$< "\$(DESTDIR)$LIBDIR";
	cp "$srcdir/libfoo.h" "\$(DESTDIR)$INCDIR";
EOL