-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (53 loc) · 1.56 KB
/
Makefile
File metadata and controls
74 lines (53 loc) · 1.56 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
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
SERVICE := noah
all: help
help: ## Show help messages
@echo "Container - ${SERVICE} "
@echo
@echo "Usage:\tmake COMMAND"
@echo
@echo "Commands:"
@sed -n '/##/s/\(.*\):.*##/ \1#/p' ${MAKEFILE_LIST} | grep -v "MAKEFILE_LIST" | column -t -c 2 -s '#'
APP = noah
BINARY := $(shell basename "$(PWD)")
VERSION := $(shell git describe --tags --dirty --always)
BUILD := $(shell git rev-parse HEAD)
LDFLAGS=-ldflags
LDFLAGS += "-X=github.com/airdb/adb/internal/adblib.Version=$(VERSION) \
-X=github.com/airdb/adb/internal/adblib.Build=$(BUILD) \
-X=github.com/airdb/adb/internal/adblib.BuildTime=$(shell date +%s)"
SYSTEM:=
#myos = $(word 1, $@)
#ifndef $myos
# myos = "$(shell uname | tr A-Z a-z)"
#endif
.PHONY: test
#all: build
test:
go test -v ./...
dev:
#CGO_ENABLED=0 $(SYSTEM) GOARCH=amd64 go run $(LDFLAGS) main.go
CGO_ENABLED=0 $(SYSTEM) go build $(LDFLAGS) main.go
build: ## Build binary
bash ./build/util.sh until::build
lint:
go fmt ./...
golangci-lint run
install: ## Install adb
cp output/adb $(shell which adb)
preinstall:
go install -ldflags -X=github.com/airdb/adb/internal/adblib.BuildTime=$(date +%s) github.com/airdb/adb@dev
deploy:
flyctl deploy -a ${APP}
conf secret:
flyctl secrets import -a ${APP} < .env
bash:
flyctl ssh console -a ${APP} -C /bin/bash
PLATFORMS := windows linux darwin
os = $(word 1, $@)
.PHONY: $(PLATFORMS)
$(PLATFORMS):
mkdir -p release
CGO_ENABLED=0 GOOS=$(os) GOARCH=amd64 go build $(LDFLAGS) -o release/$(BINARY)-$(os)
#release: windows linux darwin
release: linux darwin
.PHONY: release build