|
1 | 1 | # Script to generate the necessary files for a msvscpp build
|
2 | 2 | #
|
3 |
| -# Version: 20230118 |
| 3 | +# Version: 20240306 |
4 | 4 |
|
5 | 5 | $WinFlex = "..\win_flex_bison\win_flex.exe"
|
6 | 6 | $WinBison = "..\win_flex_bison\win_bison.exe"
|
@@ -29,33 +29,36 @@ If (Test-Path "${Prefix}.net")
|
29 | 29 |
|
30 | 30 | $NamePrefix = ""
|
31 | 31 |
|
32 |
| -ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") |
| 32 | +ForEach (${Library} in Get-ChildItem -Directory -Path "lib*") |
33 | 33 | {
|
34 |
| - $OutputFile = ${DirectoryElement} -Replace ".l$",".c" |
| 34 | + ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") |
| 35 | + { |
| 36 | + $OutputFile = ${DirectoryElement} -Replace ".l$",".c" |
35 | 37 |
|
36 |
| - $NamePrefix = Split-Path -path ${DirectoryElement} -leaf |
37 |
| - $NamePrefix = ${NamePrefix} -Replace ".l$","_" |
| 38 | + $NamePrefix = Split-Path -path ${DirectoryElement} -leaf |
| 39 | + $NamePrefix = ${NamePrefix} -Replace ".l$","_" |
38 | 40 |
|
39 |
| - Write-Host "Running: ${WinFlex} -Cf ${DirectoryElement}" |
| 41 | + Write-Host "Running: ${WinFlex} -Cf ${DirectoryElement}" |
40 | 42 |
|
41 |
| - # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr |
42 |
| - # therefore 2>&1 is added and the output is stored in a variable. |
43 |
| - $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" |
44 |
| - Write-Host ${Output} |
| 43 | + # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr |
| 44 | + # therefore 2>&1 is added and the output is stored in a variable. |
| 45 | + $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" |
| 46 | + Write-Host ${Output} |
45 | 47 |
|
46 |
| - # Moving manually since `win_flex -o filename' does not provide the expected behavior. |
47 |
| - Move-Item "lex.yy.c" ${OutputFile} -force |
48 |
| -} |
| 48 | + # Moving manually since `win_flex -o filename' does not provide the expected behavior. |
| 49 | + Move-Item "lex.yy.c" ${OutputFile} -force |
| 50 | + } |
49 | 51 |
|
50 |
| -ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y") |
51 |
| -{ |
52 |
| - $OutputFile = ${DirectoryElement} -Replace ".y$",".c" |
| 52 | + ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y") |
| 53 | + { |
| 54 | + $OutputFile = ${DirectoryElement} -Replace ".y$",".c" |
53 | 55 |
|
54 |
| - Write-Host "Running: ${WinBison} -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement}" |
| 56 | + Write-Host "Running: ${WinBison} -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement}" |
55 | 57 |
|
56 |
| - # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr |
57 |
| - # therefore 2>&1 is added and the output is stored in a variable. |
58 |
| - $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" |
59 |
| - Write-Host ${Output} |
| 58 | + # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr |
| 59 | + # therefore 2>&1 is added and the output is stored in a variable. |
| 60 | + $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" |
| 61 | + Write-Host ${Output} |
| 62 | + } |
60 | 63 | }
|
61 | 64 |
|
0 commit comments