summaryrefslogtreecommitdiff
path: root/2019/Makefile
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-12-01 10:03:22 +0100
committertomsmeding <tom.smeding@gmail.com>2019-12-01 10:03:22 +0100
commit29c8fc0caf7b43824fb406ba85b088b0e9ec308b (patch)
treead5b198b2d8f56b77592b46bc25a4f240b9850c8 /2019/Makefile
parent35f82a2aed37c8daf523ac4c9fbf7112659e8dda (diff)
Compilation system
Diffstat (limited to '2019/Makefile')
-rw-r--r--2019/Makefile33
1 files changed, 33 insertions, 0 deletions
diff --git a/2019/Makefile b/2019/Makefile
new file mode 100644
index 0000000..a8383a3
--- /dev/null
+++ b/2019/Makefile
@@ -0,0 +1,33 @@
+GHC = ghc
+GHCFLAGS = -Wall -O3
+CXX = g++
+CXXFLAGS = -Wall -Wextra -std=c++17 -O2
+
+OBJDIR = obj
+
+HASKELL_AUX := Input.hs
+CPP_AUX :=
+HASKELL_SRC := $(filter-out $(HASKELL_AUX),$(wildcard *.hs))
+CPP_SRC := $(filter-out $(CPP_AUX),$(wildcard *.cpp))
+HASKELL_BIN := $(HASKELL_SRC:.hs=)
+CPP_BIN := $(CPP_SRC:.cpp=)
+
+BINARIES := $(HASKELL_BIN) $(CPP_BIN)
+
+.PHONY: all clean
+
+
+all: $(BINARIES)
+
+clean:
+ rm -f $(BINARIES)
+ rm -rf $(OBJDIR)
+
+$(HASKELL_BIN): %: %.hs $(HASKELL_AUX) | $(OBJDIR)/%
+ $(GHC) $(GHCFLAGS) -odir $(OBJDIR)/$* -hidir $(OBJDIR)/$* -o $@ $<
+
+$(CPP_BIN): %: %.cpp $(CPP_AUX) | $(OBJDIR)
+ $(CXX) $(CXXFLAGS) -o $@ $<
+
+$(OBJDIR)/%:
+ mkdir -p $@