forked from autobrr/omegabrr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (24 loc) · 842 Bytes
/
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
SERVICE = omegabrr
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null)
GIT_TAG := $(shell git tag --points-at HEAD 2> /dev/null | head -n 1)
GO ?= go
RM ?= rm
GOFLAGS ?= "-X main.commit=$(GIT_COMMIT) -X main.version=$(GIT_TAG)"
PREFIX ?= /usr/local
BINDIR ?= bin
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null)
GIT_TAG := $(shell git tag --points-at HEAD 2> /dev/null | head -n 1)
all: clean build
deps:
go mod download
build: deps
go build -ldflags $(GOFLAGS) -o bin/$(SERVICE) cmd/$(SERVICE)/main.go
build/docker:
docker build -t omegabrr:dev -f Dockerfile . --build-arg GIT_TAG=$(GIT_TAG) --build-arg GIT_COMMIT=$(GIT_COMMIT)
clean:
$(RM) -rf bin
install: all
echo $(DESTDIR)$(PREFIX)/$(BINDIR)
mkdir -p $(DESTDIR)$(PREFIX)/$(BINDIR)
cp -f bin/$(SERVICE) $(DESTDIR)$(PREFIX)/$(BINDIR)
.PHONY: build clean install