From 03c389d7b995c29b5f38d5cd081219411b0b3185 Mon Sep 17 00:00:00 2001 From: TazyFoundSoup Date: Mon, 27 Apr 2026 17:01:17 +1000 Subject: chore: Update compile commands --- Makefile | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index cc5f6f2..d8c4ea4 100644 --- a/Makefile +++ b/Makefile @@ -2,20 +2,20 @@ CC ?= gcc AR ?= ar OUTDIR = dist +BENCH_OUT = $(OUTDIR)/bench LIB = libtinyff.a -INCLUDES = -Iinclude +ALL_CFLAGS = -Wall -Wextra -Werror -std=c11 -Iinclude -Ibench -BASE_CFLAGS = -Wall -Wextra -Werror -std=c11 $(INCLUDES) DEBUG_FLAGS = -g -O0 -fno-omit-frame-pointer RELEASE_FLAGS = -O2 SANFLAGS = -fsanitize=address,undefined -g -O1 SRC = $(shell find src -name "*.c") +BENCH_SRC = $(shell find bench/src -name "*.c") ifeq ($(USE_HOSTED),1) -INCLUDES += -Iinclude/bridges -BASE_CFLAGS += -DUSE_HOSTED +ALL_CFLAGS += -DUSE_HOSTED -Iinclude/bridges SRC += $(shell find src/bridges -name "*.c") endif @@ -29,36 +29,33 @@ $(OUTDIR)/$(LIB): $(OBJ) $(OUTDIR)/%.o: %.c mkdir -p $(dir $@) - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(ALL_CFLAGS) $(CFLAGS) -c $< -o $@ clean: rm -rf $(OUTDIR) png_test -debug: CFLAGS = $(BASE_CFLAGS) $(DEBUG_FLAGS) +debug: CFLAGS = $(DEBUG_FLAGS) debug: $(OUTDIR)/$(LIB) -release: CFLAGS = $(BASE_CFLAGS) $(RELEASE_FLAGS) +release: CFLAGS = $(RELEASE_FLAGS) release: $(OUTDIR)/$(LIB) asan: CC = clang -asan: CFLAGS = $(BASE_CFLAGS) $(SANFLAGS) +asan: CFLAGS = $(SANFLAGS) asan: clean $(OUTDIR)/$(LIB) test-png: clean $(MAKE) USE_HOSTED=1 debug - $(CC) $(BASE_CFLAGS) $(DEBUG_FLAGS) -DUSE_HOSTED tests/format/image/png/png_open.c -o $(OUTDIR)/png_test -Iinclude/bridges -Ldist -ltinyff && ./$(OUTDIR)/png_test + $(CC) $(ALL_CFLAGS) $(DEBUG_FLAGS) -DUSE_HOSTED tests/format/image/png/png_open.c -o $(OUTDIR)/png_test -Ldist -ltinyff && ./$(OUTDIR)/png_test test: test-png -# $(TEST) is passed in via `make gdb TEST=` -# NOTE: should be the name of the test target's output binary -# inside the Makefile but cannot be the more generic 'test' target -# -# -# -# WARNING: TEST does not have a default value - gdb: debug gdb -x debug/.gdbinit $(OUTDIR)/$(TEST) -.PHONY: all clean debug release asan test test-png gdb \ No newline at end of file +bench: $(OUTDIR)/$(LIB) + mkdir -p $(BENCH_OUT) + $(CC) $(ALL_CFLAGS) $(RELEASE_FLAGS) $(BENCH_SRC) -o $(BENCH_OUT)/bench -L$(OUTDIR) -ltinyff + $(BENCH_OUT)/bench + +.PHONY: all clean debug release asan test test-png gdb bench \ No newline at end of file -- cgit v1.2.3