summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2025-09-03 23:31:40 +0200
committerTom Smeding <tom@tomsmeding.com>2025-09-03 23:37:53 +0200
commit7e60437d3c064bca402d486be967c43bf4326067 (patch)
tree8b4307b90c942861176d9c705cd760b9fe7b6c6b /Makefile
Initial (with old code)HEADmaster
This includes old code too, perhaps from 2021-05-05, judging from the birth timestamp on the directory. The old code included option parsing and equation solving for fancy mutually-dependent options, but no actual rendering (imagine that).
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ed2da60
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+CXX = g++
+CXXFLAGS = -Wall -Wextra -std=c++20 -march=native
+CXXFLAGS += -D_DEFAULT_SOURCE
+LDFLAGS = -lpng
+BIN = buddhabrot
+
+OBJDIR = .obj
+
+ifneq ($(DEBUG),)
+ CXXFLAGS += -Og -g -fsanitize=address
+ LDFLAGS += -fsanitize=address
+else
+ CXXFLAGS += -O3
+endif
+
+SOURCES := $(wildcard *.cpp)
+OBJECTS := $(patsubst %.cpp,$(OBJDIR)/%.o,$(SOURCES))
+HEADERS := $(wildcard *.h)
+
+.PHONY: all clean
+
+all: $(BIN)
+
+clean:
+ rm -rf $(BIN) $(OBJDIR)
+
+
+$(BIN): $(OBJECTS)
+ $(CXX) -o $@ $^ $(LDFLAGS)
+
+$(OBJDIR)/%.o: %.cpp $(HEADERS) | $(OBJDIR)
+ $(CXX) $(CXXFLAGS) -c -o $@ $<
+
+$(OBJDIR):
+ mkdir $@