diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -1,13 +1,35 @@ +# The install target will add this before all paths it writes to. PREFIX?= -# Can be stack or cabal + +# Can be "stack" or "cabal", or "./Setup" to build and use Setup.hs BUILDER?=stack +# Propigate flags through ghc to linker and compiler. +ghc_options=$(shell \ + for w in $(LDFLAGS); do \ + printf -- "-optl%s\n" "$$w"; \ + done; \ + for w in $(CFLAGS); do \ + printf -- "-optc%s\n" "$$w"; \ + done; \ + for w in $(CPPFLAGS); do \ + printf -- "-optc-Wp,%s\n" "$$w"; \ + done; \ + ) + build: rm -f keysafe $(MAKE) keysafe keysafe: - $(BUILDER) build + if [ "$(BUILDER)" = ./Setup ]; then ghc --make Setup; fi + if [ "$(BUILDER)" = stack ]; then \ + $(BUILDER) build --ghc-options="$(ghc_options)"; \ + else \ + $(BUILDER) configure --ghc-options="$(ghc_options)"; \ + $(BUILDER) build; \ + fi + $(BUILDER) build --ghc-options="$(ghc_options)" if [ "$(BUILDER)" = stack ]; then \ ln -sf $$(find .stack-work/ -name keysafe -type f | grep build/keysafe/keysafe | tail -n 1) keysafe; \ else \ @@ -15,7 +37,8 @@ keysafe: fi clean: - rm -rf keysafe dist .stack-work + if [ "$(BUILDER)" != ./Setup ] && [ "$(BUILDER)" != cabal ]; then $(BUILDER) clean; fi + rm -rf keysafe dist .stack-work Setup install: install-files useradd --system keysafe |