Adds distrib/Makefile from @alpmestan
authorMoritz Angermann <moritz.angermann@gmail.com>
Fri, 8 Dec 2017 04:58:53 +0000 (12:58 +0800)
committerMoritz Angermann <moritz.angermann@gmail.com>
Mon, 5 Feb 2018 01:53:45 +0000 (09:53 +0800)
distrib/Makefile [new file with mode: 0644]

diff --git a/distrib/Makefile b/distrib/Makefile
new file mode 100644 (file)
index 0000000..e806ff8
--- /dev/null
@@ -0,0 +1,34 @@
+MAKEFLAGS += --no-builtin-rules
+.SUFFIXES:
+
+ProjectVersion:=$(shell bin/ghc --numeric-version)
+
+include mk/install.mk
+
+define GHC_WRAPPER
+#!/bin/sh
+exec "$(libdir)/bin/ghc" -B"$(libdir)" $${1+"$$@"}
+endef
+
+export GHC_WRAPPER
+
+.PHONY: default
+default:
+       @echo 'Run "make install" to install'
+       @false
+
+.PHONY: install
+install:
+       @cp settings lib/
+       @echo $(prefix) $(bindir) $(libdir)
+       @mkdir -p $(prefix) $(libdir) $(bindir)
+       @cp -R lib/* $(libdir)/
+       # cp the rest to $(prefix) ? or maybe handle $(datadir) etc too?
+       @if [ "$(bindir)" = "$(prefix)/bin" ] || [ "$(libdir)" != "$(prefix)/lib" ]; then \
+          echo "custom bindir or libdir"; \
+          mkdir -p $(libdir)/bin; \
+          cp bin/* $(libdir)/bin/; \
+          echo "$$GHC_WRAPPER" > $(bindir)/ghc; \
+       fi
+       @echo "ghc available at $(bindir)/ghc"
+       @echo done