-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (33 loc) · 1.22 KB
/
Makefile
File metadata and controls
45 lines (33 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.PHONY: build ui docs
LOCALS := $(shell find . -type f -name '*.go' -not -path "./vendor*/*")
WEBFRIEND_BIN = webfriend-$(shell go env GOOS)-$(shell go env GOARCH)
BIN_VERSION = $(shell ./bin/$(WEBFRIEND_BIN) --version | cut -d' ' -f3)
CGO_ENABLED ?= 0
.EXPORT_ALL_VARIABLES:
all: fmt deps autodoc build docs
fmt:
gofmt -w .
go vet ./...
go mod tidy
deps:
@go list github.com/pointlander/peg || go get github.com/pointlander/peg
go get ./...
test: fmt deps
go test ./...
autodoc:
go build -o bin/webfriend-autodoc cmd/webfriend-autodoc/*.go
go generate -x ./...
docs: fmt
test -d $(@) || mkdir $(@)
cd $(@) && make
$(WEBFRIEND_BIN):
go build -tags nocgo --ldflags '-extldflags "-static"' -ldflags '-s' -o bin/$(WEBFRIEND_BIN) cmd/webfriend/*.go
GOARCH=amd64 go build -tags nocgo --ldflags '-extldflags "-static"' -ldflags '-s' -o bin/webfriend-$(shell go env GOOS)-amd64 cmd/webfriend/*.go
which webfriend && cp -v bin/$(WEBFRIEND_BIN) `which webfriend` || true
build: $(WEBFRIEND_BIN)
docker:
docker build -t ghetzel/webfriend:$(BIN_VERSION) .
docker-push:
docker tag ghetzel/webfriend:$(BIN_VERSION) ghetzel/webfriend:latest
docker push ghetzel/webfriend:$(BIN_VERSION)
docker push ghetzel/webfriend:latest