diff --git a/Makefile/Makefile b/Makefile/Makefile new file mode 100644 index 0000000..a5a0bfc --- /dev/null +++ b/Makefile/Makefile @@ -0,0 +1,20 @@ +CXXFLAGS ?= -Werr -Wall + +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) + +ifneq ($(MAKECMDGOALS),clean) +-include $(depends) +endif