]> granicus.if.org Git - postgresql/blob - src/tools/msvc/build.pl
c4e4dc79a34a026e755200fc51743296c6e75c2e
[postgresql] / src / tools / msvc / build.pl
1 # -*-perl-*- hey - emacs - this is a perl file
2
3 # src/tools/msvc/build.pl
4
5 BEGIN
6 {
7
8         chdir("../../..") if (-d "../msvc" && -d "../../../src");
9
10 }
11
12 use lib "src/tools/msvc";
13
14 use Cwd;
15
16 use Mkvcbuild;
17
18 # buildenv.pl is for specifying the build environment settings
19 # it should contain lines like:
20 # $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
21
22 if (-e "src/tools/msvc/buildenv.pl")
23 {
24         require "src/tools/msvc/buildenv.pl";
25 }
26 elsif (-e "./buildenv.pl")
27 {
28         require "./buildenv.pl";
29 }
30
31 # set up the project
32 our $config;
33 require "config_default.pl";
34 require "config.pl" if (-f "src/tools/msvc/config.pl");
35
36 my $vcver = Mkvcbuild::mkvcbuild($config);
37
38 # check what sort of build we are doing
39
40 my $bconf     = $ENV{CONFIG} || "Release";
41 my $buildwhat = $ARGV[1]     || "";
42 if (uc($ARGV[0]) eq 'DEBUG')
43 {
44         $bconf = "Debug";
45 }
46 elsif (uc($ARGV[0]) ne "RELEASE")
47 {
48         $buildwhat = $ARGV[0] || "";
49 }
50
51 # ... and do it
52
53 if ($buildwhat and $vcver >= 10.00)
54 {
55         system(
56 "msbuild $buildwhat.vcxproj /verbosity:normal /p:Configuration=$bconf");
57 }
58 elsif ($buildwhat)
59 {
60         system("vcbuild $buildwhat.vcproj $bconf");
61 }
62 else
63 {
64         system("msbuild pgsql.sln /verbosity:normal /p:Configuration=$bconf");
65 }
66
67 # report status
68
69 $status = $? >> 8;
70
71 exit $status;