summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-04-28 22:10:06 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-04-28 22:11:05 +0200
commitb835e0c8cc71626b10b9d0f02d9530460f82ca5e (patch)
tree417f724c4c69108bfa973c76f6b5df1b547851ea /Makefile
Initial commitHEADmaster
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..716021a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+CXX = g++
+CXXFLAGS = -Wall -Wextra -std=c++17 -O2 -g -pthread -flto $(pkg-config --cflags mpfr)
+LDFLAGS = $(CXXFLAGS) $(pkg-config --libs mpfr)
+TARGET = mpmandel
+
+SOURCES = $(wildcard *.cpp) lodepng/lodepng.cpp
+
+OBJDIR = obj
+
+.PHONY: all clean
+
+all: $(TARGET)
+
+clean:
+ @echo "Cleaning"
+ @rm -f $(TARGET)
+ @rm -rf $(OBJDIR)
+
+
+$(OBJDIR)/%.o: %.cpp $(wildcard *.h) | $(OBJDIR)
+ @mkdir -p $(dir $@)
+ @echo "CXX $<"
+ @$(CXX) $(CXXFLAGS) -c -o $@ $<
+
+$(TARGET): $(patsubst %.cpp,$(OBJDIR)/%.o,$(SOURCES)) | $(OBJDIR)
+ @echo "LD -o $@"
+ @$(CXX) -o $@ $^ $(LDFLAGS)
+
+$(OBJDIR):
+ @mkdir -p $(OBJDIR)