source: opengl-game/makefile@ ab65f84

feature/imgui-sdl points-test
Last change on this file since ab65f84 was ab65f84, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago

Get the vulkangame makefile target working in both Linux and OSX

  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[71876b9]1# CFLAGS are compiler flags and LIBFLAGS could be renamed LINKER_FLAGS
[5a643d3]2OS = $(shell uname)
[15c7ed9]3CC = g++
[ab65f84]4CFLAGS = -std=c++17 -Wall -pedantic -rdynamic
[17f28a1]5# -rdynamic is to generate debug info for dynamic symbols on debian-based
6# systems (tested on Linux Mint)
7# for OSX, using -g generates a newgame.dSYS directory which has debug symbols.
8# However, this has no effect on the stack trace, so there must be a way to specify a *.dSYS directory when running ./newgame
9# or to instead put thos symbols directly into the executable, like -rdynamic does for Linux
[4762301]10#-Wextra -fno-inline
[5a643d3]11
12ifeq ($(OS),Darwin)
[e6bc0f4]13 DEP = -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -lglfw -lglew
[5a643d3]14endif
[15c7ed9]15ifeq ($(OS),Linux)
16 DEP = -lglfw3 -lGLEW -lGL -ldl -lX11 -lXrandr -lXxf86vm -lXinerama -lXcursor -pthread
[5a643d3]17endif
18
[1a616e6]19IMGUI_FILES = IMGUI/imgui_demo.cpp IMGUI/imgui_draw.cpp IMGUI/imgui.cpp
20
[fc424f6]21# If I were generating .o files as well, I should use $? instead of $^
[8e232ce]22# as this well prevent regenerating .o files for unchanged .cpp files
23
[a23fc08]24newgame: new-game.cpp logger.cpp utils.cpp CrashLogger.cpp stb_image.cpp imgui_impl_glfw_gl3.cpp $(IMGUI_FILES)
[8e232ce]25 $(CC) $^ $(DEP) $(CFLAGS) -o $@
[5272b6b]26
[9e81839]27pong: pong.cpp logger.cpp
[8e232ce]28 $(CC) $^ $(DEP) $(CFLAGS) -o $@
[9e81839]29
[49756cb]30mygame: mygame.cpp common/shader.cpp common/texture.cpp common/controls-new.cpp
[8e232ce]31 $(CC) $^ $(DEP) $(CFLAGS) -o $@
[8a6d19d]32
33demo: game06.cpp common/shader.cpp common/texture.cpp common/controls.cpp
[8e232ce]34 $(CC) $^ $(DEP) $(CFLAGS) -o $@
[cfda3b2]35
[ab65f84]36CXX_FLAGS = -std=c++17 -Wall -pedantic # -O3 -rdynamic
[826df16]37
[ab65f84]38ifeq ($(OS),Darwin)
39 VULKAN_SDK_PATH = /Users/dportnoy15/Development/vulkan-sdk-macos-1.1.108.0/macOS
40endif
41ifeq ($(OS),Linux)
42 VULKAN_SDK_PATH = /home/dportnoy/Desktop/VulkanSDK/1.1.106.0/x86_64
43endif
[826df16]44
[ab65f84]45LIB_PATHS = -I$(VULKAN_SDK_PATH)/include
46ifeq ($(OS),Darwin)
47 LIB_PATHS := -Wl,-rpath,$(VULKAN_SDK_PATH)/lib $(LIB_PATHS)
48endif
49ifeq ($(OS),Linux)
50 LIB_PATHS := -L$(VULKAN_SDK_PATH)/lib $(LIB_PATHS)
51endif
[03f4c64]52
[ab65f84]53LIBS = -lSDL2
54ifeq ($(OS),Darwin)
55 LIBS := $(VULKAN_SDK_PATH)/lib/libvulkan.dylib $(LIBS)
56endif
57ifeq ($(OS),Linux)
58 LIBS := -lvulkan $(LIBS)
59endif
[826df16]60
61LIB_FLAGS = $(LIB_PATHS) $(LIBS)
62
63vulkangame: vulkan-game.cpp game-gui-sdl.cpp
64 $(CC) $(CXX_FLAGS) -o $@ $^ $(LIB_FLAGS)
[03f4c64]65
[cfda3b2]66clean:
[5272b6b]67 rm -f newgame
[9e81839]68 rm -f pong
[49756cb]69 rm -f mygame
[8a6d19d]70 rm -f demo
[03f4c64]71 rm -f vulkangame
Note: See TracBrowser for help on using the repository browser.