blob: a867b488a29e607953f66f399943bec39dac0f59 (
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 somelib --cflags --libs)
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
|