diff --git a/Makefile/Makefile b/Makefile/Makefile index da06de7..a51fc33 100644 --- a/Makefile/Makefile +++ b/Makefile/Makefile @@ -1,19 +1,23 @@ -CPPFLAGS ?= -Werror -Wall +# Preproc options +# -MMD is used to generate .d files for header dependencies +CPPFLAGS = -MMD +# main compilation +CFLAGS ?= -Werror -Wall +#Linker flags +LDFLAGS = +#Linker path +LDLIBS = program = test sources = $(wildcard *.c) objects = $(sources:%.c=%.o) depends = $(sources:%.c=%.d) -%.d: %.c - @$(CPP) $(CPPFLAGS) -c -MP -MM -MT "$@ $*.o" $< >$@ - $(program): $(objects) - $(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) .PHONY: clean clean: - rm -f $(program) $(objects) $(depends) + $(RM) $(program) $(objects) $(depends) ifneq ($(MAKECMDGOALS),clean) -include $(depends)