init-projects/c/Makefile
2023-09-19 11:47:05 +02:00

29 lines
551 B
Makefile

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