summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: bf7ea23e311098aff76e543c38b759a8c43e0f92 (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
37
38
39
40
41
42
43
44
45
46
47
pname := hack
nixpkgs := ${HOME}/src/nixpkgs

configureFlags := -fdevelopment

.PHONY: all build clean distclean configure run

all: run

clean:
	cabal clean

distclean: clean
	rm -f result
	rm -fR log

ifeq (${NIX_MYENV_NAME},${pname})

build:
	cabal build ${pname}

configure:
	cabal configure ${configureFlags}

run: build
	mkdir -p log
	dist/build/${pname}/${pname}

else
#
# setup development environment (and rerun make)
#

ifdef nixpkgs
export NIX_PATH := nixpkgs=${nixpkgs}
endif

# XXX result is a symlink we want to check
MAKEFLAGS += -L

build configure run: result
	echo make $@ | result/bin/load-env-${pname}

result: default.nix
	nix-build $<

endif