Browse Source

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.
pull/289/head
Ayke van Laethem 6 years ago
committed by Ron Evans
parent
commit
6c63a0d6e7
  1. 6
      .circleci/config.yml
  2. 2
      BUILDING.md
  3. 13
      Makefile

6
.circleci/config.yml

@ -87,7 +87,7 @@ commands:
- go-cache-{{ checksum "Gopkg.lock" }}
- dep
- run: go install .
- run: make test
- run: go test -v
- run: make gen-device -j4
- smoketest
- save_cache:
@ -162,7 +162,7 @@ commands:
- dep
- run:
name: "Test TinyGo"
command: make static-test
command: make test
- run:
name: "Build TinyGo release"
command: |
@ -227,7 +227,7 @@ commands:
command: dep ensure --vendor-only
- run:
name: "Test TinyGo"
command: make static-test
command: make test
- run:
name: "Build TinyGo release"
command: |

2
BUILDING.md

@ -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.
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

13
Makefile

@ -3,7 +3,7 @@
all: 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`.
LLVM_BUILDDIR ?= llvm-build
@ -38,9 +38,6 @@ fmt:
fmt-check:
@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-avr:
@ -81,17 +78,13 @@ llvm-build: llvm-build/build.ninja
# Build the Go compiler.
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
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 .
release: static gen-device
release: build/tinygo gen-device
@mkdir -p build/release/tinygo/bin
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
@mkdir -p build/release/tinygo/lib/compiler-rt/lib

Loading…
Cancel
Save