init-projects/c/Makefile
2023-11-25 21:18:30 +01:00

31 lines
576 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)