• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3set -e
4
5oldpwd=$(pwd)
6topdir=$(dirname $0)
7cd $topdir
8
9gtkdocize --docdir libkmod/docs || touch libkmod/docs/gtk-doc.make
10autoreconf --force --install --symlink
11
12libdir() {
13        echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd)
14}
15
16args="\
17--prefix=/usr \
18--sysconfdir=/etc \
19--libdir=$(libdir /usr/lib) \
20"
21
22if [ -f "$topdir/.config.args" ]; then
23    args="$args $(cat $topdir/.config.args)"
24fi
25
26if [ ! -L /bin ]; then
27    args="$args \
28        --with-rootprefix= \
29        --with-rootlibdir=$(libdir /lib) \
30        "
31fi
32
33cd $oldpwd
34
35hackargs="\
36--enable-debug \
37--enable-python \
38--with-zstd \
39--with-xz \
40--with-zlib \
41--with-openssl \
42"
43
44if [ "x$1" = "xc" ]; then
45        shift
46        $topdir/configure CFLAGS='-g -O2' $args $hackargs "$@"
47        make clean
48elif [ "x$1" = "xg" ]; then
49        shift
50        $topdir/configure CFLAGS='-g -Og' $args "$@"
51        make clean
52elif [ "x$1" = "xl" ]; then
53        shift
54        $topdir/configure CC=clang CXX=clang++ $args "$@"
55        make clean
56elif [ "x$1" = "xa" ]; then
57        shift
58        $topdir/configure CFLAGS='-g -O2 -Wsuggest-attribute=pure -Wsuggest-attribute=const' $args "$@"
59        make clean
60elif [ "x$1" = "xs" ]; then
61        shift
62        scan-build $topdir/configure CFLAGS='-g -O0 -std=gnu11' $args "$@"
63        scan-build make
64else
65        echo
66        echo "----------------------------------------------------------------"
67        echo "Initialized build system. For a common configuration please run:"
68        echo "----------------------------------------------------------------"
69        echo
70        echo "$topdir/configure CFLAGS='-g -O2' $args"
71        echo
72        echo If you are debugging or hacking on kmod, consider configuring
73        echo like below:
74        echo
75        echo "$topdir/configure CFLAGS='-g -O2' $args $hackargs"
76fi
77