# CFLAGS are compiler flags and LIBFLAGS could be renamed LINKER_FLAGS OS = $(shell uname) CC = g++ CFLAGS = -std=c++11 -Wall -pedantic -rdynamic # -rdynamic is to generate debug info for dynamic symbols on debian-based # systems (tested on Linux Mint) # for OSX, using -g generates a newgame.dSYS directory which has debug symbols. # However, this has no effect on the stack trace, so there must be a way to specify a *.dSYS directory when running ./newgame # or to instead put thos symbols directly into the executable, like -rdynamic does for Linux #-Wextra -fno-inline ifeq ($(OS),Darwin) DEP = -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -lglfw -lglew endif ifeq ($(OS),Linux) DEP = -lglfw3 -lGLEW -lGL -ldl -lX11 -lXrandr -lXxf86vm -lXinerama -lXcursor -pthread endif IMGUI_FILES = IMGUI/imgui_demo.cpp IMGUI/imgui_draw.cpp IMGUI/imgui.cpp # If I were generating .o files as well, I should use $? instead of $^ # as this well prevent regenerating .o files for unchanged .cpp files newgame: new-game.cpp logger.cpp utils.cpp CrashLogger.cpp stb_image.cpp imgui_impl_glfw_gl3.cpp $(IMGUI_FILES) $(CC) $^ $(DEP) $(CFLAGS) -o $@ pong: pong.cpp logger.cpp $(CC) $^ $(DEP) $(CFLAGS) -o $@ mygame: mygame.cpp common/shader.cpp common/texture.cpp common/controls-new.cpp $(CC) $^ $(DEP) $(CFLAGS) -o $@ demo: game06.cpp common/shader.cpp common/texture.cpp common/controls.cpp $(CC) $^ $(DEP) $(CFLAGS) -o $@ VULKAN_SDK_PATH = /home/dportnoy/Desktop/VulkanSDK/1.1.106.0/x86_64 CFLAGS_VULKAN = -std=c++17 -I$(VULKAN_SDK_PATH)/include -Wall -pedantic #LIBFLAGS = -L$(VULKAN_SDK_PATH)/lib `pkg-config --static --libs glfw3` -lvulkan LIBFLAGS = -L$(VULKAN_SDK_PATH)/lib -lvulkan -lSDL2 vulkangame: new-vulkan-game.cpp $(CC) $(CFLAGS_VULKAN) -o $@ $^ $(LIBFLAGS) clean: rm -f newgame rm -f pong rm -f mygame rm -f demo rm -f vulkangame