28 lines
641 B
Makefile
28 lines
641 B
Makefile
CC = gcc
|
|
CFLAGS = -std=c11 -Wall -Wextra -Werror -Wconversion -Wshadow -Wpedantic
|
|
CFLAGS += -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
|
|
CFLAGS += -Wmissing-declarations -Wfloat-equal -Wundef -Wpointer-arith
|
|
CFLAGS += -Wcast-align -Wwrite-strings -Wredundant-decls -Wnested-externs
|
|
CFLAGS += -Winline -O2 -g -fsanitize=address
|
|
|
|
SRCS = $(wildcard src/**/*.c) $(wildcard src/*.c)
|
|
OBJS = $(patsubst src/%.c, build/%.o, $(SRCS))
|
|
|
|
all: a.out
|
|
|
|
run: a.out
|
|
./a.out
|
|
|
|
a.out: $(OBJS)
|
|
$(CC) $(CFLAGS) -o a.out $^
|
|
|
|
build/%.o: src/%.c
|
|
@mkdir -p $(dir $@)
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
clean:
|
|
rm -rf build/ a.out
|
|
|
|
.PHONY: all clean
|
|
|