-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (47 loc) · 1.42 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
GO ?= go
PODMAN ?= podman
GITHASH := $(shell git rev-parse --short HEAD)
BUILDTIME := $(shell date -u '+%Y%m%dT%H%M%SZ')
GOLDFLAGS += -X "github.com/JVMerkle/gemportal/app.gitHash=$(GITHASH)"
GOLDFLAGS += -X "github.com/JVMerkle/gemportal/app.buildTime=$(BUILDTIME)"
GOLDFLAGS += -w -s
GOFLAGS += -ldflags "$(GOLDFLAGS)"
.PHONY: help run build get-deps vet fmt pull-request podman-build podman-run clean
help:
@echo "Makefile for gemportal"
@echo ""
@echo "Usage:"
@echo ""
@echo " make <commands>"
@echo ""
@echo "Pass PODMAN=docker to use docker for building."
@echo ""
@echo "The commands are:"
@echo ""
@echo " build Build the package"
@echo " clean Run go clean"
@echo " podman-build Build the gemportal image"
@echo " podman-run Run a gemportal container on port 8080"
@echo " fmt Run go fmt"
@echo " get-deps Download the dependencies"
@echo " help Print this help text"
@echo " pull-request Check if you changes are ready to be submitted"
@echo " vet Run go vet"
run: build
./gemportal
build:
$(GO) build -o gemportal $(GOFLAGS) .
get-deps:
$(GO) mod download
vet:
$(GO) vet ./...
fmt:
$(GO) fmt ./...
pull-request: build fmt vet
@echo "Your code looks good!"
podman-build:
$(PODMAN) build -t gemportal .
podman-run: podman-build
$(PODMAN) run --rm -it -p8080:8080 gemportal
clean:
@$(GO) clean