-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bat
More file actions
104 lines (91 loc) · 2.36 KB
/
build.bat
File metadata and controls
104 lines (91 loc) · 2.36 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
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
@echo off
REM Clears the console screen
cls
REM --- Config ---
SET CC=gcc
SET CFLAGS=-Wall -Wextra -g
REM --- Include Paths (Compiler Lib + Test Framework) ---
SET INCLUDES=^
-Iinclude ^
-Itests/include
REM --- Target Executables ---
SET COMPILER_EXE=bin\determa.exe
SET TEST_RUNNER_EXE=bin\determa_test.exe
REM --- Ensure bin directory exists ---
if not exist bin mkdir bin
REM --- Source Files ---
REM 1. Frontend (Lexer, Parser, TypeChecker) - In src/
SET FRONTEND_SOURCES= ^
src\lexer.c ^
src\token.c ^
src\parser.c ^
src\ast.c ^
src\symbol.c ^
src\typechecker.c ^
src\cli.c
REM 2. Backend (VM, Bytecode, Compiler) - In src/vm/
REM Note: These files don't exist yet, but we are prepping for them!
SET BACKEND_SOURCES= ^
src\vm\chunk.c ^
src\vm\vm.c ^
src\vm\compiler.c ^
src\vm\value.c ^
src\vm\object.c ^
src\vm\memory.c
REM Combine Lib Sources
SET LIB_SOURCES=%FRONTEND_SOURCES% %BACKEND_SOURCES%
REM Source for the main compiler executable
SET COMPILER_SOURCES=^
src\main.c ^
%LIB_SOURCES%
REM Source for the test runner executable
SET TEST_SOURCES=^
tests\test_runner.c ^
tests\test.c ^
tests\lexer\test_lexer.c ^
tests\parser\test_parser.c ^
tests\parser\test_compound.c^
tests\typechecker\test_typechecker.c ^
tests\vm\test_vm.c ^
tests\vm\test_gc.c^
tests\vm\test_locals.c^
tests\functions\test_functions.c^
%LIB_SOURCES%
REM --- Compilation Step ---
echo Compiling Determa Compiler (%COMPILER_EXE%)...
%CC% %CFLAGS% ^
%COMPILER_SOURCES% ^
-o %COMPILER_EXE% ^
-Iinclude
if %errorlevel% neq 0 (
echo.
echo ========================
echo COMPILER BUILD FAILED!
echo ========================
goto :eof
)
echo Compilation successful
echo.
echo Compiling Determa Test Runner (%TEST_RUNNER_EXE%)...
%CC% %CFLAGS% ^
%TEST_SOURCES% ^
-o %TEST_RUNNER_EXE% ^
%INCLUDES%
if %errorlevel% neq 0 (
echo.
echo ===========================
echo TEST RUNNER BUILD FAILED!
echo ===========================
goto :eof
)
echo Compilation successful
echo.
echo =======================
echo ALL BUILDS SUCCESSFUL
echo =======================
echo.
echo -------------------------------------------------------------
echo Running Determa Unit Tests...
echo -------------------------------------------------------------
echo.
%TEST_RUNNER_EXE%