From 592993dcbb6ab134991836734eb68ebbd31c9946 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Wed, 14 Jul 2021 13:53:24 +0000
Subject: [PATCH] added makefiles

---
 .gitignore       |    1 +
 Makefile         |   33 +++++++++++++++++++++++++++++++++
 parsers/Makefile |    8 ++++++++
 gens/Makefile    |    8 ++++++++
 4 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index a4e12cc..359f692 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 **~
 \#*\#
 **.o
+docconv
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..84ac690
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,33 @@
+export BUILD_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))build
+export CXX=g++
+export CXXFLAGS=
+_OBJS-top=ast.o main.o
+DEBUG=a
+
+ifdef DEBUG
+	CXXFLAGS+=-g
+endif
+
+OBJS-top=$(patsubst %,$(BUILD_DIR)/%,$(_OBJS-top))
+
+.PHONY: directories parser gen clean
+
+default: docconv directories
+
+docconv: parser gen $(OBJS-top)
+	$(CXX) $(CXXFLAGS) -o $@ $(BUILD_DIR)/*.o
+
+$(BUILD_DIR)/%.o: %.cpp
+	$(CXX) -c $(CXXFLAGS) -o $@ $<
+
+parser: directories
+	$(MAKE) -C parsers
+
+gen: directories
+	$(MAKE) -C gens
+
+directories:
+	mkdir -p $(BUILD_DIR)
+
+clean:
+	rm -rf $(BUILD_DIR)
diff --git a/gens/Makefile b/gens/Makefile
new file mode 100644
index 0000000..1112400
--- /dev/null
+++ b/gens/Makefile
@@ -0,0 +1,8 @@
+_OBJS-gen=dot.o
+
+export OBJS-gen=$(patsubst %,$(BUILD_DIR)/%,$(_OBJS-gen))
+
+default: $(OBJS-gen)
+
+$(BUILD_DIR)/%.o: %.cpp
+	$(CXX) -c $(CXXFLAGS) -o $@ $<
diff --git a/parsers/Makefile b/parsers/Makefile
new file mode 100644
index 0000000..b7186a3
--- /dev/null
+++ b/parsers/Makefile
@@ -0,0 +1,8 @@
+_OBJS-par=
+
+export OBJS-par=$(patsubst %,$(BUILD_DIR)/%,$(_OBJS-par))
+
+default: $(OBJS-par)
+
+$(BUILD_DIR)/%.o: %.cpp
+	$(CXX) -c $(CXXFLAGS) -o $@ $<

--
Gitblit v1.10.0