blob: 8f31803dbb752a6fbf8e5f5bb457e92edddc7fc4 (
plain)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<_PegenSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
<_PegenOutputs Include="$(PySourcePath)Parser\parser.c" />
<_ASTSources Include="$(PySourcePath)Parser\Python.asdl" />
<_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast.h">
<Argument>-H</Argument>
</_ASTOutputs>
<_ASTOutputs Include="$(PySourcePath)Include\internal\pycore_ast_state.h">
<Argument>-I</Argument>
</_ASTOutputs>
<_ASTOutputs Include="$(PySourcePath)Python\Python-ast.c">
<Argument>-C</Argument>
</_ASTOutputs>
<_TokenSources Include="$(PySourcePath)Grammar\Tokens" />
<_TokenOutputs Include="$(PySourcePath)Doc\library\token-list.inc">
<Format>rst</Format>
</_TokenOutputs>
<_TokenOutputs Include="$(PySourcePath)Include\internal\pycore_token.h">
<Format>h</Format>
</_TokenOutputs>
<_TokenOutputs Include="$(PySourcePath)Parser\token.c">
<Format>c</Format>
</_TokenOutputs>
<_TokenOutputs Include="$(PySourcePath)Lib\token.py">
<Format>py</Format>
</_TokenOutputs>
<_KeywordSources Include="$(PySourcePath)Grammar\python.gram;$(PySourcePath)Grammar\Tokens" />
<_KeywordOutputs Include="$(PySourcePath)Lib\keyword.py" />
<!-- Taken from _Target._compute_digest in Tools\jit\_targets.py: -->
<_JITSources Include="$(PySourcePath)Python\executor_cases.c.h;$(GeneratedPyConfigDir)pyconfig.h;$(PySourcePath)Tools\jit\**"/>
<_JITOutputs Include="$(GeneratedPyConfigDir)jit_stencils.h"/>
<_CasesSources Include="$(PySourcePath)Python\bytecodes.c;$(PySourcePath)Python\tier2_redundancy_eliminator_bytecodes.c;"/>
<_CasesOutputs Include="$(PySourcePath)Python\generated_cases.c.h;$(PySourcePath)Include\opcode_ids.h;$(PySourcePath)Include\internal\pycore_uop_ids.h;$(PySourcePath)Python\opcode_targets.h;$(PySourcePath)Include\internal\pycore_opcode_metadata.h;$(PySourcePath)Include\internal\pycore_uop_metadata.h;$(PySourcePath)Python\tier2_redundancy_eliminator_cases.c.h;$(PySourcePath)Lib\_opcode_metadata.py"/>
</ItemGroup>
<Target Name="_TouchRegenSources" Condition="$(ForceRegen) == 'true'">
<Message Text="Touching source files to force regeneration" Importance="high" />
<Touch Files="@(_PegenSources);@(_ASTSources);@(_TokenSources);@(_KeywordOutputs);@(_CasesSources)"
AlwaysCreate="False" />
</Target>
<Target Name="_RegenPegen"
Inputs="@(_PegenSources)" Outputs="@(_PegenOutputs)"
DependsOnTargets="FindPythonForBuild">
<Message Text="Regenerate @(_PegenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
<!-- Specify python.gram with POSIX-like path because the argument gets written into the file verbatim -->
<Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen -q c ./Grammar/python.gram Grammar\Tokens -o Parser\parser.c"
WorkingDirectory="$(PySourcePath)" />
</Target>
<Target Name="_RegenAST_H"
Inputs="@(_ASTSources)" Outputs="@(_ASTOutputs)"
DependsOnTargets="FindPythonForBuild">
<Message Text="Regenerate @(_ASTOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
<Exec Command="$(PythonForBuild) Parser\asdl_c.py Parser\Python.asdl @(_ASTOutputs->'%(Argument) "%(Identity)"',' ')"
WorkingDirectory="$(PySourcePath)" />
</Target>
<Target Name="_RegenTokens"
Inputs="@(_TokenSources)" Outputs="@(_TokenOutputs)"
DependsOnTargets="FindPythonForBuild">
<Message Text="Regenerate @(_TokenOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
<Exec Command="$(PythonForBuild) Tools\build\generate_token.py %(_TokenOutputs.Format) Grammar\Tokens "%(_TokenOutputs.Identity)""
WorkingDirectory="$(PySourcePath)" />
<Touch Files="@(_TokenOutputs)" />
</Target>
<Target Name="_RegenKeywords"
Inputs="@(_KeywordSources)" Outputs="@(_KeywordOutputs)"
DependsOnTargets="FindPythonForBuild">
<Message Text="Regenerate @(_KeywordOutputs->'%(Filename)%(Extension)',' ')" Importance="high" />
<Exec Command="set PYTHONPATH=Tools\peg_generator%0D%0A$(PythonForBuild) -m pegen.keywordgen Grammar\python.gram Grammar\Tokens Lib\keyword.py"
WorkingDirectory="$(PySourcePath)" />
</Target>
<Target Name="_RegenGlobalObjects"
DependsOnTargets="FindPythonForBuild">
<Message Text="Regenerate Global Objects" Importance="high" />
<Exec Command="$(PythonForBuild) Tools\build\generate_global_objects.py"
WorkingDirectory="$(PySourcePath)" />
</Target>
<Target Name="_RegenCases"
Inputs="@(_CasesSources)" Outputs="@(_CasesOutputs)"
DependsOnTargets="FindPythonForBuild">
<Message Text="Regenerate cases" Importance="high" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\opcode_id_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\target_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\uop_id_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\py_metadata_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\tier1_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\tier2_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\tier2_abstract_generator.py $(PySourcePath)Python\tier2_redundancy_eliminator_bytecodes.c $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\opcode_metadata_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
<Exec Command="$(PythonForBuild) $(PySourcePath)Tools\cases_generator\uop_metadata_generator.py $(PySourcePath)Python\bytecodes.c"
WorkingDirectory="$(PySourcePath)" />
</Target>
<Target Name="_RegenJIT"
Condition="'$(UseJIT)' == 'true'"
DependsOnTargets="_UpdatePyconfig;FindPythonForBuild"
Inputs="@(_JITSources)"
Outputs="@(_JITOutputs)">
<PropertyGroup>
<JITArgs Condition="$(Platform) == 'ARM64'">aarch64-pc-windows-msvc</JITArgs>
<JITArgs Condition="$(Platform) == 'Win32'">i686-pc-windows-msvc</JITArgs>
<JITArgs Condition="$(Platform) == 'x64'">x86_64-pc-windows-msvc</JITArgs>
<JITArgs Condition="$(Configuration) == 'Debug'">$(JITArgs) --debug</JITArgs>
</PropertyGroup>
<Exec Command='$(PythonForBuild) "$(PySourcePath)Tools\jit\build.py" $(JITArgs)'
WorkingDirectory="$(GeneratedPyConfigDir)"/>
</Target>
<Target Name="_RegenNoPGUpdate"
Condition="$(Configuration) != 'PGUpdate'"
DependsOnTargets="_TouchRegenSources;_RegenPegen;_RegenAST_H;_RegenTokens;_RegenKeywords;_RegenGlobalObjects">
</Target>
<Target Name="Regen" DependsOnTargets="_RegenNoPGUpdate;_RegenJIT;_RegenCases">
<Message Text="Generated sources are up to date" Importance="high" />
</Target>
<ItemGroup>
<_TestFrozenSources Include="$(PySourcePath)Programs\freeze_test_frozenmain.py;
$(PySourcePath)Programs\test_frozenmain.py;
@(_OpcodeOutputs)" />
<_TestFrozenOutputs Include="$(PySourcePath)Programs\test_frozenmain.h" />
<_LicenseSources Include="$(PySourcePath)LICENSE;
$(PySourcePath)PC\crtlicense.txt;
$(bz2Dir)LICENSE;
$(libffiDir)LICENSE;" />
<_LicenseSources Include="$(opensslOutDir)LICENSE.txt" Condition="Exists('$(opensslOutDir)LICENSE.txt')" />
<_LicenseSources Include="$(opensslOutDir)LICENSE" Condition="!Exists('$(opensslOutDir)LICENSE.txt')" />
<_LicenseSources Include="$(tcltkDir)tcllicense.terms;
$(tcltkDir)tklicense.terms" Condition="$(IncludeTkinter)" />
</ItemGroup>
<Target Name="_RegenTestFrozenmain" Inputs="@(_TestFrozenSources)" Outputs="@(_TestFrozenOutputs)"
Condition="($(Platform) == 'Win32' or $(Platform) == 'x64') and
$(Configuration) != 'PGInstrument' and $(Configuration) != 'PGUpdate'">
<Message Text="Regenerate @(_TestFrozenOutputs->'%(Filename)%(Extension)', ' ')" Importance="high" />
<Exec Command='setlocal
set PYTHONPATH=$(PySourcePath)Lib
"$(PythonExe)" Programs\freeze_test_frozenmain.py Programs\test_frozenmain.h'
WorkingDirectory="$(PySourcePath)" />
</Target>
<Target Name="_RegenLicense">
<ItemGroup>
<_Text1 Include="@(_LicenseSources)">
<Content Condition="Exists(%(FullPath))">$([System.IO.File]::ReadAllText(%(FullPath)))</Content>
</_Text1>
<_Text Include="@(_Text1->'%(Content)')" />
</ItemGroup>
<WriteLinesToFile File="$(OutDir)LICENSE.txt" Overwrite="true" Lines="@(_Text)" />
<Warning Text="License file %(_LicenseSources.FullPath) is missing"
Condition="!Exists(@(_LicenseSources))" />
<Message Text="Wrote $(OutDir)LICENSE.txt" Importance="high" />
</Target>
<Target Name="PostBuildRegen" DependsOnTargets="_RegenTestFrozenmain;_RegenLicense" />
</Project>
|