Skip to content

Instantly share code, notes, and snippets.

@DennyLindberg
Last active February 29, 2024 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DennyLindberg/3ffe0ba111f8c3caa8e9031185e09794 to your computer and use it in GitHub Desktop.
Save DennyLindberg/3ffe0ba111f8c3caa8e9031185e09794 to your computer and use it in GitHub Desktop.
A much simpler version of make.bat
::::
:: A simplified version of the pseudo-make for building a C application using MSVC.
:: Refer to the other gist for details.
:: https://gist.github.com/DennyLindberg/8c0a5e7471a30e6868a00757e8483b78
::::
@echo off
:::: PROJECT CONFIGURATION
set exe_file=main.exe
set src_files=src/*.c
set includes=include/
set libs=lib/*.lib
:::: goto first argument in ./make arg1
if "%*" == "" goto build
goto :%1 2>nul || (
echo invalid make command
goto ::eof
)
:dbuild
cl.exe /Fe:%exe_file% /Wall /wd5045 /std:c17 /Z7 /external:W3 /external:I %includes% %src_files% /link /ENTRY:mainCRTStartup /DEBUG %libs%
goto :eof
:build
cl.exe /Fe:%exe_file% /Wall /wd5045 /std:c17 /external:W3 /external:I %includes% %src_files% /link /ENTRY:mainCRTStartup %libs%
goto :eof
:run
%exe_file% %*
goto :eof
:clean
del *.exe *.obj *.pdb *.ilk 2>nul
goto :eof
:debug
start C:\raddbg.exe --auto_run %cd%/%exe_file% %*
goto :eof
@DennyLindberg
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment