forked from mergestat/mergestat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (51 loc) · 2.12 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
61
62
63
64
65
66
67
68
69
70
TAGS = "static,system_libgit2"
.PHONY: all vendor test vet lint lint-ci update ui-dev dev docker-build docker-build-worker docker-build-ui docker-build-graphql docker-down docker-clean
all: clean worker
# pass these flags to linker to suppress missing symbol errors in intermediate artifacts
export CGO_CFLAGS = -DUSE_LIBSQLITE3
export CPATH = ${PWD}/pkg/sqlite
export CGO_LDFLAGS = -Wl,--unresolved-symbols=ignore-in-object-files
ifeq ($(shell uname -s),Darwin)
export CGO_LDFLAGS = -Wl,-undefined,dynamic_lookup
endif
clean:
-rm -f worker
worker:
go build -v -tags=$(TAGS) -o .build/$@ cmd/$@/*.go
test:
go test -v -tags=$(TAGS) ./...
vet:
go vet -v -tags=$(TAGS) ./...
lint:
golangci-lint run --build-tags $(TAGS)
lint-ci:
./bin/golangci-lint run --build-tags $(TAGS) --out-format github-actions --timeout 5m
update:
go get -u -tags=$(TAGS) ./...
# target to download latest sqlite3 amalgamation code
pkg/sqlite/sqlite3.c:
$(call log, $(CYAN), "downloading sqlite3 amalgamation source v3.37.0")
$(eval SQLITE_DOWNLOAD_DIR = $(shell mktemp -d))
@curl -sSLo $(SQLITE_DOWNLOAD_DIR)/sqlite3.zip https://www.sqlite.org/2021/sqlite-amalgamation-3370000.zip
$(call log, $(GREEN), "downloaded sqlite3 amalgamation source v3.37.0")
$(call log, $(CYAN), "unzipping to $(SQLITE_DOWNLOAD_DIR)")
@(cd $(SQLITE_DOWNLOAD_DIR) && unzip sqlite3.zip > /dev/null)
@-rm $(SQLITE_DOWNLOAD_DIR)/sqlite-amalgamation-3370000/shell.c
$(call log, $(CYAN), "moving to pkg/sqlite")
@mv $(SQLITE_DOWNLOAD_DIR)/sqlite-amalgamation-3370000/* pkg/sqlite
ui-dev:
docker-compose -f docker-compose.yaml -f docker-compose.ui-dev.yaml up
dev:
docker-compose -f docker-compose.dev.yaml -f docker-compose.yaml up
docker-build:
docker-compose -f docker-compose.dev.yaml -f docker-compose.yaml build
docker-build-worker:
docker-compose -f docker-compose.dev.yaml -f docker-compose.yaml build worker
docker-build-ui:
docker-compose -f docker-compose.dev.yaml -f docker-compose.yaml build ui
docker-build-graphql:
docker-compose -f docker-compose.dev.yaml -f docker-compose.yaml build graphql
docker-down:
docker-compose down
docker-clean:
docker-compose down -v