summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: bad1a649760257a91a59195f102bfa583bb43a85 (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
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: ghci
ghci: shell.nix
	nix-shell --arg nixpkgs $(nixpkgs) --command 'exec ghci -Wall' $<

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

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

.PHONY: update
update:
	git -C .hstool fetch origin
	git -C .hstool reset --hard origin/master
	git -C .hstool clean -dfx