clean flag
[vg.git] / vg_build.h
index 03f82fc1f4f819c7e2b8337f6adc5b18d0d4b942..9e7d2b4200fa1a5632df3f94d1990b4a388e0ec2 100644 (file)
@@ -110,11 +110,26 @@ void vg_build_add_link_for_graphics(void)
    }
    else
    {
-      vg_build_link( "-lmingw32 -lSDL2main -lSDL2 -lopengl32 -mwindows " );
+      vg_build_link( "-lmingw32 -lSDL2main -lSDL2 -lopengl32 -mwindows \\\n" );
+      vg_build_link( "   -Wl,--dynamicbase -Wl,--nxcompat \\\n" );
+
+      /* + 26.05.23: Suddenly something is pulling in winpthread. 
+       *             cant work out whats doing it or why. */
+      vg_build_link( "   -Wl,-Bstatic,--whole-archive \\\n" );
+      vg_build_link( "      -lwinpthread \\\n" );
+      vg_build_link( "   -Wl,--no-whole-archive " );
    }
 
    vg_build_object( "vg/dep/glad/glad.c " );
-   vg_build_link( "-lm -pthread " );
+
+   vg_build_link( "-lm " );
+   if( vg_compiler.compiler == k_compiler_mingw ){
+      //vg_build_link( "-mthreads " );
+      //vg_build_link( "-static-libgcc " );
+   }
+   else{
+      vg_build_link( "-pthread " );
+   }
 }
 
 void vg_build_add_link_for_game(void)
@@ -184,6 +199,10 @@ void vg_build_mode_debug(void)
    vg_compiler.optimization_profile = k_optimization_profile_debug;
 }
 
+void vg_build_clean(void){
+   vg_build_syscall( "rm -r %s", vg_compiler.build_dir );
+}
+
 void vg_build(void)
 {
    char cmd[8192];
@@ -202,7 +221,8 @@ void vg_build(void)
       if( (vg_compiler.compiler == k_compiler_gcc) ||
           (vg_compiler.compiler == k_compiler_clang ) )
       {
-         strcat( cmd, "-rdynamic -fsanitize=address " );
+         strcat( cmd, "-rdynamic -fsanitize=address "
+                      "-fPIE -fstack-protector-strong " );
       }
 
       strcat( cmd, "\\\n" );
@@ -215,11 +235,15 @@ void vg_build(void)
    /* Warnings */
    strcat( cmd, 
       "   -Wall\\\n"
-      "     -Wno-unused-function -Wno-unused-variable\\\n"
-      "     -Wno-unused-command-line-argument -Wno-unused-but-set-variable\\\n"
-      "     -ferror-limit=5\\\n"
+      "    -Wno-unused-function -Wno-unused-variable -Wno-format-truncation\\\n"
+      "    -Wno-unused-command-line-argument -Wno-unused-but-set-variable\\\n"
    );
 
+   if( vg_compiler.compiler == k_compiler_clang ){
+      strcat( cmd, 
+         "     -ferror-limit=5\\\n" );
+   }
+
    /* Include */
    strcat( cmd, "   " );
    strcat( cmd, vg_compiler.include );