mirror of
https://github.com/simple64/simple64.git
synced 2026-09-09 13:52:45 +02:00
70 lines
2.0 KiB
Batchfile
70 lines
2.0 KiB
Batchfile
@echo off
|
|
setlocal enableextensions
|
|
|
|
|
|
:: Validating arguments passed from Visual Studio to use as variables:
|
|
::
|
|
:: * Arguments with conflicting syntax can terminate the script abruptly.
|
|
:: * 'GAS_EXTRA' argument isn't initialized/used in some cases.
|
|
::
|
|
set GAS_EXTRA=
|
|
for /f "tokens=1,2*" %%A in ('echo %*') do (
|
|
set GAS_SRCDIR=%%A
|
|
set GAS_OBJDIR=%%B
|
|
set GAS_EXTRA=%%C
|
|
)
|
|
set GAS_CLARG=%GAS_OBJDIR%
|
|
if defined GAS_EXTRA set GAS_CLARG=%GAS_OBJDIR% %GAS_EXTRA%
|
|
|
|
|
|
:: "Anti-PEBCAK":
|
|
::
|
|
:: * Ensures that "Item A" and "Item B" exist, and send an error signal if not.
|
|
:: * The sole purpose of this code is to make the script fail outside VS.
|
|
::
|
|
if not exist mupen64plus-core.vcxproj exit /b 202
|
|
if not exist "%GAS_SRCDIR%asm_defines.c" exit /b 303
|
|
|
|
|
|
:: Legacy code adaptation for this script:
|
|
::
|
|
:: * Delete the libraries previously generated by gawk and/or this script.
|
|
:: * CL's stuff/witchcraft, if all goes well it will generate "Item C".
|
|
::
|
|
del "%GAS_SRCDIR%asm_defines_*"
|
|
cl /c /Fo%GAS_CLARG% /I ..\..\src "%GAS_SRCDIR%asm_defines.c"
|
|
|
|
|
|
:: If "Item C" does not exist, send error:
|
|
::
|
|
if not exist "%GAS_OBJDIR%asm_defines.obj" exit /b 404
|
|
|
|
|
|
:: Legacy code adaptation for 'gawk', currently disabled:
|
|
::
|
|
:: * A "POSIX version" of 'GAS_SRCDIR' is required in the 'dest_dir' parameter.
|
|
::
|
|
REM "..\..\..\mupen64plus-win32-deps\gawk-3.1.6-1\bin\gawk.exe" -v dest_dir="../../src/asm_defines" -f ..\..\tools\gen_asm_defines.awk "%GAS_OBJDIR%asm_defines.obj"
|
|
|
|
|
|
:: Simplified adaptation of 'gen_asm_defines.awk':
|
|
::
|
|
:: * Display 'asm_defines.obj' (aka "Item C") as a list.
|
|
:: * Look for the '@ASM_DEFINE' pattern.
|
|
:: * Take element '$2' and '$3' on that line.
|
|
:: * Print '%define "$2" ("$3")' to 'asm_defines_nasm.h'.
|
|
:: * Print '#define "$2" ("$3")' to 'asm_defines_gas.h'.
|
|
::
|
|
for /f "tokens=2,3" %%J in ('type "%GAS_OBJDIR%asm_defines.obj" ^| find "@ASM_DEFINE"') do (
|
|
echo %%define %%J ^(%%K^)>>"%GAS_SRCDIR%asm_defines_nasm.h"
|
|
echo #define %%J ^(%%K^)>>"%GAS_SRCDIR%asm_defines_gas.h"
|
|
)
|
|
|
|
|
|
:: Display 'asm_defines_nasm.h' for logging purposes:
|
|
::
|
|
echo.
|
|
type "%GAS_SRCDIR%asm_defines_nasm.h"
|
|
echo.
|
|
exit /b 0
|