-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.bat
More file actions
83 lines (74 loc) · 2.2 KB
/
make.bat
File metadata and controls
83 lines (74 loc) · 2.2 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
@echo off
REM make.bat - Build script for Bodge Build System on Windows
REM Usage: make.bat [target]
REM Targets: all, clean, debug, help
set CXX=g++
set CXXFLAGS=-std=c++17 -Wall -Wextra -Wpedantic -O2 -static-libgcc -static-libstdc++
set TARGET=bodge.exe
set SRCDIR=src
set SOURCES=%SRCDIR%\core.cpp %SRCDIR%\main.cpp %SRCDIR%\ProjectConfig.cpp %SRCDIR%\StringUtils.cpp %SRCDIR%\ConfigParser.cpp %SRCDIR%\BuildSystem.cpp %SRCDIR%\git.cpp %SRCDIR%\FileSystemUtils.cpp %SRCDIR%\Architecture.cpp %SRCDIR%\FileWatcher.cpp %SRCDIR%\BuildLogger.cpp %SRCDIR%\ProgressBar.cpp %SRCDIR%\Strings.cpp
REM Check if first argument is provided, default to "all"
if "%1"=="" (
set ACTION=all
) else (
set ACTION=%1
)
REM Execute the requested action
if /i "%ACTION%"=="all" goto build
if /i "%ACTION%"=="build" goto build
if /i "%ACTION%"=="clean" goto clean
if /i "%ACTION%"=="debug" goto debug
if /i "%ACTION%"=="help" goto help
if /i "%ACTION%"=="?" goto help
echo Unknown target: %ACTION%
echo Use 'make.bat help' to see available targets.
goto end
:build
echo Building %TARGET%...
%CXX% %CXXFLAGS% -I%SRCDIR% %SOURCES% -o %TARGET%
if %ERRORLEVEL% equ 0 (
echo Build successful! Executable: %TARGET%
) else (
echo Build failed with error code %ERRORLEVEL%
)
goto end
:clean
echo Cleaning build artifacts...
if exist "%TARGET%" (
del "%TARGET%"
echo Removed %TARGET%
) else (
echo %TARGET% not found, nothing to clean.
)
if exist "*.o" (
del "*.o"
echo Removed object files.
)
if exist "%SRCDIR%\*.o" (
del "%SRCDIR%\*.o"
echo Removed source object files.
)
echo Clean complete.
goto end
:debug
echo Building %TARGET% with debug symbols...
%CXX% %CXXFLAGS% -g -DDEBUG -I%SRCDIR% %SOURCES% -o %TARGET%
if %ERRORLEVEL% equ 0 (
echo Debug build successful! Executable: %TARGET%
) else (
echo Debug build failed with error code %ERRORLEVEL%
)
goto end
:help
echo Available targets:
echo all - Build the project (default)
echo build - Same as 'all'
echo clean - Remove build artifacts
echo debug - Build with debug symbols and DEBUG macro
echo help - Show this help message
echo.
echo Usage: make.bat [target]
echo Example: make.bat all
echo Example: make.bat clean
goto end
:end