From 219adc6c72dccbac90b79e54179028b677bd029a Mon Sep 17 00:00:00 2001 From: Anrock Date: Mon, 18 Mar 2019 04:12:20 +0300 Subject: [PATCH 1/2] Remove Makefile --- Makefile | 158 ------------------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index b94f2b877..000000000 --- a/Makefile +++ /dev/null @@ -1,158 +0,0 @@ -BASEDIR=$(CURDIR) -STACKLOCALBINDIR:=$(shell stack path --local-bin) -GHC_VERSIONS= 8.6.4 8.6.3 8.6.2 8.6.1 8.4.4 8.4.3 8.4.2 8.2.2 8.2.1 - -all: help -.PHONY: all - - - -## Builds hie for all supported GHC versions (8.2.1, 8.2.2, 8.4.2, 8.4.3, 8.4.4, 8.6.1, 8.6.2 and 8.6.3) -build: $(foreach version, $(GHC_VERSIONS), hie-$(version)) -.PHONY: build - -## Builds hie and hoogle databases for all supported GHC versions -build-all: build build-docs -.PHONY: build-all - -GHC := $(shell stack path --compiler-exe) - -ghc: - $(GHC) --version - @echo GHC -.PHONY: ghc - -# ------------------------------------------------------ - -## Builds hie for GHC version % only -hie-%: submodules cabal - stack --stack-yaml=stack-$*.yaml install happy - stack --stack-yaml=stack-$*.yaml build - stack --stack-yaml=stack-$*.yaml install \ - && cp '$(STACKLOCALBINDIR)/hie' '$(STACKLOCALBINDIR)/hie-$*' \ - && cp '$(STACKLOCALBINDIR)/hie-$*' '$(STACKLOCALBINDIR)/hie-$(basename $*)' -.PHONY: hie-% - -# ------------------------------------------------------ - -## Updates local git submodules -submodules: - git submodule sync --recursive - git submodule update --init --recursive -.PHONY: submodules - -# ------------------------------------------------------ - -## Makes sure that Cabal the lib is available for cabal-helper-wapper, -## to speed up project start - -## NOTE 1: cabal-helper-wrapper builds with old style cabal build, so -## must be installed this way. -## NOTE 2: this is temporary, will go away once the new cabal-helper lands. -## NOTE 3: This is needed for stack only projects too -cabal: - stack install cabal-install - cabal update - cabal install Cabal-2.4.1.0 --with-compiler=$(GHC) -.PHONY: cabal - -# ------------------------------------------------------ - -## Builds the Hoogle database for all supported GHC versions -build-docs: $(foreach version, $(GHC_VERSIONS), build-doc-$(version)) -.PHONY: build-docs - -## Builds the Hoogle database for GHC version % only -build-doc-%: - stack --stack-yaml=stack-$*.yaml exec hoogle generate - -# ------------------------------------------------------ - -## Runs hie tests -test: $(foreach version, $(GHC_VERSIONS), test-$(version)) -.PHONY: test - -test-%: submodules cabal - stack --stack-yaml=stack-$*.yaml test - -build-copy-compiler-tool: $(foreach version, $(GHC_VERSIONS), build-copy-compiler-tool-$(version)) -.PHONY: build-copy-compiler-tool - -build-copy-compiler-tool-%: submodules cabal - stack --stack-yaml=stack-$*.yaml build --copy-compiler-tool - -## Fixes icu related problems in MacOS -icu-macos-fix: icu-macos-fix-install icu-macos-fix-build -.PHONY: icu-macos-fix - -icu-macos-fix-install: - brew install icu4c -.PHONY: icu-macos-fix-install - -icu-macos-fix-build: $(foreach version, $(GHC_VERSIONS), icu-macos-fix-build-$(version)) -.PHONY: icu-macos-fix-build - -icu-macos-fix-build-%: - stack --stack-yaml=stack-$*.yaml build text-icu \ - --extra-lib-dirs=/usr/local/opt/icu4c/lib \ - --extra-include-dirs=/usr/local/opt/icu4c/include - -# ------------------------------------------------------ - -HIE_GIT_REF:=$(shell git describe --tags) -HIE_DIST_NAME:=hie-${HIE_GIT_REF}-$(shell uname -m)-$(shell uname -s) -HIE_DIST_DIR:=/tmp/${HIE_DIST_NAME} - -## Creates a tarball containing all the hie binaries -dist: $(foreach version, $(GHC_VERSIONS), dist-$(version)) - cp .stack-work/install/*/*/$(firstword $(GHC_VERSIONS))/bin/hie ${HIE_DIST_DIR} - cp .stack-work/install/*/*/$(firstword $(GHC_VERSIONS))/bin/hie-wrapper ${HIE_DIST_DIR} - tar -czf ${HIE_DIST_NAME}.tar.gz -C ${HIE_DIST_DIR} . - rm -r ${HIE_DIST_DIR} - -dist-%: - mkdir -p ${HIE_DIST_DIR} - stack --stack-yaml=stack-$*.yaml build - cp .stack-work/install/*/*/$*/bin/hie ${HIE_DIST_DIR} - mv ${HIE_DIST_DIR}/hie ${HIE_DIST_DIR}/hie-$* -.PHONY: dist - - -####################################################################################################################### -# Help task -####################################################################################################################### - -# COLORS -GREEN := $(shell tput -Txterm setaf 2) -YELLOW := $(shell tput -Txterm setaf 3) -WHITE := $(shell tput -Txterm setaf 7) -RESET := $(shell tput -Txterm sgr0) - -TARGET_MAX_CHAR_NUM=20 - -## Show help -help: - @echo '' - @echo 'Usage:' - @echo ' ${YELLOW}make${RESET} ${GREEN}${RESET}' - @echo '' - @echo 'Targets:' - @awk '/^[a-zA-Z\-\.\_0-9%]+:/ { \ - helpMessage = match(lastLine, /^## (.*)/); \ - if (helpMessage) { \ - helpCommand = $$1; sub(/:$$/, "", helpCommand); \ - helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ - hasWildcard = match(helpCommand, /%/); \ - if (hasWildcard) {\ - split("$(GHC_VERSIONS)", versions); \ - for (version in versions) { \ - expandedCommand = helpCommand; sub(/%/, versions[version], expandedCommand);\ - expandedMessage = helpMessage; sub(/%/, versions[version], expandedMessage);\ - printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", expandedCommand, expandedMessage; \ - } \ - } else { \ - printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ - } \ - } \ - } \ - { lastLine = $$0 }' $(MAKEFILE_LIST) From 9602fb11134c4a9bcc34f8566d4650e60347f461 Mon Sep 17 00:00:00 2001 From: Anrock Date: Mon, 18 Mar 2019 04:12:35 +0300 Subject: [PATCH 2/2] Remove build-all.ps1 --- build-all.ps1 | 53 --------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 build-all.ps1 diff --git a/build-all.ps1 b/build-all.ps1 deleted file mode 100644 index 8b8e7b3a6..000000000 --- a/build-all.ps1 +++ /dev/null @@ -1,53 +0,0 @@ -# Windows PowerShell script that replicates the function of 'make build-all'. -# -# The Makefile itself cannot be used on Windows, because it contains certain -# UNIX-only features, such as `cp` command and extensionless executables. - -$stackbindir = stack path --local-bin - -$supported_versions = - @{ "8.2.1" = "8.2" - ; "8.2.2" = "8.2" - ; "8.4.2" = "8.4" - ; "8.4.3" = "8.4" - ; "8.4.4" = "8.4" - ; "8.6.1" = "8.6" - ; "8.6.2" = "8.6" - ; "8.6.3" = "8.6" - ; "8.6.4" = "8.6" - } - -function main($requested_versions) { - $build_versions = - $requested_versions | sort ` - | %{ - $major = $supported_versions[$_] - if (-not $major) { bail_unsupported_version $_ } - @{ version=$_; major=$major } - } - - echo "Building HIE for GHC versions: $($build_versions | %{ $_.version } | sort)" - git submodule update --init - $build_versions | %{ build $_.version $_.major } -} - -function build($version, $major) { - echo "Building HIE for GHC $version" - stack --stack-yaml=stack-$version.yaml install happy - stack --stack-yaml=stack-$version.yaml install - cp "$stackbindir\hie.exe" "$stackbindir\hie-$version.exe" - cp "$stackbindir\hie.exe" "$stackbindir\hie-$major.exe" - - echo "Building Hoogle database for GHC $version" - stack --stack-yaml=stack-$version.yaml exec hoogle generate -} - -function bail_unsupported_version($v) { - echo "GHC $v is not supported." - echo "Specify list of GHC versions to build for, or omit any arguments to build for all supported versions." - echo "Supported versions are: $($supported_versions.Keys)" - exit -} - -if ($args) { main $args } -else { main $supported_versions.Keys }