cabal := $(shell find . -name '*.cabal' -print -quit) package := $(notdir ./$(cabal:.cabal=)) #package := $(shell 2>&1 stack ide packages) #STACK_FLAGS ?= --nix all: build build: stack $(STACK_FLAGS) build $(STACK_BUILD_FLAGS) .PHONY: test test: ! grep -q '^Test-Suite\>' $(cabal) || \ { stack $(STACK_FLAGS) test $(STACK_TEST_FLAGS) --test-arguments "$(STACK_TEST_ARGS)"; } GHCID_TEST_ARGS ?= GHCID_TEST ?= ":main --color always $(GHCID_TEST_ARGS)" ghcid: ghcid --color=always \ --warnings \ --command "stack $(STACK_FLAGS) $(GHCID_STACK_FLAGS) ghci $(GHCID_GHCI_FLAGS) --test \ $(shell 2>&1 stack ide targets) \ --ghci-options=-fobject-code" \ --test $(GHCID_TEST) \ $(GHCID_FLAGS) clean: stack $(STACK_FLAGS) clean $(STACK_CLEAN_FLAGS) cleaner: stack $(STACK_FLAGS) clean --full $(STACK_CLEAN_FLAGS) %/fast: override STACK_BUILD_FLAGS+=--fast %/fast: override STACK_HADDOCK_FLAGS+=--fast %/fast: override STACK_TEST_FLAGS+=--fast %/fast: % %/debug: override STACK_BUILD_FLAGS+=--flag $(cabal:.cabal=):debug %/debug: override STACK_TEST_FLAGS+=--flag $(cabal:.cabal=):debug %/debug: % %/accept: override STACK_TEST_ARGS+=--accept %/accept: % doc: stack $(STACK_FLAGS) haddock $(STACK_HADDOCK_FLAGS) %.html: %.md markdown $*.md >$*.html %.html/view: %.html sensible-browser $*.html .hlint.yaml: $(shell find src -name '*.hs' -not -name 'HLint.hs') sed -i -e '/^# BEGIN: generated hints/,/^# END: Generated by hlint/d' $@ echo >>$@ '# BEGIN: generated hints' hlint --find . | sed -ne 's/^- fixity:/- fixity:/p' | sort -u >>$@ echo >>$@ '# END: generated hints' lint: .hlint.yaml if hlint --quiet --report=hlint.html $(HLINT_FLAGS) .; \ then rm -f hlint.html; \ else sensible-browser ./hlint.html & fi tag: name=$$(sed -ne 's/^name: *\(.*\)/\1/p' "$(cabal)"); \ version=$$(sed -ne 's/^version: *\(.*\)/\1/p' "$(cabal)"); \ git tag --merged | grep -Fqx "$$name-$$version" || \ git tag -f -s -m "$$name v$$version" $$name-$$version tar: stack $(STACK_FLAGS) sdist $(STACK_SDIST_FLAGS) upload: LANG=C stack $(STACK_FLAGS) upload $(STACK_UPLOAD_FLAGS) . .PHONY: stats stats: gitstats . $@ stats/view: stats sensible-browser stats/index.html