67 lines
1.5 KiB
Makefile
Executable File
67 lines
1.5 KiB
Makefile
Executable File
CXX = /usr/bin/g++
|
|
CXXFLAGS = -std=c++20 -MMD -MP -Wextra #-O3: optimierungsstufe 3, -MMD .d files, -MP leeres Target, Wextra alle Warnungen
|
|
# CXXFLAGS += -ftemplate-backtrace-limit=4 #-fno-pretty-templates
|
|
# most stuff glfw deps
|
|
LDFLAGS = -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -lgzutil -lfreetype
|
|
IFLAGS = -I/usr/include/freetype2
|
|
|
|
OBJECT_DIR = build
|
|
EXEC = vulkan_test
|
|
|
|
SRC = $(wildcard *.cpp)
|
|
OBJECTS = $($(notdir SRC):%.cpp=$(OBJECT_DIR)/%.o)
|
|
DEPENDS = ${OBJECTS:.o=.d}
|
|
|
|
CXXFLAGS += $(IFLAGS)
|
|
|
|
|
|
default: $(EXEC)
|
|
echo $(OBJECTS)
|
|
|
|
# TODO: REMOVE -g!
|
|
release: CXXFLAGS += -O3
|
|
release : default
|
|
|
|
# rule for the executable
|
|
$(EXEC): $(OBJECTS)
|
|
$(CXX) $(OBJECTS) -o $@ $(CXXFLAGS) $(LDFLAGS)
|
|
# include the makefiles generated by the -M flag
|
|
-include $(DEPENDS)
|
|
|
|
# rule for all ../build/*.o files
|
|
$(OBJECT_DIR)/%.o: %.cpp $(OBJECT_DIR)/.dirstamp
|
|
$(CXX) -c $< -o $@ $(CXXFLAGS) $(LDFLAGS)
|
|
|
|
# if build dir does not exist, create and put stamp inside
|
|
$(OBJECT_DIR)/.dirstamp:
|
|
mkdir -p $(OBJECT_DIR)
|
|
touch $@
|
|
|
|
#
|
|
# Extras Options
|
|
#
|
|
# with debug flags
|
|
debug: CXXFLAGS += -g # -DDEBUG
|
|
debug: default
|
|
|
|
# make with debug flags and run afterwards
|
|
run: CXXFLAGS += -g
|
|
run: default
|
|
$(CXX) $(OBJECTS) -o $(EXEC) $(CXXFLAGS) $(LDFLAGS)
|
|
./$(EXEC)
|
|
|
|
# with debug flags and run gnu debugger
|
|
gdb: CXXFLAGS += -g
|
|
gdb: default
|
|
gdb $(EXEC) -ex "layout src"
|
|
|
|
# build pch
|
|
pch:
|
|
$(CXX) pch.hpp -std=c++20 -O3 -g $(IFLAGS)
|
|
|
|
# remove all object and dependecy files
|
|
clean:
|
|
# -rm -f $(OBJECT_DIR)/*.o
|
|
# -rm -f $(OBJECT_DIR)/*.d
|
|
-rm -r $(OBJECT_DIR)
|