replace VG_STATIC -> static
[vg.git] / vg_build.h
index 54c74e2ec8c50c5eaa0d2ca28e8aa5f69bdbf1fa..d85764548acb7796d96f72e7237a4b3ea3a7f10c 100644 (file)
@@ -35,6 +35,8 @@ struct compiler_info
       k_compiler_mingw
    }
    compiler;
+
+   int clean;
 }
 
 static vg_compiler;
@@ -88,7 +90,6 @@ void vg_build_start( const char *name, enum compiler compiler )
    vg_compiler.include[0] = '\0';
    vg_compiler.library[0] = '\0';
    vg_compiler.compiler = compiler;
-
    strcpy( vg_compiler.name, name );
 
    snprintf( vg_compiler.build_dir, 512, 
@@ -96,6 +97,10 @@ void vg_build_start( const char *name, enum compiler compiler )
                                     name,
                                     vg_compiler_str() );
 
+   if( vg_compiler.clean ){
+      vg_build_syscall( "rm -rf %s", vg_compiler.build_dir );
+   }
+
    vg_build_syscall( "mkdir -p %s", vg_compiler.build_dir );
    vg_build_include( "-I. -I./vg " );
    vg_build_library_dir( "-L. " );
@@ -199,6 +204,10 @@ void vg_build_mode_debug(void)
    vg_compiler.optimization_profile = k_optimization_profile_debug;
 }
 
+void vg_build_clean(void){
+   vg_compiler.clean = 1;
+}
+
 void vg_build(void)
 {
    char cmd[8192];
@@ -217,7 +226,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" );
@@ -230,8 +240,8 @@ 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"
+      "    -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 ){