Skip to content

Commit 871f315

Browse files
committed
Haskell: Simply Makefile, use --make
The --make feature of GHC automatically detects dependencies and compiles them when they change. Nice!
1 parent 9dc1e26 commit 871f315

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

haskell/haskell.mk

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
# Compile all out-of-date source files
2-
# http://stackoverflow.com/a/2706067
1+
SRC = $(wildcard problem-*.hs)
2+
OUT = $(subst .hs,,$(SRC))
33

4-
SRC = $(wildcard *.hs)
5-
OUT = $(patsubst %.hs,%,$(SRC))
4+
.PHONY: main run clean nuke
65

7-
.PHONY: all run clean nuke
6+
main:
7+
ghc -i../modules --make $(SRC)
88

9-
all: $(OUT)
10-
11-
%: %.hs
12-
ghc -i../modules $< -o $@
13-
14-
run: $(OUT)
9+
run: main
1510
./$(OUT)
1611

1712
clean:

0 commit comments

Comments
 (0)