31 lines
562 B
Makefile
31 lines
562 B
Makefile
CC = gcc
|
|
RM = rm
|
|
|
|
SOURCES = $(wildcard src/*.c)
|
|
OBJETS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
|
|
|
|
CFLAGS = -std=c11 -pedantic
|
|
LDFLAGS =
|
|
|
|
EXE = example
|
|
EXE_EXT = out
|
|
|
|
%.o: src/%.c
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
|
|
|
compilation: $(OBJETS)
|
|
$(CC) -o $(EXE).$(EXE_EXT) $(OBJETS) $(LDFLAGS)
|
|
|
|
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
|
|
|
|
all:
|
|
main
|
|
|
|
clean:
|
|
$(RM) $(OBJETS) $(EXE).$(EXE_EXT)
|