Lucas De Marchi | 15cfa1d | 2014-12-25 23:12:22 -0200 | [diff] [blame] | 1 | #!/bin/sh |
Lucas De Marchi | 6ee2813 | 2017-02-23 21:58:15 -0800 | [diff] [blame] | 2 | |
Lucas De Marchi | 15cfa1d | 2014-12-25 23:12:22 -0200 | [diff] [blame] | 3 | set -e |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 4 | |
Lucas De Marchi | 6ee2813 | 2017-02-23 21:58:15 -0800 | [diff] [blame] | 5 | oldpwd=$(pwd) |
| 6 | topdir=$(dirname $0) |
| 7 | cd $topdir |
| 8 | |
Lucas De Marchi | 4fb900c | 2012-01-10 12:55:13 -0200 | [diff] [blame] | 9 | gtkdocize --docdir libkmod/docs || touch libkmod/docs/gtk-doc.make |
Lucas De Marchi | 6ee2813 | 2017-02-23 21:58:15 -0800 | [diff] [blame] | 10 | autoreconf --force --install --symlink |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 11 | |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 12 | libdir() { |
Lucas De Marchi | 6ee2813 | 2017-02-23 21:58:15 -0800 | [diff] [blame] | 13 | echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd) |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 14 | } |
| 15 | |
Lucas De Marchi | 6ee2813 | 2017-02-23 21:58:15 -0800 | [diff] [blame] | 16 | args="\ |
| 17 | --prefix=/usr \ |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 18 | --sysconfdir=/etc \ |
Lucas De Marchi | 6ee2813 | 2017-02-23 21:58:15 -0800 | [diff] [blame] | 19 | --libdir=$(libdir /usr/lib) \ |
| 20 | " |
| 21 | |
| 22 | if [ -f "$topdir/.config.args" ]; then |
| 23 | args="$args $(cat $topdir/.config.args)" |
| 24 | fi |
| 25 | |
| 26 | if [ ! -L /bin ]; then |
| 27 | args="$args \ |
| 28 | --with-rootprefix= \ |
| 29 | --with-rootlibdir=$(libdir /lib) \ |
| 30 | " |
| 31 | fi |
| 32 | |
| 33 | cd $oldpwd |
Lucas De Marchi | ecd40ee | 2011-11-21 12:35:15 -0200 | [diff] [blame] | 34 | |
Lucas De Marchi | 6ca7c09 | 2014-04-06 17:14:23 -0300 | [diff] [blame] | 35 | hackargs="--enable-debug --enable-python --with-xz --with-zlib" |
Lucas De Marchi | ae2612e | 2012-01-09 13:26:06 -0200 | [diff] [blame] | 36 | |
Lucas De Marchi | 6ee2813 | 2017-02-23 21:58:15 -0800 | [diff] [blame] | 37 | if [ "x$1" = "xc" ]; then |
| 38 | $topdir/configure CFLAGS='-g -O2' $args |
| 39 | make clean |
| 40 | elif [ "x$1" = "xg" ]; then |
| 41 | $topdir/configure CFLAGS='-g -Og' $args |
| 42 | make clean |
| 43 | elif [ "x$1" = "xl" ]; then |
| 44 | $topdir/configure CC=clang CXX=clang++ $args |
| 45 | make clean |
| 46 | elif [ "x$1" = "xa" ]; then |
| 47 | $topdir/configure CFLAGS='-g -O2 -Wsuggest-attribute=pure -Wsuggest-attribute=const' $args |
| 48 | make clean |
| 49 | elif [ "x$1" = "xs" ]; then |
| 50 | scan-build $topdir/configure CFLAGS='-g -O0 -std=gnu11' $args |
| 51 | scan-build make |
| 52 | else |
| 53 | echo |
| 54 | echo "----------------------------------------------------------------" |
| 55 | echo "Initialized build system. For a common configuration please run:" |
| 56 | echo "----------------------------------------------------------------" |
| 57 | echo |
| 58 | echo "$topdir/configure CFLAGS='-g -O2' $args" |
| 59 | echo |
| 60 | echo If you are debugging or hacking on kmod, consider configuring |
| 61 | echo like below: |
| 62 | echo |
| 63 | echo "$topdir/configure CFLAGS="-g -O2" $args $hackargs" |
| 64 | fi |