diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 33 |
1 files changed, 15 insertions, 18 deletions
@@ -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=<test_name>` -# NOTE: <test_name> 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 |
