init-projects/c/Makefile
2024-02-01 15:16:54 +01:00

31 lines
566 B
Makefile

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