Meta/Dothem: do not barf if /dev/shm is not writable
[git/jrn.git] / Make
blob1184ecdad92ef0f6c2fbe82a0d2db0541fced8ee
1 #!/bin/sh
3 if test -z "$GIT"
4 then
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
14 inst_prefix=$(
15 IFS=:
16 for p in $PATH
18 probed=${p%/git-active/bin}
19 if test "$probed" != "$p"
20 then
21 echo "$probed"
22 exit
24 done
25 echo $HOME
28 LANG=C
29 old_style_def_fix=b79d18c92d9f4841a6a1a29b7b2373a8ff9871e1
31 : ${O=-O2}
33 for cv in PYTHON_PATH=python TCL_PATH=tclsh TCLTKPATH=wish
35 cmd=${cv#*=}
36 var=${cv%=*}
37 eval $(
38 if test -f "/usr/bin/$cmd"
39 then
40 break
42 for p in /usr/bin /usr/local/bin
44 if test -f "$p/$cmd"
45 then
46 echo "$var=$p/$cmd; export $var"
47 break
49 found=$(find "$p/$cmd"* -type f 2>/dev/null | head -n 1)
50 if test -f "$found"
51 then
52 echo "$var=$found; export $var"
53 break
55 done
57 done
59 Wall='-Wall -Wdeclaration-after-statement' tests= jobs= skip= oldtest=
60 case `uname` in
61 OpenBSD)
62 O="-fgnu89-inline"
63 skip="t9402"
65 FreeBSD)
66 OLD_ICONV=YesPlease; export OLD_ICONV
67 skip="t5560"
69 SunOS)
70 NEEDS_CRYPTO_WITH_SSL=YesPlease ; export NEEDS_CRYPTO_WITH_SSL
71 NO_PEDANTIC=CannotDo Wall=
73 esac
75 while case $# in 0) break ;; esac
76 do
77 case "$1" in
78 -pedantic | --pedantic)
79 o= &&
80 rev=$($GIT rev-parse HEAD) &&
81 case "$($GIT merge-base "$old_style_def_fix" "$rev")" in
82 $old_style_def_fix)
83 o=-Wold-style-definition ;;
84 esac
85 case "$NO_PEDANTIC" in
86 ?*) ;;
87 '')
88 O="$O -Werror $o -std=c99 -Wno-pointer-to-int-cast"
89 O="$O -Wpointer-arith -Woverflow -Wunused"
91 esac
92 # -Wvla
93 # O="$O -fwrapv -fno-strict-overflow"
95 -j*)
96 case "$NO_JOBS" in
97 ?*) jobs= ;;
98 '') jobs=$1 ;;
99 esac
101 -noprove | --noprove)
102 oldtest=t
104 -loose | --loose)
105 Wall=
107 --locale=*)
108 LANG=${1#*=}
110 --test=*)
111 tests=$(
112 cd t &&
113 for t in ${1#*=}
115 eval echo "t$t-*.sh"
116 done | tr '\012' ' '
120 shift
121 break
124 echo >&2 "Eh $1?"
125 exit 1
128 break
130 esac
131 shift
132 done
134 if test -z "$tests" && test -n "$skip"
135 then
136 : GIT_SKIP_TESTS="${GIT_SKIP_TESTS:-$skip}"
138 if test -z "$oldtest" &&
139 sh -c 'prove --version >/dev/null 2>&1' &&
140 sh -c 'prove --exec : >/dev/null 2>&1'
141 then
142 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$jobs"
143 export DEFAULT_TEST_TARGET GIT_PROVE_OPTS
146 LC_ALL=$LANG
147 export LANG LC_ALL
149 head=`$GIT symbolic-ref HEAD 2>/dev/null` &&
150 branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached
152 case "$branch" in
153 next | maint | master | pu | jch)
154 prefix="$inst_prefix/git-$branch"
156 snap)
157 v=`$GIT describe HEAD`
158 expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
159 echo >&2 "You are on 'snap' but $v is not an official version."
160 exit 1
162 prefix="$inst_prefix/git-snap-$v"
165 prefix="$inst_prefix/git-test" ;;
166 esac
167 d="prefix=$prefix"
169 sh -c 'git describe --abbrev=4 HEAD' >/dev/null 2>&1 || {
170 $GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version
173 d="$d "'
174 MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
175 ASCIIDOC_NO_ROFF=YesPlease
176 ASCIIDOC8=YesPlease
177 BLK_SHA1=YesPlease
178 GNU_ROFF=YesPlease'
180 # Platform hack
181 if test -z "${make:+set}" && {
182 test -x /usr/local/bin/gmake ||
183 test -x /usr/bin/gmake
185 then
186 make=gmake
188 if test -f /bin/ginstall
189 then
190 set INSTALL=ginstall "$@"
193 CFLAGS="$O $Wall -g"
194 OK_TO_USE_CFLAGS=Yes
195 if test -n "${NO_CFLAGS+set}"
196 then
197 unset OK_TO_USE_CFLAGS
200 ${make-make} $d \
201 ETC_GITCONFIG=$prefix/etc/gitconfig \
202 ${OK_TO_USE_CFLAGS+"CFLAGS=$CFLAGS"} \
203 ${tests:+"T=$tests"} \
204 $jobs \
205 "$@"
206 status=$?
207 rm -f version
208 exit $status