CC = gcc CFLAGS = -Ofast -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wformat=1 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wlogical-op -Wunreachable-code -Wundef -Wold-style-definition -Wvla -std=c99 -fsanitize=address -fsanitize=undefined SOURCEDIR = src BUILDDIR = build SOURCES = $(wildcard $(SOURCEDIR)/*.c) OBJS = $(patsubst $(SOURCEDIR)/%.c, $(BUILDDIR)/%.o, $(SOURCES)) all: $(OBJS) @$(CC) -o ./$(BUILDDIR)/out $^ $(CFLAGS) clean: @$(RM) -rf $(BUILDDIR) run: clean all @./$(BUILDDIR)/out test.fun $(BUILDDIR)/%.o: $(SOURCEDIR)/%.c @mkdir -p $(BUILDDIR) @$(CC) -c -o $@ $< $(CFLAGS)