forked from mariusor/brutalinks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (34 loc) · 941 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
35
36
37
38
39
40
41
42
43
44
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=amd64
export VERSION=(unknown)
GO := go
ENV ?= dev
LDFLAGS ?= -X main.version=$(VERSION)
BUILDFLAGS ?= -a -ldflags '$(LDFLAGS)'
APPSOURCES := $(wildcard ./activitypub/*.go ./app/*.go ./app/*/*.go internal/*/*.go) main.go
ifneq ($(ENV), dev)
LDFLAGS += -s -w -extldflags "-static"
endif
ifeq ($(shell git describe --always > /dev/null 2>&1 ; echo $$?), 0)
export VERSION = $(shell git describe --always --dirty=-git)
endif
ifeq ($(shell git describe --tags > /dev/null 2>&1 ; echo $$?), 0)
export VERSION = $(shell git describe --tags)
endif
BUILD := $(GO) build $(BUILDFLAGS)
TEST := $(GO) test $(BUILDFLAGS)
.PHONY: all run clean images test
all: app
app: bin/app
bin/app: go.mod main.go $(APPSOURCES)
$(BUILD) -tags $(ENV) -o $@ ./main.go
run: app
@./bin/app
clean:
-$(RM) bin/*
$(MAKE) -C docker $@
images:
$(MAKE) -C docker $@
test: app
$(TEST) ./{app,internal}/...