aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-09-12 21:32:08 +0200
committerNicholas Rodrigues Lordello <[email protected]>2026-09-12 21:32:08 +0200
commitcfa3a680b679b3fbcd5967e0175207aef71f80c9 (patch)
tree0e619d6c3119e4b74a895c415a87bb92e377dc6e
parentb6aa39f80b399bae395a4e638d2e96b4931dce5a (diff)
Stricter Building
We build with C99 and enable more warnings. I want to refactor the build system a bit, as it is not conventional at the moment, and I think a top-level single Makefile will actually be nicer. I also want to build intermediate `.a` archives for the `libs/` to clearly seperate them as a "vendored dependency".
-rw-r--r--Makefile8
-rw-r--r--makefiles/stbi.mk2
-rw-r--r--makefiles/tools.mk2
-rw-r--r--makefiles/wamr.mk3
4 files changed, 10 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 774ac89..0895b60 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
+CC = gcc
+CFLAGS = -std=c99 -Wextra -O2 -Ilib/ $(shell pkg-config SDL3 --cflags)
+LDFLAGS = $(shell pkg-config SDL3 --libs)
+
SRC = src/picow.c src/sysroot.c
OBJ = $(patsubst %.c,%.o,$(SRC))
@@ -11,7 +15,7 @@ include makefiles/tools.mk
include makefiles/wamr.mk
picow: $(OBJ) $(STBI_OBJ) $(WAMR_OBJ)
- $(CC) -o $@ $^ $$(pkg-config SDL3 --libs)
+ $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
.PHONY: lint
lint:
@@ -23,4 +27,4 @@ clean: clean-carts clean-stbi clean-system clean-tools clean-wamr
rm -f picow $(OBJ)
src/%.o: src/%.c
- $(CC) -c -o $@ $< -Ilib/ $$(pkg-config SDL3 --cflags)
+ $(CC) $(CFLAGS) -c $< -o $@
diff --git a/makefiles/stbi.mk b/makefiles/stbi.mk
index 895c672..0f03c15 100644
--- a/makefiles/stbi.mk
+++ b/makefiles/stbi.mk
@@ -5,7 +5,7 @@ STBI_OBJ = $(patsubst %.c,%.o,$(STBI_SRC))
stbi: $(STBI_OBJ) ;
lib/stb/%.o: lib/stb/%.c
- $(CC) -c -o $@ $< $$(pkg-config SDL3 --cflags)
+ $(CC) $(CFLAGS) -Wno-unused-function -c $< -o $@
.PHONY: clean-stbi
clean-stbi:
diff --git a/makefiles/tools.mk b/makefiles/tools.mk
index 923940d..ab25382 100644
--- a/makefiles/tools.mk
+++ b/makefiles/tools.mk
@@ -1,5 +1,5 @@
tools/%.exe: tools/%.c
- $(CC) -o $@ $<
+ $(CC) $(CFLAGS) $< -o $@
.PHONY: clean-tools
clean-tools:
diff --git a/makefiles/wamr.mk b/makefiles/wamr.mk
index 0eb4c30..e250509 100644
--- a/makefiles/wamr.mk
+++ b/makefiles/wamr.mk
@@ -28,7 +28,8 @@ WAMR_SRC = lib/wamr/core/iwasm/common/wasm_application.c \
lib/wamr/custom/platform.c \
lib/wamr/custom/runtime.c
-WAMR_CFLAGS = -DBH_FREE=wasm_runtime_free \
+WAMR_CFLAGS = $(CFLAGS) -Wno-unused-parameter \
+ -DBH_FREE=wasm_runtime_free \
-DBH_MALLOC=wasm_runtime_malloc \
-DWASM_ENABLE_FAST_INTERP=1 \
-DWASM_ENABLE_INTERP=1 \