diff --git a/.gitignore b/.gitignore index bc08b844a70d1c23742042237cf955aa57e05435..785af8134bac19d68ff84dcdc16eb277eb9ba6db 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ bin/ build/ *.o +*.d *.aux *.fdb_latexmk diff --git a/basic/Makefile b/basic/Makefile index 39e2fba3f95f080ad47804f3599ae82bdebe72f7..2308c5931658c8b69471139ae01bfc9845e46bcb 100644 --- a/basic/Makefile +++ b/basic/Makefile @@ -1,5 +1,5 @@ -CXXFLAGS := -std=c++17 -LDFLAGS := -lsfml-graphics -lsfml-window -lsfml-system +CXXFLAGS := -g -std=c++17 +LDFLAGS := -g -lsfml-graphics -lsfml-window -lsfml-system SOURCES := $(wildcard *.cpp) EXECUTABLES := $(patsubst %.cpp,%,$(SOURCES)) diff --git a/components/Makefile b/components/Makefile index e9258cc19ca3a11d10a6588251580d7bb26ce0ac..6f38bdf9103fbec270aa9cd73854b871d1b3275f 100644 --- a/components/Makefile +++ b/components/Makefile @@ -1,12 +1,12 @@ -CXXFLAGS := -std=c++17 -Wall -Wextra -LDFLAGS := -lsfml-graphics -lsfml-window -lsfml-system +CXXFLAGS := -g -std=c++17 -Wall -Wextra +LDFLAGS := -g -lsfml-graphics -lsfml-window -lsfml-system SOURCES := $(wildcard *.cpp) OBJECTS := $(patsubst %.cpp,%.o,$(SOURCES)) -# Note: This makefile is not entirely correct, it does not take header dependencies into account. -# It is, however, enough to compile the project here, which is the intended use. If you wish to -# develop the code further, I suggest either mymake or writing a CMake-file. +# Dependencies: +DEPS := $(patsubst %.o,%.d,$(OBJECTS)) +DEPFLAGS := -MMD -MP all: game @@ -14,7 +14,7 @@ pdf: uml.pdf .PHONY: clean clean: - rm -f game $(OBJECTS) + rm -f game $(OBJECTS) $(DEPS) find . -name "uml.*" | grep -Ev "(pdf|tex)$$" | xargs rm -f uml.pdf: uml.tex @@ -24,4 +24,7 @@ game: $(OBJECTS) g++ $(CXXFLAGS) -o game $(OBJECTS) $(LDFLAGS) $(OBJECTS): %.o: %.cpp - g++ $(CXXFLAGS) -c -o $@ $< + g++ $(CXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Include dependencies +-include $(DEPS) diff --git a/inheritance/Makefile b/inheritance/Makefile index e9258cc19ca3a11d10a6588251580d7bb26ce0ac..6f38bdf9103fbec270aa9cd73854b871d1b3275f 100644 --- a/inheritance/Makefile +++ b/inheritance/Makefile @@ -1,12 +1,12 @@ -CXXFLAGS := -std=c++17 -Wall -Wextra -LDFLAGS := -lsfml-graphics -lsfml-window -lsfml-system +CXXFLAGS := -g -std=c++17 -Wall -Wextra +LDFLAGS := -g -lsfml-graphics -lsfml-window -lsfml-system SOURCES := $(wildcard *.cpp) OBJECTS := $(patsubst %.cpp,%.o,$(SOURCES)) -# Note: This makefile is not entirely correct, it does not take header dependencies into account. -# It is, however, enough to compile the project here, which is the intended use. If you wish to -# develop the code further, I suggest either mymake or writing a CMake-file. +# Dependencies: +DEPS := $(patsubst %.o,%.d,$(OBJECTS)) +DEPFLAGS := -MMD -MP all: game @@ -14,7 +14,7 @@ pdf: uml.pdf .PHONY: clean clean: - rm -f game $(OBJECTS) + rm -f game $(OBJECTS) $(DEPS) find . -name "uml.*" | grep -Ev "(pdf|tex)$$" | xargs rm -f uml.pdf: uml.tex @@ -24,4 +24,7 @@ game: $(OBJECTS) g++ $(CXXFLAGS) -o game $(OBJECTS) $(LDFLAGS) $(OBJECTS): %.o: %.cpp - g++ $(CXXFLAGS) -c -o $@ $< + g++ $(CXXFLAGS) $(DEPFLAGS) -c -o $@ $< + +# Include dependencies +-include $(DEPS)