Initial commit
This commit is contained in:
71
Makefile
Normal file
71
Makefile
Normal file
@@ -0,0 +1,71 @@
|
||||
CXX := clang++
|
||||
CXXFLAGS := -Wall -Wextra -std=c++17
|
||||
CC := clang
|
||||
CFLAGS := -Wall -Wextra
|
||||
|
||||
INCLUDES := -I./src/ \
|
||||
-I./thirdparty/glad/include/ \
|
||||
-I./thirdparty/glm/ \
|
||||
-I./thirdparty/imgui/ \
|
||||
-I./thirdparty/imgui/backends/ \
|
||||
-I./thirdparty/stb/ \
|
||||
-I./thirdparty/tinyobjloader/ \
|
||||
|
||||
LDFLAGS := -lglfw -lGL -lm
|
||||
|
||||
TARGET := build/fan
|
||||
|
||||
OBJS := build/camera.o \
|
||||
build/framebuffer.o \
|
||||
build/loader.o \
|
||||
build/main.o \
|
||||
build/material.o \
|
||||
build/mesh.o \
|
||||
build/renderer.o \
|
||||
build/scene.o \
|
||||
build/shader.o \
|
||||
build/texture.o \
|
||||
build/transform.o \
|
||||
build/utils.o \
|
||||
build/window.o \
|
||||
build/glad.o \
|
||||
build/stb_image.o \
|
||||
build/tiny_obj_loader.o \
|
||||
|
||||
IMGUI_OBJS := build/imgui.o build/imgui_demo.o build/imgui_draw.o build/imgui_tables.o build/imgui_widgets.o \
|
||||
build/imgui_impl_glfw.o build/imgui_impl_opengl3.o
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS) $(IMGUI_OBJS)
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
build/%.o: src/%.cpp
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
|
||||
|
||||
build/glad.o: thirdparty/glad/src/gl.c
|
||||
$(CC) $(CFLAGS) -I./thirdparty/glad/include/ -c $< -o $@
|
||||
|
||||
build/stb_image.o: thirdparty/stb/stb_image.h
|
||||
$(CC) $(CFLAGS) -DSTB_IMAGE_IMPLEMENTATION -xc -c $< -o $@
|
||||
|
||||
build/tiny_obj_loader.o: thirdparty/tinyobjloader/tiny_obj_loader.h
|
||||
$(CXX) $(CXXFLAGS) -DTINYOBJLOADER_IMPLEMENTATION -xc++ -c $< -o $@
|
||||
|
||||
define imgui_rule
|
||||
build/$(1): thirdparty/imgui/$(2)
|
||||
$(CXX) $(CXXFLAGS) -I./thirdparty/imgui/ -c $$< -o $$@
|
||||
endef
|
||||
|
||||
$(eval $(call imgui_rule,imgui.o,imgui.cpp))
|
||||
$(eval $(call imgui_rule,imgui_demo.o,imgui_demo.cpp))
|
||||
$(eval $(call imgui_rule,imgui_draw.o,imgui_draw.cpp))
|
||||
$(eval $(call imgui_rule,imgui_tables.o,imgui_tables.cpp))
|
||||
$(eval $(call imgui_rule,imgui_widgets.o,imgui_widgets.cpp))
|
||||
$(eval $(call imgui_rule,imgui_impl_glfw.o,backends/imgui_impl_glfw.cpp))
|
||||
$(eval $(call imgui_rule,imgui_impl_opengl3.o,backends/imgui_impl_opengl3.cpp))
|
||||
|
||||
clean:
|
||||
rm -f build/*.o $(TARGET)
|
||||
Reference in New Issue
Block a user