31 lines
584 B
Makefile
31 lines
584 B
Makefile
CC = gcc
|
|
RM = rm
|
|
|
|
SOURCES = $(wildcard src/*.c)
|
|
OBJECTS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
|
|
|
|
CFLAGS = -std=c11 -pedantic
|
|
LDFLAGS =
|
|
|
|
EXE = example
|
|
EXE_EXT = out
|
|
|
|
%.o: src/%.c
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
|
|
|
release: CFLAGS += -O3
|
|
release: compilation
|
|
|
|
debug: CFLAGS += -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes
|
|
debug: CFLAGS += -fanalyzer -fsanitize=undefined -g -Og
|
|
debug: LDFLAGS += -fsanitize=undefined
|
|
debug: compilation
|
|
|
|
compilation: $(OBJECTS)
|
|
$(CC) -o $(EXE).$(EXE_EXT) $(OBJECTS) $(LDFLAGS)
|
|
|
|
all:
|
|
release
|
|
|
|
clean:
|
|
$(RM) $(OBJECTS) $(EXE).$(EXE_EXT)
|