-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bat
More file actions
77 lines (61 loc) · 2.1 KB
/
Copy pathbuild.bat
File metadata and controls
77 lines (61 loc) · 2.1 KB
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
@echo off
REM ============================================================================
REM AK CODE Bootstrap Compiler - Windows Build Script
REM Builds the entire bootstrap compiler using NASM and MSVC Linker
REM ============================================================================
setlocal enabledelayedexpansion
set SCRIPT_DIR=%~dp0
set BUILD_DIR=%SCRIPT_DIR%build
echo === AK CODE Bootstrap Compiler Build ===
echo.
REM Create build directory
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
echo Step 1: Assembling all source files...
echo Assembling runtime.asm...
nasm -f win64 "%SCRIPT_DIR%asm\runtime.asm" -o "%BUILD_DIR%\runtime.obj" ^
-D TARGET_WIN64
echo Assembling entry_win.asm...
nasm -f win64 "%SCRIPT_DIR%asm\entry_win.asm" -o "%BUILD_DIR%\entry_win.obj" ^
-D TARGET_WIN64
echo Assembling lexer.asm...
nasm -f win64 "%SCRIPT_DIR%asm\lexer.asm" -o "%BUILD_DIR%\lexer.obj" ^
-D TARGET_WIN64
echo Assembling parser.asm...
nasm -f win64 "%SCRIPT_DIR%asm\parser.asm" -o "%BUILD_DIR%\parser.obj" ^
-D TARGET_WIN64
echo Assembling codegen.asm...
nasm -f win64 "%SCRIPT_DIR%asm\codegen.asm" -o "%BUILD_DIR%\codegen.obj" ^
-D TARGET_WIN64
echo Assembling linker_glue.asm...
nasm -f win64 "%SCRIPT_DIR%asm\linker_glue.asm" -o "%BUILD_DIR%\linker_glue.obj" ^
-D TARGET_WIN64
echo.
echo Step 2: Linking...
link /OUT:"%BUILD_DIR%\akc.exe" /SUBSYSTEM:CONSOLE /ENTRY:WinMain ^
"%BUILD_DIR%\entry_win.obj" ^
"%BUILD_DIR%\lexer.obj" ^
"%BUILD_DIR%\parser.obj" ^
"%BUILD_DIR%\codegen.obj" ^
"%BUILD_DIR%\runtime.obj" ^
"%BUILD_DIR%\linker_glue.obj" ^
kernel32.lib user32.lib
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Linking failed with code %ERRORLEVEL%
exit /b %ERRORLEVEL%
)
echo.
echo === Build Complete ===
echo Output: %BUILD_DIR%\akc.exe
echo.
echo Usage:
echo build\akc.exe source.ak [-o output]
echo.
REM Check if NASM is available
where nasm >nul 2>nul
if %ERRORLEVEL% EQU 0 (
for /f "tokens=*" %%a in ('nasm --version') do set "NASM_VER=%%a"
echo NASM: %NASM_VER%
) else (
echo WARNING: NASM not found in PATH
)
endlocal