Meta/Make: do not depend on installed git
[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 GIT=$HOME/git-master/bin/git
8 PATH=/usr/bin:/bin
9 LANG=C
10 LC_CTYPE=C
11 export PATH LANG LC_CTYPE
12
13 # for now...
14 #GIT_SVN_NO_LIB=1
15 #export GIT_SVN_NO_LIB
16
17 old_style_def_fix=b79d18c92d9f4841a6a1a29b7b2373a8ff9871e1
18
19 head=`$GIT symbolic-ref HEAD 2>/dev/null` &&
20 branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached
21
22 case "$branch" in
23 next | maint | master | pu)
24         d="prefix=$HOME/git-$branch" ;;
25 snap)
26         v=`$GIT describe HEAD`
27         expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
28             echo >&2 "You are on 'snap' but $v is not an official version."
29             exit 1
30         }
31         d="prefix=$HOME/git-snap-$v"
32         ;;
33 *)
34         d="prefix=$HOME/git-test gitexecdir=\$(prefix)/libexec/git-core" ;;
35 esac
36
37 : ${O=-O2}
38
39 while case $# in 0) break ;; esac
40 do 
41         case "$1" in
42         -pedantic)
43                 o= &&
44                 rev=$($GIT rev-parse HEAD) &&
45                 case "$($GIT merge-base "$old_style_def_fix" "$rev")" in
46                 $old_style_def_fix)
47                         o=-Wold-style-definition ;;
48                 esac
49                 O="$O -Werror $o -std=c99 -Wno-pointer-to-int-cast"
50                 O="$O -fwrapv -fno-strict-overflow"
51                 ;;
52         --)
53                 shift
54                 break
55                 ;;
56         -*)
57                 echo >&2 "Eh $1?"
58                 exit 1
59                 ;;
60         *)
61                 break
62                 ;;              
63         esac
64         shift
65 done
66
67 $GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version
68
69 make $d \
70      GITWEB_CONFIG=$G \
71      PYTHON_PATH=/usr/bin/python2.4 \
72      ETC_GITCONFIG=$d/etc/gitconfig \
73      CFLAGS="$O -Wall -Wdeclaration-after-statement -g" \
74      "$@"