aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2025-09-18 07:51:22 +0200
committerNicholas Rodrigues Lordello <[email protected]>2025-09-18 07:51:22 +0200
commit77e3b7d8032be52f0b479bd17fec5c31803ebf31 (patch)
tree468c34dadd68f4d65bf595030d5b942a322718aa /Makefile
parente3a1beda8665f4757aa7cab727fcf3b09419a451 (diff)
Update Build System
We now build WAMR sources directly into our binary (instead of using a static library). Additionally, we now split the build into multiple files to make things more manageable.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile58
1 files changed, 14 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index 1f22a03..cdc3f93 100644
--- a/Makefile
+++ b/Makefile
@@ -1,49 +1,19 @@
-PICO8 ?= pico8
+SRC = src/picow.c src/png.c src/sysroot.c
+OBJ = $(patsubst %.c,%.o,$(SRC))
-CLANG_FORMAT ?= clang-format
-CLANG_TIDY ?= clang-tidy
+.PHONY: all
+all: platform/sdl/picow ;
-.PHONY: platform/sdl
-platform/sdl: platform/sdl/picow system ;
+include makefiles/system.mk
+include makefiles/tools.mk
+include makefiles/wamr.mk
-platform/sdl/picow: platform/sdl/main.c src/picow.c src/png.c include/picow.h
- $(CC) -o $@ $< src/picow.c src/png.c -Iinclude/ -Ilib/ $$(pkg-config SDL3 --cflags --libs)
-
-src/sysroot.c: tools/generate-sysroot.exe system/pico8.data.pod system/pico8.wasm system/boot.p8.rom
- $< system > $@
-
-system/pico8.data.pod: carts/pico8.js tools/extract-data-pod.exe
- @mkdir -p system
- tools/extract-data-pod.exe $< $@
-
-system/pico8.wasm: carts/pico8.wasm
- @mkdir -p system
- cp $< $@
-
-system/boot.p8.rom: carts/boot.p8.rom
- @mkdir -p system
- cp $< $@
-
-carts/%.html carts/%.js carts/%.wasm: carts/%.w ;
-carts/%.w: carts/%.p8
- $(PICO8) $< -export "-w $(@:.w=.html)"
-
-carts/%.p8.png: carts/%.p8
- $(PICO8) $< -export $@
-
-carts/%.p8.rom: carts/%.p8
- $(PICO8) $< -export $@
-
-tools/%.exe: tools/%.c
- $(CC) -o $@ $<
-
-.PHONY: check
-check:
- @$(CLANG_FORMAT) -i include/*.h src/*.c platform/*/*.c tools/*.c
- @$(CLANG_TIDY) src/*.c --checks=all --header-filter=include/ -- -Iinclude/ -Ilib/
+platform/sdl/picow: platform/sdl/main.c $(OBJ) $(WAMR_OBJ)
+ $(CC) -o $@ $^ -Iinclude/ $$(pkg-config SDL3 --cflags --libs)
.PHONY: clean
-clean:
- rm -r carts/*.html carts/*.js carts/*.wasm carts/*.p8.png carts/*.p8.rom
- rm -f tools/*.exe
- rm -rf system/
+clean: clean-system clean-tools clean-wamr
+ rm -f platform/sdl/picow src/picow.o src/png.o src/sysroot.c
+
+src/%.o: src/%.c
+ $(CC) -c -o $@ $< -Iinclude/ -Ilib/