Meta/Make: allow building from a detached HEAD
[git] / Make
1 #!/bin/sh
2
3 # DDD=' -DUSE_SYMLINK_HEAD=0'
4 # PATH=/usr/bin:/bin
5
6 G=/opt/packrat/playpen/public/in-place/git/index/gitweb_config.perl
7 PATH=$HOME/git-master/bin:/usr/bin:/bin
8 LANG=C
9 LC_CTYPE=C
10 export PATH LANG LC_CTYPE
11
12 # for now...
13 #GIT_SVN_NO_LIB=1
14 #export GIT_SVN_NO_LIB
15
16 head=`git symbolic-ref HEAD 2>/dev/null` &&
17 branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached
18
19 case "$branch" in
20 next | maint | master | pu)
21         d="prefix=$HOME/git-$branch" ;;
22 snap)
23         v=`git describe HEAD`
24         expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
25             echo >&2 "You are on 'snap' but $v is not an official version."
26             exit 1
27         }
28         d="prefix=$HOME/git-snap-$v"
29         ;;
30 *)
31         d="prefix=$HOME/git-test" ;;
32 esac
33
34 : ${O=-O2}
35
36 while case $# in 0) break ;; esac
37 do 
38         case "$1" in
39         -pedantic)
40                 O="$O -Werror -Wall -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=600"
41                 ;;
42         --)
43                 shift
44                 break
45                 ;;
46         -*)
47                 echo >&2 "Eh $1?"
48                 exit 1
49                 ;;
50         *)
51                 break
52                 ;;              
53         esac
54         shift
55 done
56
57 make $d \
58      GITWEB_CONFIG=$G \
59      PYTHON_PATH=/usr/bin/python2.4 \
60      CFLAGS="$O -Wall -Wdeclaration-after-statement -g" \
61      "$@"