Makefile: fix LLVM tools detection for wasi-libc

This makes the `make wasi-libc` command much more reliable and makes the
CI configuration simpler. Also, it avoids warnings when they are not
relevant.
Этот коммит содержится в:
Ayke van Laethem 2020-02-27 16:58:41 +01:00 коммит произвёл Ayke
родитель 6896b0014b
коммит 978a0cd9b0
3 изменённых файлов: 22 добавлений и 22 удалений

Просмотреть файл

@ -53,12 +53,12 @@ commands:
steps: steps:
- restore_cache: - restore_cache:
keys: keys:
- wasi-libc-sysroot-v0 - wasi-libc-sysroot-v1
- run: - run:
name: "Build wasi-libc" name: "Build wasi-libc"
command: make wasi-libc CLANG=$PWD/llvm-build/bin/clang LLVM_AR=$PWD/llvm-build/bin/llvm-ar LLVM_NM=$PWD/llvm-build/bin/llvm-nm command: make wasi-libc
- save_cache: - save_cache:
key: wasi-libc-sysroot-v0 key: wasi-libc-sysroot-v1
paths: paths:
- lib/wasi-libc/sysroot - lib/wasi-libc/sysroot
test-linux: test-linux:
@ -266,12 +266,12 @@ commands:
llvm-build llvm-build
- restore_cache: - restore_cache:
keys: keys:
- wasi-libc-sysroot-macos-v0 - wasi-libc-sysroot-macos-v1
- run: - run:
name: "Build wasi-libc" name: "Build wasi-libc"
command: make wasi-libc CLANG=$PWD/llvm-build/bin/clang LLVM_AR=$PWD/llvm-build/bin/llvm-ar LLVM_NM=$PWD/llvm-build/bin/llvm-nm command: make wasi-libc
- save_cache: - save_cache:
key: wasi-libc-sysroot-macos-v0 key: wasi-libc-sysroot-macos-v1
paths: paths:
- lib/wasi-libc/sysroot - lib/wasi-libc/sysroot
- run: - run:

Просмотреть файл

@ -7,26 +7,26 @@ LLVM_BUILDDIR ?= llvm-build
CLANG_SRC ?= llvm-project/clang CLANG_SRC ?= llvm-project/clang
LLD_SRC ?= llvm-project/lld LLD_SRC ?= llvm-project/lld
# Default tool selection. # Try to autodetect LLVM build tools.
ifneq (, $(shell command -v llvm-build/bin/clang 2> /dev/null))
CLANG ?= $(abspath llvm-build/bin/clang)
else
CLANG ?= clang-9 CLANG ?= clang-9
endif
# Try to autodetect llvm-ar and llvm-nm ifneq (, $(shell command -v llvm-build/bin/llvm-ar 2> /dev/null))
ifneq (, $(shell command -v llvm-ar-9 2> /dev/null)) LLVM_AR ?= $(abspath llvm-build/bin/llvm-ar)
else ifneq (, $(shell command -v llvm-ar-9 2> /dev/null))
LLVM_AR ?= llvm-ar-9 LLVM_AR ?= llvm-ar-9
else ifneq (, $(shell command -v llvm-ar 2> /dev/null)) else
LLVM_AR ?= llvm-ar LLVM_AR ?= llvm-ar
endif endif
ifneq (, $(shell command -v llvm-nm-9 2> /dev/null)) ifneq (, $(shell command -v llvm-build/bin/llvm-nm 2> /dev/null))
LLVM_NM ?= $(abspath llvm-build/bin/llvm-nm)
else ifneq (, $(shell command -v llvm-nm-9 2> /dev/null))
LLVM_NM ?= llvm-nm-9 LLVM_NM ?= llvm-nm-9
else ifneq (, $(shell command -v llvm-nm 2> /dev/null)) else
LLVM_NM ?= llvm-nm LLVM_NM ?= llvm-nm
endif endif
ifndef LLVM_AR
$(warning llvm-ar not found)
endif
ifndef LLVM_NM
$(warning llvm-nm not found)
endif
# Go binary and GOROOT to select # Go binary and GOROOT to select
GO ?= go GO ?= go

Просмотреть файл

@ -48,13 +48,13 @@ jobs:
- task: CacheBeta@0 - task: CacheBeta@0
displayName: Cache wasi-libc sysroot displayName: Cache wasi-libc sysroot
inputs: inputs:
key: wasi-libc-sysroot-v0 key: wasi-libc-sysroot-v1
path: lib/wasi-libc/sysroot path: lib/wasi-libc/sysroot
- task: Bash@3 - task: Bash@3
displayName: Build wasi-libc displayName: Build wasi-libc
inputs: inputs:
targetType: inline targetType: inline
script: PATH=/usr/bin:$PATH make wasi-libc CLANG=$PWD/llvm-build/bin/clang LLVM_AR=$PWD/llvm-build/bin/llvm-ar LLVM_NM=$PWD/llvm-build/bin/llvm-nm script: PATH=/usr/bin:$PATH make wasi-libc
- task: Bash@3 - task: Bash@3
displayName: Test TinyGo displayName: Test TinyGo
inputs: inputs: