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