makefile-example/Makefile
Stephan Rehfeld 652828c29d Changed makefile so that the compiler writed dependencies to disk
and that dependencies are included into Makefile
2025-11-03 17:28:42 +01:00

20 lines
329 B
Makefile

CFLAGS += -Wall -Wextra -pedantic -Werror -std=c23
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)
DEPENDS = $(SOURCES:.c=.d)
DEPFLAGS = -MMD -MP
example: $(OBJECTS)
$(CC) $(OBJECTS) -o $@
%.o: %.c
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
-include $(DEPENDS)
.PHONY: clean
clean:
rm -f example $(OBJECTS) $(DEPENDS)