summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 869ee4f67ad1d56223ceae117b002646324de639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

define newline


endef

shell-quote = '$(subst $(newline),'\$(newline)',$(subst ','\'',$(1)))'


ifdef nixpkgs
  override nixpkgs := $(call shell-quote,$(nixpkgs))
else
  nixpkgs = 'import <stockholm>'
endif

.PHONY: _default
_default: ghci

.PHONY: clean
clean:
	@find * -type f \( -name \*.o -o -name \*.hi \) -exec rm -v \{\} \;

.PHONY: ghci
ghci: shell.nix
	nix-shell --arg nixpkgs $(nixpkgs) --command 'exec ghci -Wall -fobject-code'

.PHONY: install
install:
	$(error to install run "make result && nix-env -i ./result")

.PHONY: result
result: shell.nix
	nix-build --arg nixpkgs $(nixpkgs) ./shell.nix

shell.nix: $(wildcard *.cabal)
	cabal2nix --shell . > $@