This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
87 lines (59 loc) · 2.17 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
85
86
87
# Define lnd version being used on the backend
LND_VERSION = v0.9.0-beta
VERSION = v0.8.1
GO111MODULE = on
PREFIX := CGO_ENABLED=0
BUILD_FLAGS := -ldflags "-s -w -buildid= -X main.gitHash=$$(git rev-parse HEAD)"
GOBUILD := $(PREFIX) go build -v -trimpath -mod=readonly $(BUILD_FLAGS)
SRC := $(shell find . -type f -name '*.go') go.mod go.sum
bin/invoicer: $(SRC)
$(PREFIX) go build -v -o $@
bin/invoicer-race: $(SRC)
go build -v -o $@ -race
bin/darwin/invoicer: $(SRC)
env GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $@
bin/linux-amd64/invoicer: $(SRC)
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $@
bin/linux-arm32v6/invoicer: $(SRC)
env GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o $@
bin/linux-arm32v7/invoicer: $(SRC)
env GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o $@
bin/linux-arm64v8/invoicer: $(SRC)
env GOOS=linux GOARCH=arm64 $(GOBUILD) -o $@
run: $(SRC)
go run main.go -config ./invoicer.conf
clean:
rm -rf bin/*
#
# PROTO stuff
#
ln/lnd:
mkdir -p $@
ln/lnd/google/api:
mkdir -p $@
# Fetch rpc.proto files from https://github.com/lightningnetwork/lnd
ln/lnd/rpc.proto: ln/lnd/%: ln/lnd
wget -qO - https://raw.githubusercontent.com/lightningnetwork/lnd/$(LND_VERSION)/lnrpc/$* | \
sed 's|github.com/lightningnetwork/lnd/lnrpc|lnd|' > $@
# Fetch .proto files that ln/lnd/rpc.proto depends on
# Files fetched from https://github.com/googleapis/googleapis are:
# * google/api/annotations.proto, and
# * google/api/http.proto
$(patsubst %, ln/lnd/google/api/%.proto, annotations http): ln/lnd/%: ln/lnd/google/api
wget -qO $@ https://raw.githubusercontent.com/googleapis/googleapis/master/$*
clean-proto:
rm -rf ln/lnd/
proto: clean-proto ln/lnd/rpc.proto ln/lnd/google/api/annotations.proto ln/lnd/google/api/http.proto
go generate ./ln/...
# Linter install instructions are here:
# https://github.com/golangci/golangci-lint#install
lint:
golangci-lint run ./...
lint-all:
golangci-lint run --enable-all ./...
static/index.html:
mkdir -p static
curl -s https://api.github.com/repos/lncm/donations/releases/latest \
| jq -r '.assets[0].browser_download_url' \
| wget -O $@ -qi -
.PHONY: run clean proto clean-proto lint lint-all static/index.html