--- a/Makefile Sat Jan 06 01:04:15 2024 +0100
+++ b/Makefile Tue Oct 08 22:24:40 2024 +0200
@@ -13,6 +13,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+CXX ?= g++
+CXXFLAGS ?= -O2 -g3 -ggdb -Wall -Wno-sign-compare
+CXXFLAGS += --std=c++20
+# CXXFLAGS += -Wextra
+LDFLAGS = $(shell pkg-config --cflags --libs epoxy x11 glu glm Magick++)
+
+ifeq ($(MODE), dev)
+CXXFLAGS += -fsanitize=undefined -fsanitize=address
+endif
+
+# TODO: provide debug symbols in separate files
+
all: build/shader-shark
.PHONY: all clean run
@@ -23,17 +35,9 @@
run: build/shader-shark
SHADER_SHARK_DATA_DIR=. $(<)
-SRC= \
- Shark.cpp \
- shader-shark.cpp \
- ImageLoader.cpp \
- Texture.cpp \
- Shader.cpp \
- Program.cpp \
- XAttrs.cpp \
- FileMonitor.cpp
+SRC = $(shell find -maxdepth 1 -name '*.cpp')
+HEADERS = $(shell find -maxdepth 1 -name '*.h')
-build/shader-shark: $(SRC) *.h
+build/shader-shark: $(SRC) $(HEADERS)
mkdir -p build
- $(CXX) -std=c++20 -g -o $(@) $(SRC) $$(pkg-config --cflags --libs \
- epoxy x11 glu glm Magick++)
+ $(CXX) $(CXXFLAGS) -o $(@) $(SRC) $(LDFLAGS)