diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-21 18:49:27 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-21 18:49:27 +1000 |
| commit | 646d8489f2136e8f1e43f4cc537bac9a8aa3f47b (patch) | |
| tree | 9af0b640a9c3085c87b81d8009bf8b2bd2954882 | |
| parent | 6519a83af02fc1c7e41a8874462185841600fa49 (diff) | |
fix(Makefile): Fix build flags and build flow
| -rw-r--r-- | Makefile | 31 |
1 files changed, 13 insertions, 18 deletions
@@ -5,8 +5,8 @@ OUTDIR = dist LIB = libtinyff.a INCLUDES = -Iinclude -CFLAGS = -Wall -Wextra -Werror -std=c11 $(INCLUDES) +BASE_CFLAGS = -Wall -Wextra -Werror -std=c11 $(INCLUDES) DEBUG_FLAGS = -g -O0 RELEASE_FLAGS = -O2 SANFLAGS = -fsanitize=address,undefined -g -O1 @@ -15,13 +15,13 @@ SRC = $(shell find src -name "*.c") ifeq ($(USE_HOSTED),1) INCLUDES += -Iinclude/bridges -CFLAGS += -DUSE_HOSTED +BASE_CFLAGS += -DUSE_HOSTED SRC += $(shell find src/bridges -name "*.c") endif OBJ = $(patsubst %.c,$(OUTDIR)/%.o,$(SRC)) -all: $(OUTDIR)/$(LIB) +all: release $(OUTDIR)/$(LIB): $(OBJ) mkdir -p $(OUTDIR) @@ -32,26 +32,21 @@ $(OUTDIR)/%.o: %.c $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -rf $(OUTDIR) + rm -rf $(OUTDIR) png_test -debug: CFLAGS += $(DEBUG_FLAGS) -debug: clean all +debug: CFLAGS = $(BASE_CFLAGS) $(DEBUG_FLAGS) +debug: $(OUTDIR)/$(LIB) -release: CFLAGS += $(RELEASE_FLAGS) -release: clean all +release: CFLAGS = $(BASE_CFLAGS) $(RELEASE_FLAGS) +release: $(OUTDIR)/$(LIB) -asan: CC=clang -asan: CFLAGS += $(SANFLAGS) -asan: clean all - -# Currently supporting: -# Images -# - png -# - bmp (WIP) +asan: CC = clang +asan: CFLAGS = $(BASE_CFLAGS) $(SANFLAGS) +asan: clean $(OUTDIR)/$(LIB) test-png: clean - $(MAKE) USE_HOSTED=1 - $(CC) $(CFLAGS) -DUSE_HOSTED tests/format/image/png/png_open.c -o png_test -Iinclude/bridges -Ldist -ltinyff && ./png_test + $(MAKE) USE_HOSTED=1 debug + $(CC) $(BASE_CFLAGS) $(DEBUG_FLAGS) -DUSE_HOSTED tests/format/image/png/png_open.c -o png_test -Iinclude/bridges -Ldist -ltinyff && ./png_test test: test-png |
