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-rootlibdir=$(libdir /lib) \ 29 " 30fi 31 32cd $oldpwd 33 34hackargs="\ 35--enable-debug \ 36--with-zstd \ 37--with-xz \ 38--with-zlib \ 39--with-openssl \ 40" 41 42if [ "x$1" = "xc" ]; then 43 shift 44 $topdir/configure CFLAGS='-g -O2' $args $hackargs "$@" 45 make clean 46elif [ "x$1" = "xg" ]; then 47 shift 48 $topdir/configure CFLAGS='-g -Og' $args "$@" 49 make clean 50elif [ "x$1" = "xl" ]; then 51 shift 52 $topdir/configure CC=clang CXX=clang++ $args "$@" 53 make clean 54elif [ "x$1" = "xa" ]; then 55 shift 56 $topdir/configure CFLAGS='-g -O2 -Wsuggest-attribute=pure -Wsuggest-attribute=const' $args "$@" 57 make clean 58elif [ "x$1" = "xs" ]; then 59 shift 60 scan-build $topdir/configure CFLAGS='-g -O0 -std=gnu11' $args "$@" 61 scan-build make 62else 63 echo 64 echo "----------------------------------------------------------------" 65 echo "Initialized build system. For a common configuration please run:" 66 echo "----------------------------------------------------------------" 67 echo 68 echo "$topdir/configure CFLAGS='-g -O2' $args" 69 echo 70 echo If you are debugging or hacking on kmod, consider configuring 71 echo like below: 72 echo 73 echo "$topdir/configure CFLAGS='-g -O2' $args $hackargs" 74fi 75