Makefile: build static binaries only
This replaces the older way which just does the following: go install . and go test -v . Instead, `make` and `make test` will now build TinyGo statically linked against LLVM, so that `go install` and `go test -v` should be used manually.
Этот коммит содержится в:
родитель
2a0a7722f9
коммит
6c63a0d6e7
3 изменённых файлов: 7 добавлений и 14 удалений
|
@ -87,7 +87,7 @@ commands:
|
||||||
- go-cache-{{ checksum "Gopkg.lock" }}
|
- go-cache-{{ checksum "Gopkg.lock" }}
|
||||||
- dep
|
- dep
|
||||||
- run: go install .
|
- run: go install .
|
||||||
- run: make test
|
- run: go test -v
|
||||||
- run: make gen-device -j4
|
- run: make gen-device -j4
|
||||||
- smoketest
|
- smoketest
|
||||||
- save_cache:
|
- save_cache:
|
||||||
|
@ -162,7 +162,7 @@ commands:
|
||||||
- dep
|
- dep
|
||||||
- run:
|
- run:
|
||||||
name: "Test TinyGo"
|
name: "Test TinyGo"
|
||||||
command: make static-test
|
command: make test
|
||||||
- run:
|
- run:
|
||||||
name: "Build TinyGo release"
|
name: "Build TinyGo release"
|
||||||
command: |
|
command: |
|
||||||
|
@ -227,7 +227,7 @@ commands:
|
||||||
command: dep ensure --vendor-only
|
command: dep ensure --vendor-only
|
||||||
- run:
|
- run:
|
||||||
name: "Test TinyGo"
|
name: "Test TinyGo"
|
||||||
command: make static-test
|
command: make test
|
||||||
- run:
|
- run:
|
||||||
name: "Build TinyGo release"
|
name: "Build TinyGo release"
|
||||||
command: |
|
command: |
|
||||||
|
|
|
@ -92,7 +92,7 @@ Now that you have a working version of LLVM, build TinyGo using it. You need to
|
||||||
specify the directories to the LLVM build directory and to the Clang and LLD source.
|
specify the directories to the LLVM build directory and to the Clang and LLD source.
|
||||||
|
|
||||||
cd $HOME/go/src/github.com/tinygo-org/tinygo
|
cd $HOME/go/src/github.com/tinygo-org/tinygo
|
||||||
make static LLVM_BUILDDIR=$HOME/src/llvm-build CLANG_SRC=$HOME/src/llvm/tools/clang LLD_SRC=$HOME/src/llvm/tools/lld
|
make LLVM_BUILDDIR=$HOME/src/llvm-build CLANG_SRC=$HOME/src/llvm/tools/clang LLD_SRC=$HOME/src/llvm/tools/lld
|
||||||
|
|
||||||
## Verify TinyGo
|
## Verify TinyGo
|
||||||
|
|
||||||
|
|
13
Makefile
13
Makefile
|
@ -3,7 +3,7 @@
|
||||||
all: tinygo
|
all: tinygo
|
||||||
tinygo: build/tinygo
|
tinygo: build/tinygo
|
||||||
|
|
||||||
.PHONY: all tinygo llvm-build llvm-source static run-test clean fmt gen-device gen-device-nrf gen-device-avr
|
.PHONY: all tinygo build/tinygo test llvm-build llvm-source clean fmt gen-device gen-device-nrf gen-device-avr
|
||||||
|
|
||||||
# Default build and source directories, as created by `make llvm-build`.
|
# Default build and source directories, as created by `make llvm-build`.
|
||||||
LLVM_BUILDDIR ?= llvm-build
|
LLVM_BUILDDIR ?= llvm-build
|
||||||
|
@ -38,9 +38,6 @@ fmt:
|
||||||
fmt-check:
|
fmt-check:
|
||||||
@unformatted=$$(gofmt -l $(FMT_PATHS)); [ -z "$$unformatted" ] && exit 0; echo "Unformatted:"; for fn in $$unformatted; do echo " $$fn"; done; exit 1
|
@unformatted=$$(gofmt -l $(FMT_PATHS)); [ -z "$$unformatted" ] && exit 0; echo "Unformatted:"; for fn in $$unformatted; do echo " $$fn"; done; exit 1
|
||||||
|
|
||||||
test:
|
|
||||||
@go test -v .
|
|
||||||
|
|
||||||
gen-device: gen-device-avr gen-device-nrf gen-device-sam gen-device-stm32
|
gen-device: gen-device-avr gen-device-nrf gen-device-sam gen-device-stm32
|
||||||
|
|
||||||
gen-device-avr:
|
gen-device-avr:
|
||||||
|
@ -81,17 +78,13 @@ llvm-build: llvm-build/build.ninja
|
||||||
|
|
||||||
# Build the Go compiler.
|
# Build the Go compiler.
|
||||||
build/tinygo:
|
build/tinygo:
|
||||||
@mkdir -p build
|
|
||||||
go build -o build/tinygo .
|
|
||||||
|
|
||||||
static:
|
|
||||||
@if [ ! -f llvm-build/bin/llvm-config ]; then echo "Fetch and build LLVM first by running:\n make llvm-source\n make llvm-build"; exit 1; fi
|
@if [ ! -f llvm-build/bin/llvm-config ]; then echo "Fetch and build LLVM first by running:\n make llvm-source\n make llvm-build"; exit 1; fi
|
||||||
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o build/tinygo -tags byollvm .
|
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o build/tinygo -tags byollvm .
|
||||||
|
|
||||||
static-test:
|
test:
|
||||||
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test -v -tags byollvm .
|
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test -v -tags byollvm .
|
||||||
|
|
||||||
release: static gen-device
|
release: build/tinygo gen-device
|
||||||
@mkdir -p build/release/tinygo/bin
|
@mkdir -p build/release/tinygo/bin
|
||||||
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
|
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
|
||||||
@mkdir -p build/release/tinygo/lib/compiler-rt/lib
|
@mkdir -p build/release/tinygo/lib/compiler-rt/lib
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче