init-projects/c/Makefile

32 lines
562 B
Makefile
Raw Permalink Normal View History

2024-02-01 15:16:54 +01:00
CC = gcc
RM = rm
2023-09-19 11:47:05 +02:00
SOURCES = $(wildcard src/*.c)
OBJETS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
2023-09-19 11:47:05 +02:00
2023-11-25 21:18:30 +01:00
CFLAGS = -std=c11 -pedantic
LDFLAGS =
2023-09-19 11:47:05 +02:00
EXE = example
EXE_EXT = out
2023-09-19 11:47:05 +02:00
%.o: src/%.c
2023-11-12 16:23:10 +01:00
$(CC) -c $< -o $@ $(CFLAGS)
2023-09-19 11:47:05 +02:00
compilation: $(OBJETS)
$(CC) -o $(EXE).$(EXE_EXT) $(OBJETS) $(LDFLAGS)
2023-09-19 11:47:05 +02:00
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)