minecraftvulkan/Makefile

58 lines
1.1 KiB
Makefile
Raw Normal View History

2022-09-22 15:14:00 +00:00
CC = g++
2022-09-19 01:20:51 +00:00
INCFLAGS = -Isrc
INCFLAGS += -Iengine
INCFLAGS += -Ilib/glfw/include
INCFLAGS += -Ilib/glm
2022-09-21 02:02:58 +00:00
INCFLAGS += -Ilib/stb
INCFLAGS += -Ilib/openal-soft/include
INCFLAGS += -Ilib/freealut/include
2022-09-19 01:20:51 +00:00
CCFLAGS = -std=c++17 -O2 -g
CCFLAGS += $(INCFLAGS)
LDFLAGS = -lm
2022-09-22 17:21:30 +00:00
LDFLAGS += -lglfw
2022-09-22 22:29:34 +00:00
LDFLAGS += -ldl
2022-09-22 15:14:00 +00:00
LDFLAGS += -lopenal
LDFLAGS += -lalut
2022-09-20 01:28:41 +00:00
LDFLAGS += -lvulkan
LDFLAGS += $(INCFLAGS)
2022-09-19 01:20:51 +00:00
2022-10-01 18:35:16 +00:00
BIN = bin
2022-09-19 01:20:51 +00:00
SRC = $(shell find src -name "*.cpp")
SRC += $(shell find engine -name "*.cpp")
2022-10-01 18:35:16 +00:00
OBJ = $(SRC:%.cpp=$(BIN)/%.o)
2022-09-19 01:20:51 +00:00
VERTSRC = $(shell find ./res/shaders -type f -name "*.vert")
VERTOBJ = $(patsubst %.vert, %.vert.spv, $(VERTSRC))
FRAGSRC = $(shell find ./res/shaders -type f -name "*.frag")
FRAGOBJ = $(patsubst %.frag, %.frag.spv, $(FRAGSRC))
.PHONY: all clean
2022-09-22 22:37:59 +00:00
all: dirs shader build
2022-09-19 01:20:51 +00:00
dirs:
mkdir -p ./$(BIN)
2022-10-01 18:35:16 +00:00
mkdir -p ./$(BIN)/src
mkdir -p ./$(BIN)/engine
2022-09-19 01:20:51 +00:00
shader: $(VERTOBJ) $(FRAGOBJ)
run: build
$(RUN) $(BIN)/game
build: dirs shader ${OBJ}
${CC} -o $(BIN)/game $(filter %.o,$^) $(LDFLAGS)
%.spv: %
glslc -o $@ $<
2022-10-01 18:35:16 +00:00
$(BIN)/%.o: %.cpp
2022-09-19 01:20:51 +00:00
$(CC) -o $@ -c $< $(CCFLAGS)
clean:
rm -rf app
2022-10-01 18:35:16 +00:00
rm -rf $(BIN)
rm -rf res/shaders/*.spv