This repository has been archived by the owner on Aug 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
52 lines (42 loc) · 1.53 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
# go option
GO ?= go
PKG := go mod vendor
LDFLAGS := -w -s
GOFLAGS :=
TAGS :=
BINDIR := $(CURDIR)/bin
PKGDIR := github.com/tritonmedia/identifier
CGO_ENABLED := 1
CGO_CFLAGS_ALLOW := -Xpreprocessor
# Required for globs to work correctly
SHELL=/bin/bash
.PHONY: all
all: build
.PHONY: dep
dep:
@echo " ===> Installing dependencies via '$$(awk '{ print $$1 }' <<< "$(PKG)" )' <=== "
@CGO_CFLAGS_ALLOW=$(CGO_CFLAGS_ALLOW) $(PKG)
.PHONY: build
build:
@echo " ===> building releases in ./bin/... <=== "
CGO_CFLAGS_ALLOW=$(CGO_CFLAGS_ALLOW) CGO_ENABLED=$(CGO_ENABLED) $(GO) build -o $(BINDIR)/identifier -v $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' $(PKGDIR)
.PHONY: gofmt
gofmt:
@echo " ===> Running go fmt <==="
gofmt -w ./
# Test publising messages
.PHONY: test-v1.identify-publish
test-v1.identify-publish:
go run ./test/v1.identify-publish.go
.PHONY: test-v1.identify.newfile-publish
test-v1.identify.newfile-publish:
go run ./test/v1.identify.newfile-publish.go
.PHONY: update-schemas
update-schema:
@rm $(CURDIR)/pkg/storageapi/postgres/schema/schema.go || true
go-embed -input $(CURDIR)/pkg/storageapi/postgres/schema -output $(CURDIR)/schema.go
@mv $(CURDIR)/schema.go $(CURDIR)/pkg/storageapi/postgres/schema/schema.go
.PHONY: render-circle
render-circle:
@if [[ ! -e /tmp/jsonnet-libs ]]; then git clone git@github.com:tritonmedia/jsonnet-libs /tmp/jsonnet-libs; else cd /tmp/jsonnet-libs; git pull; fi
JSONNET_PATH=/tmp/jsonnet-libs jsonnet .circleci/circle.jsonnet | yq . -y > .circleci/config.yml