summaryrefslogtreecommitdiff
path: root/2020/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '2020/Makefile')
-rw-r--r--2020/Makefile15
1 files changed, 10 insertions, 5 deletions
diff --git a/2020/Makefile b/2020/Makefile
index 340e2ce..ff844f6 100644
--- a/2020/Makefile
+++ b/2020/Makefile
@@ -15,7 +15,7 @@ CPP_BIN := $(CPP_SRC:.cpp=)
BINARIES := $(HASKELL_BIN) $(CPP_BIN)
-.PHONY: all clean
+.PHONY: all clean depend
all: $(BINARIES)
@@ -24,6 +24,12 @@ clean:
rm -f $(BINARIES) .depend_hs
rm -rf $(OBJDIR)
+# Generate the .depend_hs file for correct Haskell dependency tracking
+depend:
+ ghc -dep-suffix '' -dep-makefile .depend_hs -M $(GHCBASEFLAGS) $(HASKELL_SRC)
+ sed -i 's/\.o *:/:/; s/\.hi$$/.hs/g; s/\.hi[ \t]/.hs/g' .depend_hs
+ rm -f .depend_hs.bak
+
$(HASKELL_BIN): %: %.hs | $(OBJDIR)/%
$(GHC) $(GHCFLAGS) -odir $(OBJDIR)/$* -hidir $(OBJDIR)/$* -o $@ $<
@@ -34,9 +40,8 @@ $(OBJDIR)/%:
mkdir -p $@
-.depend_hs: $(HASKELL_SRC) $(HASKELL_AUX)
- ghc -dep-suffix '' -dep-makefile $@ -M $(GHCBASEFLAGS) $(HASKELL_SRC)
- rm -f .depend_hs.bak
- sed -i 's/\.o *:/:/; s/\.hi$$/.hs/g; s/\.hi[ \t]/.hs/g' $@
+# By default, if it's needed, just create an empty file (but don't truncate if it exists)
+.depend_hs:
+ touch $@
-include .depend_hs