Browse Source

Try to not confuse visual studio

Try to not even breath at it
rexim 4 years ago
parent
commit
d253cecebb
1 changed files with 22 additions and 12 deletions
  1. 22 12
      nobuild2.c

+ 22 - 12
nobuild2.c

@@ -3,31 +3,41 @@
 
 #define CFLAGS "-Wall", "-Wextra", "-std=c11", "-pedantic"
 
+void build_tool(const char *tool)
+{
+    Cstr tool_path = PATH("tools", tool);
+#ifndef _WIN32
+    CMD("cc", CFLAGS, "-o", NOEXT(tool_path), tool_path);
+#else
+    CMD("cl.exe", "/Fe.\\tools\\", tool_path);
+#endif
+}
+
 void build_tools(void)
 {
     FOREACH_FILE_IN_DIR(tool, "tools", {
         if (ENDS_WITH(tool, ".c")) {
-            Cstr tool_path = PATH("tools", tool);
+            build_tool(tool);
+        }
+    });
+}
+
+void run_example(const char *example)
+{
+    Cstr example_path = PATH("examples", example);
 #ifndef _WIN32
-            CMD("cc", CFLAGS, "-o", NOEXT(tool_path), tool_path);
+    CMD("cc", CFLAGS, "-o", NOEXT(example_path), example_path);
 #else
-            CMD("cl.exe", "/Fe.\\tools\\", tool_path);
+    CMD("cl.exe", "/Fe.\\examples\\", example_path);
 #endif
-        }
-    });
+    CMD(NOEXT(example_path));
 }
 
 void run_examples(void)
 {
     FOREACH_FILE_IN_DIR(example, "examples", {
         if (ENDS_WITH(example, ".c")) {
-            Cstr example_path = PATH("examples", example);
-#ifndef _WIN32
-            CMD("cc", CFLAGS, "-o", NOEXT(example_path), example_path);
-#else
-            CMD("cl.exe", "/Fe.\\examples\\", example_path);
-#endif
-            CMD(NOEXT(example_path));
+            run_example(example);
         }
     });
 }