This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
84 lines (67 loc) · 1.75 KB
/
Makefile
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Go parameters
GOCMD=go
NPMCMD=npm
NPMBUILD=$(NPMCMD) run build
GOBUILD=$(GOCMD) build
GOFMT=gofmt
BINARY_NAME=gddu
BINARY_UNIX=$(BINARY_NAME)_unix
BINARY_WINDOWS=gddu.exe
GORELEASER=goreleaser release --rm-dist
NEXT_DOCKER_TAG=stevenweathers/google-domains-ddns-updater:next
LATEST_DOCKER_TAG=stevenweathers/google-domains-ddns-updater:latest
VERSION_TAG := $(shell git tag --sort=-version:refname | head -n 1)
GOBUILDTAG=-ldflags "-X main.version=$(VERSION_TAG)"
DOCKER_BUILD_VERSION=--build-arg BUILD_VERSION=${VERSION_TAG}
all: build
build-deps:
$(NPMBUILD)
build:
$(NPMBUILD)
$(GOBUILD) -o $(BINARY_NAME) -v
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
rm -f $(BINARY_WINDOWS)
rm -f *-packr.go
rm -rf dist
rm -rf release
rm -rf pkged*.go
format:
$(GOFMT) -s -w datasrc.go
$(GOFMT) -s -w handlers.go
$(GOFMT) -s -w client.go
$(GOFMT) -s -w hub.go
$(GOFMT) -s -w main.go
$(GOFMT) -s -w utils.go
# Cross compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
build-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(BINARY_WINDOWS) -v
dev:
$(NPMBUILD)
$(GOBUILD) -o $(BINARY_NAME) -v
./$(BINARY_NAME)
dev-go:
$(GOBUILD) -o $(BINARY_NAME) -v
./$(BINARY_NAME)
run:
./$(BINARY_NAME)
gorelease:
$(GORELEASER)
gorelease-dev-dry:
$(GORELEASER) --skip-publish --skip-validate
gorelease-dry:
$(GORELEASER) --skip-publish
gorelease-snapshot:
$(GORELEASER) --snapshot
build-next-image:
docker build ./ -f ./build/Dockerfile -t $(NEXT_DOCKER_TAG) ${DOCKER_BUILD_VERSION}
push-next-image:
docker push $(NEXT_DOCKER_TAG)
build-latest-image:
docker build ./ -f ./build/Dockerfile -t $(LATEST_DOCKER_TAG) ${DOCKER_BUILD_VERSION}
push-latest-image:
docker push $(LATEST_DOCKER_TAG)