add a perl script to convert MaintNotes to wiki format
[git/dscho.git] / Make
blob107b9579f70e15f285948dd5c6e9fdd44a485cea
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 NO_PEDANTIC=CannotDo Wall=
63 FreeBSD)
64 OLD_ICONV=YesPlease; export OLD_ICONV
65 GIT_SKIP_TESTS="t5560 $GIT_SKIP_TESTS"; export GIT_SKIP_TESTS
67 SunOS)
68 NEEDS_CRYPTO_WITH_SSL=YesPlease ; export NEEDS_CRYPTO_WITH_SSL
69 GIT_SKIP_TESTS="$GIT_SKIP_TESTS"; export GIT_SKIP_TESTS
70 NO_PEDANTIC=CannotDo Wall=
72 esac
74 while case $# in 0) break ;; esac
75 do
76 case "$1" in
77 -pedantic | --pedantic)
78 o= &&
79 rev=$($GIT rev-parse HEAD) &&
80 case "$($GIT merge-base "$old_style_def_fix" "$rev")" in
81 $old_style_def_fix)
82 o=-Wold-style-definition ;;
83 esac
84 case "$NO_PEDANTIC" in
85 ?*) ;;
86 '')
87 O="$O -Werror $o -std=c99 -Wno-pointer-to-int-cast" ;;
88 esac
89 # -Wvla
90 # O="$O -fwrapv -fno-strict-overflow"
92 -j*)
93 jobs=$1
95 -loose | --loose)
96 Wall=
98 --locale=*)
99 LANG=${1#*=}
101 --test=*)
102 tests=$(
103 cd t &&
104 for t in ${1#*=}
106 eval echo "t$t-*.sh"
107 done | tr '\012' ' '
111 shift
112 break
115 echo >&2 "Eh $1?"
116 exit 1
119 break
121 esac
122 shift
123 done
125 LC_ALL=$LANG
126 export LANG LC_ALL
128 head=`$GIT symbolic-ref HEAD 2>/dev/null` &&
129 branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached
131 case "$branch" in
132 next | maint | master | pu | jch)
133 prefix="$inst_prefix/git-$branch"
135 snap)
136 v=`$GIT describe HEAD`
137 expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
138 echo >&2 "You are on 'snap' but $v is not an official version."
139 exit 1
141 prefix="$inst_prefix/git-snap-$v"
144 prefix="$inst_prefix/git-test" ;;
145 esac
146 d="prefix=$prefix"
148 sh -c 'git describe --abbrev=4 HEAD' >/dev/null 2>&1 || {
149 $GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version
152 d="$d "'
153 MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
154 ASCIIDOC_NO_ROFF=YesPlease
155 ASCIIDOC8=YesPlease
156 BLK_SHA1=YesPlease
157 GNU_ROFF=YesPlease'
159 # Platform hack
160 if test -z "${make:+set}" && {
161 test -x /usr/local/bin/gmake ||
162 test -x /usr/bin/gmake
164 then
165 make=gmake
167 if test -f /bin/ginstall
168 then
169 set INSTALL=ginstall "$@"
172 CFLAGS="$O $Wall -g"
173 OK_TO_USE_CFLAGS=Yes
174 if test -n "${NO_CFLAGS+set}"
175 then
176 unset OK_TO_USE_CFLAGS
179 ${make-make} $d \
180 ETC_GITCONFIG=$prefix/etc/gitconfig \
181 ${OK_TO_USE_CFLAGS+"CFLAGS=$CFLAGS"} \
182 ${tests:+"T=$tests"} \
183 $jobs \
184 "$@"
185 status=$?
186 rm -f version
187 exit $status