-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
49 lines (37 loc) · 1.73 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
REGISTRY ?= quay.io
ORG ?= hegemone
TAG ?= latest
IMAGE ?= $(REGISTRY)/$(ORG)/kore
BUILD_DIR = "${GOPATH}/src/github.com/hegemone/kore/build"
SOURCES := $(shell find . -name '*.go' -not -path "*/vendor/*" -not -path "*/extensions/*")
TEST_SOURCES := $(shell go list ./... | grep -v extension)
PROJECT_ROOT := $(dir $(MAKEFILE_LIST))
.DEFAULT_GOAL := build
vendor:
@dep ensure
plugins: $(PLUGIN_SOURCES)
@go build -buildmode=plugin -o ${BUILD_DIR}/bacon.plugins.kore.nsk.io.so -i -ldflags="-s -w" ./pkg/extension/plugin/bacon.go
go build -buildmode=plugin -o ${BUILD_DIR}/schedule.plugins.kore.300.io.so -i -ldflags="-s -w" ./pkg/extension/plugin/schedule.go
go build -buildmode=plugin -o ${BUILD_DIR}/digitalocean.plugins.kore.300.io.so -i -ldflags="-s -w" ./pkg/extension/plugin/digitalocean.go
adapters: $(ADAPTER_SOURCES)
@go build -buildmode=plugin -o ${BUILD_DIR}/ex-discord.adapters.kore.nsk.io.so -i -ldflags="-s -w" ./pkg/extension/adapter/discord.go
@go build -buildmode=plugin -o ${BUILD_DIR}/ex-irc.adapters.kore.nsk.io.so -i -ldflags="-s -w" ./pkg/extension/adapter/irc.go
kore: $(SOURCES) adapters plugins
@go build -o ${BUILD_DIR}/kore -i -ldflags="-s -w" ./cmd/kore
build: vendor kore
@echo > /dev/null
test:
@go test -v -cover -race ${TEST_SOURCES}
clean:
@rm -rf ${BUILD_DIR}
run: kore
@KORE_PLUGIN_DIR=${PROJECT_ROOT}/build \
KORE_ADAPTER_DIR=${PROJECT_ROOT}/build \
./build/kore
image:
docker build -t ${IMAGE}:${TAG} ${PROJECT_ROOT}
run-image:
docker run -it -e DISCORD_TOKEN=${DISCORD_TOKEN} -e DO_TOKEN=${DO_TOKEN} -v /home/${USER}/go/src/:/auth ${IMAGE}:${TAG}
push:
docker push ${IMAGE}:${TAG}
.PHONY: vendor image push clean run image run-image push