alaestor

[Intro] compile.bat

Dec 22nd, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.28 KB | None | 0 0
  1. @REM Only for learning quality-of-life after intro to compiler toolchain.
  2. @REM Will be replaced later with the file-aware TUP build system.
  3. @SETLOCAL
  4. @REM Here we define all the flags we're compiling with
  5. @REM Recommended minimum: -std=c++17 -O2 -Wall -Wextra -pedantic
  6. @SET FLAGS=-std=c++17 -fmax-errors=3 -O2 -Wall -Wextra -Werror=pedantic -pedantic-errors -Wformat=2 -Wshadow -Wreorder -Wduplicated-cond -Wduplicated-branches -Wnoexcept -Wconversion -Wsign-conversion -Wnon-virtual-dtor -Wsign-promo -Wdouble-promotion -Wold-style-cast -Wuseless-cast -Wcast-align -Wstrict-aliasing=1 -Wstrict-overflow=3 -Wnull-dereference -Wzero-as-null-pointer-constant -fno-fat-lto-objects -s -Wno-odr -fuse-linker-plugin -static
  7. @REM Note To Self: removed -flto due to conflict bugs present in mingw v8.1.0
  8.  
  9.  
  10. @ECHO.
  11. @REM First, we assemble an object file (.o) for each source (.cpp)
  12. @REM Note the -c argument, saying to gen ASM objects but not to link
  13. g++ %FLAGS% "main.cpp" -c -o "main.o"
  14.  
  15.  
  16. @ECHO.
  17. @REM Next, we link each of the assemblies (.o) into an executible (.exe)
  18. @REM Note the lack of -c, saying to perform linkage
  19. g++ %FLAGS% "main.o" -o "main.exe"
  20.  
  21.  
  22. @ECHO.
  23. @REM we could do this in one step, without generating ASM objects via:
  24. @REM g++ %FLAGS% "main.cpp" -o "main.exe"
  25. @ENDLOCAL
  26. @PAUSE
Add Comment
Please, Sign In to add comment