aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-02-11 06:28:17 +0100
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-02-11 06:28:17 +0100
commit10379fdde9fa5e94a955fe35f14e5b35de2a0e5d (patch)
treec5d6b408ebef01acf5ee5bedd6ff9e59386d139b
parentc0ef18f1aad1c5b4d8cb0aa1e0bab8d54d99e7f6 (diff)
chore: Makefile
-rw-r--r--.gitignore6
-rw-r--r--CMakeLists.txt3
-rw-r--r--Makefile9
-rw-r--r--README.md3
-rw-r--r--log.c2
-rw-r--r--vec.c4
6 files changed, 17 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index e7ea508..58c83ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,4 @@
main
-cmake_install.cmake
-Makefile
-CMakeFiles/
-CMakeCache.txt
+Debug/
+Release/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c94bd65..ddba94b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.30.5)
project(kagamic VERSION 0.1 LANGUAGES C)
+set(CMAKE_C_STANDARD 17)
add_executable(main
main.c
string.h string.c
@@ -9,4 +10,4 @@ add_executable(main
log.h log.c
)
target_link_libraries(main m)
-target_compile_options(main PRIVATE -Wall)
+target_compile_options(main PRIVATE -Wall -pedantic -Wextra)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..71dea2a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+debug:
+ cd Debug; \
+ cmake -DCMAKE_BUILD_TYPE=Debug ..; \
+ make;
+
+release:
+ cd Release; \
+ cmake -DCMAKE_BUILD_TYPE=Release ..; \
+ make;
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..431a2d0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# Kagamic
+
+## TODO
diff --git a/log.c b/log.c
index 9a3211f..76bee11 100644
--- a/log.c
+++ b/log.c
@@ -8,4 +8,4 @@ void info(Logger l, const char *name, const char *str, ...) {
printf(str);
printf("\n");
}
-};
+}
diff --git a/vec.c b/vec.c
index 6962d03..58977dc 100644
--- a/vec.c
+++ b/vec.c
@@ -1,4 +1,3 @@
-#include <stdio.h>
#include <string.h>
#include "vec.h"
@@ -14,9 +13,6 @@ Vec *_Vec_new(Arena *a, int size, ptrdiff_t cap, int align) {
}
Vec *Vec_push(Arena *a, Vec *v, void *data) {
- // printf("push: dest=%p, src=%p, size=%d\n", v->data + v->len * v->size,
- // data,
- // v->size);
if (v->len == v->cap) {
void *cpy = alloc(a, v->cap * 2, v->size, v->align);
memcpy(cpy, v->data, v->len * v->size);