oas/make/base.mk
omicron 0f9ced8eb1 Rework the build system to be more modular
Split most of the work off into make/base.mk and allow for easy wrappers
to be created around that that can build with different instrumentation
in their own build directory.

Create wrappers for the following:
 - release build
 - debug build
 - afl++ fuzzing build
 - static analysis with clang
 - clang memory sanitizer
 - clang address/undefined sanitizer
2025-04-04 02:18:02 +02:00

28 lines
570 B
Makefile

.PHONY: all clean
CC?=clang
LD?=clang
CFLAGS?=-Wall -Wextra -Wpedantic -O0 -g3 -std=c23 -fno-omit-frame-pointer -fno-optimize-sibling-calls -D_POSIX_C_SOURCE=200809L
LDFLAGS?=
BUILD_DIR?=build/debug/
SOURCES?=$(shell find src/ -type f -name '*.c')
OBJECTS=$(patsubst %.c,$(BUILD_DIR)%.o,$(SOURCES))
DEPENDENCIES=$(OBJECTS:.o=.d)
TARGET?=oas
all: $(BUILD_DIR)$(TARGET)
$(BUILD_DIR)$(TARGET): $(OBJECTS)
$(LD) $(LDFLAGS) -o $@ $^
$(BUILD_DIR)%.o: %.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
-include $(DEPENDENCIES)
clean:
rm -rf $(BUILD_DIR)