What's cooking (2010/10 #01)
[alt-git.git] / Make
blobd166e0399c911b24d6400272d4ee168a6d15496f
1 #!/bin/sh
3 case "$(git version 2>/dev/null)" in
4 "git version"*)
5 GIT=git ;;
6 *)
7 echo >&2 "No git to bootstrap"
8 exit 1 ;;
9 esac
11 inst_prefix=$(
12 IFS=:
13 for p in $PATH
15 probed=${p%/git-active/bin}
16 if test "$probed" != "$p"
17 then
18 echo "$probed"
19 exit
21 done
22 echo $HOME
25 LANG=C
26 old_style_def_fix=b79d18c92d9f4841a6a1a29b7b2373a8ff9871e1
28 : ${O=-O2}
30 for cv in PYTHON_PATH=python TCL_PATH=tclsh TCLTKPATH=wish
32 cmd=${cv#*=}
33 var=${cv%=*}
34 eval $(
35 if test -f "/usr/bin/$cmd"
36 then
37 break
39 for p in /usr/bin /usr/local/bin
41 if test -f "$p/$cmd"
42 then
43 echo "$var=$p/$cmd; export $var"
44 break
46 found=$(find "$p/$cmd"* -type f 2>/dev/null | head -n 1)
47 if test -f "$found"
48 then
49 echo "$var=$found; export $var"
50 break
52 done
54 done
56 Wall='-Wall -Wdeclaration-after-statement' tests= jobs=
57 case `uname` in
58 OpenBSD)
59 NEEDS_CRYPTO_WITH_SSL=YesPlease ; export NEEDS_CRYPTO_WITH_SSL
60 GIT_SKIP_TESTS="t9200 t9502 $GIT_SKIP_TESTS"; export GIT_SKIP_TESTS
61 SHELL_PATH=/usr/local/bin/bash; export SHELL_PATH
62 NO_PEDANTIC=CannotDo NO_JOBS=CannotDo
63 Wall=
65 FreeBSD)
66 OLD_ICONV=YesPlease; export OLD_ICONV
67 GIT_SKIP_TESTS="t5560 $GIT_SKIP_TESTS"; export GIT_SKIP_TESTS
69 SunOS)
70 NEEDS_CRYPTO_WITH_SSL=YesPlease ; export NEEDS_CRYPTO_WITH_SSL
71 GIT_SKIP_TESTS="$GIT_SKIP_TESTS"; export GIT_SKIP_TESTS
72 NO_PEDANTIC=CannotDo Wall=
74 esac
76 while case $# in 0) break ;; esac
77 do
78 case "$1" in
79 -pedantic | --pedantic)
80 o= &&
81 rev=$($GIT rev-parse HEAD) &&
82 case "$($GIT merge-base "$old_style_def_fix" "$rev")" in
83 $old_style_def_fix)
84 o=-Wold-style-definition ;;
85 esac
86 case "$NO_PEDANTIC" in
87 ?*) ;;
88 '')
89 O="$O -Werror $o -std=c99 -Wno-pointer-to-int-cast"
90 O="$O -Wpointer-arith"
92 esac
93 # -Wvla
94 # O="$O -fwrapv -fno-strict-overflow"
96 -j*)
97 case "$NO_JOBS" in
98 ?*) jobs= ;;
99 '') jobs=$1 ;;
100 esac
102 -loose | --loose)
103 Wall=
105 --locale=*)
106 LANG=${1#*=}
108 --test=*)
109 tests=$(
110 cd t &&
111 for t in ${1#*=}
113 eval echo "t$t-*.sh"
114 done | tr '\012' ' '
118 shift
119 break
122 echo >&2 "Eh $1?"
123 exit 1
126 break
128 esac
129 shift
130 done
132 LC_ALL=$LANG
133 export LANG LC_ALL
135 head=`$GIT symbolic-ref HEAD 2>/dev/null` &&
136 branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached
138 case "$branch" in
139 next | maint | master | pu | jch)
140 prefix="$inst_prefix/git-$branch"
142 snap)
143 v=`$GIT describe HEAD`
144 expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
145 echo >&2 "You are on 'snap' but $v is not an official version."
146 exit 1
148 prefix="$inst_prefix/git-snap-$v"
151 prefix="$inst_prefix/git-test" ;;
152 esac
153 d="prefix=$prefix"
155 sh -c 'git describe --abbrev=4 HEAD' >/dev/null 2>&1 || {
156 $GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version
159 d="$d "'
160 MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
161 ASCIIDOC_NO_ROFF=YesPlease
162 ASCIIDOC8=YesPlease
163 BLK_SHA1=YesPlease
164 GNU_ROFF=YesPlease'
166 # Platform hack
167 if test -z "${make:+set}" && {
168 test -x /usr/local/bin/gmake ||
169 test -x /usr/bin/gmake
171 then
172 make=gmake
174 if test -f /bin/ginstall
175 then
176 set INSTALL=ginstall "$@"
179 CFLAGS="$O $Wall -g"
180 OK_TO_USE_CFLAGS=Yes
181 if test -n "${NO_CFLAGS+set}"
182 then
183 unset OK_TO_USE_CFLAGS
186 ${make-make} $d \
187 ETC_GITCONFIG=$prefix/etc/gitconfig \
188 ${OK_TO_USE_CFLAGS+"CFLAGS=$CFLAGS"} \
189 ${tests:+"T=$tests"} \
190 $jobs \
191 "$@"
192 status=$?
193 rm -f version
194 exit $status