Meta/Dothem: support multi-arch $HOME directory better
[git/spearce.git] / Make
blob98bc272c8c04e0b08185d4d94be3df8ffd0e11c7
1 #!/bin/sh
3 G=/opt/packrat/playpen/public/in-place/git/index/gitweb_config.perl
5 case "$(git version 2>/dev/null)" in
6 "git version"*)
7 GIT=git ;;
8 *)
9 echo >&2 "No git to bootstrap"
10 exit 1 ;;
11 esac
13 inst_prefix=$(
14 IFS=:
15 for p in $PATH
17 probed=${p%/git-active/bin}
18 if test "$probed" != "$p"
19 then
20 echo "$probed"
21 exit
23 done
24 echo $HOME
27 LANG=C
28 old_style_def_fix=b79d18c92d9f4841a6a1a29b7b2373a8ff9871e1
30 : ${O=-O2}
31 Wall=-Wall tests=
32 while case $# in 0) break ;; esac
33 do
34 case "$1" in
35 -pedantic | --pedantic)
36 o= &&
37 rev=$($GIT rev-parse HEAD) &&
38 case "$($GIT merge-base "$old_style_def_fix" "$rev")" in
39 $old_style_def_fix)
40 o=-Wold-style-definition ;;
41 esac
42 O="$O -Werror $o -std=c99 -Wno-pointer-to-int-cast"
43 # O="$O -fwrapv -fno-strict-overflow"
45 -loose | --loose)
46 Wall=
48 --locale=*)
49 LANG=${1#*=}
51 --test=*)
52 tests=$(
53 cd t &&
54 for t in ${1#*=}
56 eval echo "t$t-*.sh"
57 done | tr '\012' ' '
60 --)
61 shift
62 break
64 -*)
65 echo >&2 "Eh $1?"
66 exit 1
69 break
70 ;;
71 esac
72 shift
73 done
75 LC_ALL=$LANG
76 export LANG LC_ALL
78 head=`$GIT symbolic-ref HEAD 2>/dev/null` &&
79 branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached
81 case "$branch" in
82 next | maint | master | pu | jch)
83 prefix="$inst_prefix/git-$branch"
85 snap)
86 v=`$GIT describe HEAD`
87 expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
88 echo >&2 "You are on 'snap' but $v is not an official version."
89 exit 1
91 prefix="$inst_prefix/git-snap-$v"
94 prefix="$inst_prefix/git-test" ;;
95 esac
96 d="prefix=$prefix"
98 sh -c 'git describe --abbrev=4 HEAD' >/dev/null 2>&1 || {
99 $GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version
102 d="$d ASCIIDOC_NO_ROFF=YesPlease ASCIIDOC8=YesPlease"
104 CFLAGS="$O $Wall -Wdeclaration-after-statement -g"
106 make $d \
107 GITWEB_CONFIG=$G \
108 PYTHON_PATH=/usr/bin/python2.4 \
109 ETC_GITCONFIG=$prefix/etc/gitconfig \
110 CFLAGS="$CFLAGS" \
111 ${tests:+"T=$tests"} \
112 "$@"
113 status=$?
114 rm -f version
115 exit $status