summaryrefslogtreecommitdiff
path: root/build.c
diff options
context:
space:
mode:
authorAargh Rai <aargh.rai+git@gmail.com>2026-05-31 13:07:46 +0530
committerAargh Rai <aargh.rai+git@gmail.com>2026-05-31 13:07:46 +0530
commit8671756d141292d4ec9747ec8de6e9cf3324777d (patch)
treef14edf785f82cb6c6f3dc61c5ad1eb2689faef1f /build.c
parent198bf7c46552059581fda144ec08a9114258123e (diff)
CC in build.c & fen strings
Diffstat (limited to 'build.c')
-rw-r--r--build.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/build.c b/build.c
index 56c5110..041bb57 100644
--- a/build.c
+++ b/build.c
@@ -6,6 +6,8 @@
#include <time.h>
#include <string.h>
+#define CC "gcc", "-O3"
+
int status;
#define RUN_CMD(...) do { \
@@ -58,9 +60,9 @@ int needs_rebuild(char* bin_file, char* source_file) {
int main(int argc, char** argv) {
if (needs_rebuild(argv[0], __FILE__)) {
- RUN_CMD({"gcc", __FILE__, "-o", argv[0], NULL});
+ RUN_CMD({CC, __FILE__, "-o", argv[0], NULL});
if (status != 0) {
- // gcc error
+ // cc error
return 0;
}
print_cmd(argv);
@@ -75,11 +77,11 @@ int main(int argc, char** argv) {
return test_mode();
}
if (strcmp(argv[1], "server") == 0) {
- RUN_CMD({"gcc", "src/log.c", "-o", LOG_O, NULL});
+ RUN_CMD({CC, "src/log.c", "-o", LOG_O, NULL});
return server_mode();
}
if (strcmp(argv[1], "clean") == 0) {
- RUN_CMD({"gcc", "src/log.c", "-o", LOG_O, NULL});
+ RUN_CMD({CC, "src/log.c", "-o", LOG_O, NULL});
return clean_mode();
}
}
@@ -94,10 +96,10 @@ int clean_mode() {
}
int test_mode() {
- RUN_CMD({"gcc", "generate/find_tests.c", LOGGER_C, "-o", "output/find_tests.o", NULL});
+ RUN_CMD({CC, "generate/find_tests.c", LOGGER_C, "-o", "output/find_tests.o", NULL});
RUN_CMD({"./output/find_tests.o", NULL});
printf("\n");
- RUN_CMD({"gcc", "tests/main.c", LOGGER_C, "-o", "output/test.o", NULL});
+ RUN_CMD({CC, "tests/main.c", LOGGER_C, "-o", "output/test.o", NULL});
char* args[] = {"./output/test.o", NULL};
print_cmd(args);
@@ -107,8 +109,8 @@ int test_mode() {
int server_mode() {
RUN_CMD({"rm", "/dev/mqueue/server_to_engine", "/dev/mqueue/engine_to_server", NULL});
- RUN_CMD({"gcc", "src/server.c", LOGGER_C, "-lcrypto", "-o", SERVER_O, NULL});
- RUN_CMD({"gcc", "src/engine.c", LOGGER_C, "-o", ENGINE_O, NULL});
+ RUN_CMD({CC, "src/server.c", LOGGER_C, "-lcrypto", "-o", SERVER_O, NULL});
+ RUN_CMD({CC, "src/engine.c", LOGGER_C, "-o", ENGINE_O, NULL});
char* args[] = {LOG_O, SERVER_O, ENGINE_O, NULL};
print_cmd(args);
@@ -117,7 +119,7 @@ int server_mode() {
}
int engine_mode() {
- RUN_CMD({"gcc", "src/engine.c", LOGGER_C, "-o", ENGINE_O, NULL});
+ RUN_CMD({CC, "src/engine.c", LOGGER_C, "-o", ENGINE_O, NULL});
char* args[] = {LOG_O, ENGINE_O, NULL};
print_cmd(args);