Created
December 3, 2019 01:23
-
-
Save wolfiestyle/3fb5610e03c40fe200f47249129ce781 to your computer and use it in GitHub Desktop.
Makefile for Vulkan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CXX=g++ | |
CXXFLAGS=-Wall -pipe -std=c++17 | |
GLSLC=glslc | |
GLSLFLAGS= | |
LDFLAGS=$(shell pkg-config --libs vulkan) $(shell pkg-config --libs glfw3) | |
SRC=$(wildcard *.cpp) | |
OBJ=$(SRC:.cpp=.o) | |
SHADERSRC=$(wildcard *.glsl) | |
SHADEROBJ=$(SHADERSRC:.glsl=.spv) | |
OUT=VulkanTest | |
.PHONY: all debug release run clean | |
all: debug | |
debug: CXXFLAGS += -ggdb | |
release: CXXFLAGS += -O2 -DNDEBUG | |
debug release: $(OUT) $(SHADEROBJ) | |
$(OUT): $(OBJ) | |
$(CXX) $(CXXFLAGS) $(OBJ) $(LDFLAGS) -o $@ | |
%.vert.spv: %.vert.glsl | |
$(GLSLC) $(GLSLFLAGS) -fshader-stage=vert $< -o $@ | |
%.frag.spv: %.frag.glsl | |
$(GLSLC) $(GLSLFLAGS) -fshader-stage=frag $< -o $@ | |
run: all | |
./$(OUT) | |
clean: | |
rm -f $(OBJ) $(SHADEROBJ) $(OUT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment