Add the vimtutor shell script
[msysgit.git] / bin / msvc-build
blob5e059840178f0aa4b3e1384550bf3dbd366ca0f5
1 #!/bin/sh
3 set -e
5 gui=
6 clean=
7 while test $# -gt 0
8 do
9 case "$1" in
10 --gui|--dev|--devenv|--vs|--visual-studio)
11 gui=t
13 clean)
14 clean=t
17 echo "Usage: $0 [--vs] [clean]" >&2
18 exit 1
20 esac
21 shift
22 done
24 cd /git
26 case "$clean" in
28 case "$gui" in
30 rm -rf git.sln libgit
32 '')
33 make clean
35 esac
36 exit
38 esac
40 to_ignore="$(git ls-files --other --exclude-standard msvcgit msvc-build.cmd)"
41 test -z "$to_ignore" || {
42 mkdir -p .git/info &&
43 echo "$to_ignore" |
44 sed 's/^/\//' >> .git/info/exclude
45 } || exit
47 test -d msvcgit || git clone git://repo.or.cz/msvcgit.git
49 vsvars=
50 type cl.exe 2> /dev/null ||
51 vsvars="$(ls -t \
52 "$PROGRAMFILES/Microsoft Visual Studio"*/Common7/Tools/vsvars32.bat |
53 head -n 1)"
55 config_mak=
56 test -f config.mak &&
57 config_mak=config.mak.bup.$$ &&
58 mv config.mak $config_mak
60 cat > config.mak << EOF
61 CFLAGS += -Imsvcgit/32bits/include
62 LDFLAGS += -Lmsvcgit/32bits/lib
63 EOF
65 echo "call \"$vsvars\"" > msvc-build.cmd
66 if test -z "$gui"
67 then
68 echo 'make MSVC=1' >> msvc-build.cmd
69 else
70 echo 'perl contrib/buildsystems/generate -g Vcproj' >> msvc-build.cmd
71 echo 'start git.sln' >> msvc-build.cmd
74 cmd /c msvc-build.cmd
76 test -z "$config_mak" ||
77 mv $config_mak config.mak