mirror of
https://github.com/drone/drone-cli.git
synced 2024-09-22 20:01:45 +02:00
Improve makefile
It can now build both x-releases and for local os/arch.
This commit is contained in:
parent
c6e1a18c79
commit
92ad87af7c
45
Makefile
45
Makefile
@ -1,19 +1,40 @@
|
||||
BIN := bin
|
||||
DIST := dist
|
||||
|
||||
SRC = $(wildcard drone/*.go)
|
||||
RELEASES = $(DIST)/drone_linux_amd64.tar.gz \
|
||||
$(DIST)/drone_linux_386.tar.gz \
|
||||
$(DIST)/drone_linux_arm.tar.gz \
|
||||
$(DIST)/drone_darwin_amd64.tar.gz \
|
||||
$(DIST)/drone_windows_386.tar.gz \
|
||||
$(DIST)/drone_windows_amd64.tar.gz
|
||||
|
||||
GO = GO15VENDOREXPERIMENT=1 go
|
||||
|
||||
install: $(BIN)/drone
|
||||
cp $< $(GOPATH)/bin/
|
||||
|
||||
release: $(RELEASES)
|
||||
|
||||
deps:
|
||||
cd drone
|
||||
go get -u ./...
|
||||
|
||||
build:
|
||||
cd drone
|
||||
go install ./...
|
||||
go get -u ./drone/...
|
||||
|
||||
test:
|
||||
cd drone
|
||||
go test ./...
|
||||
$(GO) test ./drone/...
|
||||
|
||||
clean:
|
||||
rm -rf bin dist
|
||||
rm -rf $(BIN) $(DIST)
|
||||
|
||||
dist:
|
||||
mkdir -p bin dist
|
||||
echo dist
|
||||
$(BIN)/drone: $(SRC)
|
||||
$(GO) build -o $@ $(SRC)
|
||||
|
||||
.PRECIOUS: $(BIN)/%/drone
|
||||
$(BIN)/%/drone: GOOS=$(firstword $(subst _, ,$*))
|
||||
$(BIN)/%/drone: GOARCH=$(subst .exe,,$(word 2,$(subst _, ,$*)))
|
||||
$(BIN)/%/drone: $(SRC)
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GO) build -o $@ $(SRC)
|
||||
|
||||
$(DIST)/drone_%.tar.gz: $(BIN)/%/drone
|
||||
mkdir -p $(DIST)
|
||||
tar -cvzf $@ --directory=$(BIN)/$* drone
|
||||
sha256sum $@ > $(DIST)/drone_$*.sha256
|
||||
|
Loading…
Reference in New Issue
Block a user