1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
<?xml version="1.0"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="all">
<Target Name="all" DependsOnTargets="plugin_debugger" />
<Import Project="settings.projinc" />
<!-- Detect if we're running against community PostgreSQL, or
EnterpriseDB's Advanced Server. When building against EDB, we include
support for debugging the SPL language.
-->
<Choose>
<When Condition="Exists('$(PGPATH)\src\pl\edb-spl')">
<PropertyGroup>
<postgres>edb-postgres</postgres>
<SPL_SUPPORT>1</SPL_SUPPORT>
<SPL_CFLAGS>/D "INCLUDE_PACKAGE_SUPPORT"</SPL_CFLAGS>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<postgres>postgres</postgres>
</PropertyGroup>
</Otherwise>
</Choose>
<!-- Setup for Debug or Release -->
<Choose>
<When Condition="'$(DEBUG)'=='1'">
<PropertyGroup>
<XTRA_CFLAGS>/Od /MDd /Zi /D "DEBUG=1" /D "_DEBUG"</XTRA_CFLAGS>
<XTRA_LDFLAGS>/DEBUG /defaultlib:$(PGPATH)\Debug\$(postgres)\$(postgres).lib</XTRA_LDFLAGS>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<XTRA_CFLAGS>/Ox /MD /GF</XTRA_CFLAGS>
<XTRA_LDFLAGS>/defaultlib:$(PGPATH)\Release\$(postgres)\$(postgres).lib</XTRA_LDFLAGS>
</PropertyGroup>
</Otherwise>
</Choose>
<!-- Architecture-specific compiler flags -->
<Choose>
<When Condition="'$(ARCH)'=='x64'">
<PropertyGroup>
<XTRA_ARCH_CFLAGS></XTRA_ARCH_CFLAGS>
<XTRA_ARCH_LDFLAGS>/MACHINE:X64</XTRA_ARCH_LDFLAGS>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<XTRA_ARCH_CFLAGS>/D "_USE_32BIT_TIME_T"</XTRA_ARCH_CFLAGS>
<XTRA_ARCH_LDFLAGS></XTRA_ARCH_LDFLAGS>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<!-- Compiler flags -->
<CFLAGS>/nologo /wd4273 /TC /LD $(XTRA_CFLAGS) /D "WIN32" /D "__WIN32__" $(XTRA_ARCH_CFLAGS) /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "_WINDLL" /D "_MBCS"</CFLAGS>
<!-- Linker flags -->
<LDFLAGS>/DLL $(XTRA_LDFLAGS) $(XTRA_ARCH_LDFLAGS) /defaultlib:user32 /defaultlib:netapi32 /defaultlib:advapi32 /defaultlib:shell32 /defaultlib:ws2_32 /defaultlib:Secur32.lib</LDFLAGS>
</PropertyGroup>
<ItemGroup>
<IncludeDirs Include="/I$(PGPATH)\src\include" />
<IncludeDirs Include="/I$(PGPATH)\src\include\port\win32" />
<IncludeDirs Include="/I$(PGPATH)\src\include\port\win32_msvc" />
<IncludeDirs Include="/I$(PGPATH)\src\port" />
<IncludeDirs Include="/I$(PGPATH)\src\pl\plpgsql\src" />
<IncludeDirs Include="/I$(PGPATH)\src\pl\edb-spl\src" />
<IncludeDirs Include="/I$(GETTEXTPATH)\include" />
<IncludeDirs Include="/I$(OPENSSLPATH)\include" />
<IncludeDirs Include="/I$(KERBEROSPATH)\inc\krb5" />
</ItemGroup>
<!-- Common source files -->
<ItemGroup>
<CommonSrc Include="plugin_debugger" />
<CommonSrc Include="dbgcomm" />
<CommonSrc Include="pldbgapi" />
</ItemGroup>
<!-- Source files specific to PL languages -->
<ItemGroup>
<PLLangSrc Include="plpgsql_debugger" />
<PLLangSrc Include="spl_debugger" Condition="'$(SPL_SUPPORT)'=='1'" />
</ItemGroup>
<Target Name="plugin_debugger"
Inputs="@(CommonSrc)"
Outputs="plugin_debugger.dll"
DependsOnTargets="plpgsql_debugger;spl_debugger">
<Message Text="Building plugin_debugger.dll" />
<!-- Compile the common source files. -->
<Exec Command="cl $(CFLAGS) /c @(IncludeDirs, ' ') %(CommonSrc.Identity).c $(SPL_CFLAGS)" />
<!-- Link all the object files, including language-specific ones, to
plugin_debugger.dll -->
<Exec Command="link @(CommonSrc -> '%(Filename).obj', ' ') @(PLLangSrc -> '%(Filename).obj', ' ') /def:plugin_debugger.def $(LDFLAGS)" />
</Target>
<Target Name="plpgsql_debugger"
Inputs="plpgsql_debugger.c"
Outputs="plpgsql_debugger.obj">
<Exec Command="cl $(CFLAGS) /c @(IncludeDirs, ' ') plpgsql_debugger.c" />
</Target>
<!-- Produce spl_debugger.c from plpgsql_debugger.c, by doing a text
search & replace of "plpgsql_" with "spl_" -->
<Target Name="spl_debugger" Inputs="plpgsql_debugger.c" Outputs="spl_debugger.obj"
Condition="'$(SPL_SUPPORT)'=='1'">
<!-- There is no easy way to do search & replace in MSBuild, at least
not before version 4, so shell out to perl for this -->
<Exec command="perl -p -e s/plpgsql_/spl_/g < plpgsql_debugger.c > spl_debugger.c" />
<Exec Command="cl $(CFLAGS) /c @(IncludeDirs, ' ') spl_debugger.c $(SPL_CFLAGS)" />
</Target>
<Target Name="clean">
<Delete Files="plugin_debugger.dll" />
<Delete Files="plugin_debugger.exp" />
<Delete Files="plugin_debugger.lib" />
<Delete Files="plugin_debugger.dll.manifest" />
<Delete Files="@(CommonSrc -> '%(Filename).obj')" />
<Delete Files="@(PLLangSrc -> '%(Filename).obj')" />
<Delete Files="spl_debugger.c" />
</Target>
</Project>
|