summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-07-27 11:02:45 +0200
committertv <tv@shackspace.de>2014-07-27 11:03:05 +0200
commitbc8d3ab9d134baa4517757f6f7ab80857361bd65 (patch)
tree046f79d43cc0dfb99cdca71918c505530b834bb1 /Makefile
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bf7ea23
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,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