-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (29 loc) · 1004 Bytes
/
Makefile
File metadata and controls
35 lines (29 loc) · 1004 Bytes
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
OSNAME=$(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(shell uname -m)
VSSOS=$(OSNAME)
VSS_VERSION=v0.1.1-alpha.19
DBNAME?=db.sqlite
ifeq ($(OSNAME),darwin)
VSSOS=macos
ifeq ($(ARCH),arm64)
ARCH=aarch64
CGO_LDFLAGS=-L$(HOMEBREW_PREFIX)/opt/libomp/lib -L./extensions -Wl,-undefined,dynamic_lookup -lomp
else
CGO_LDFLAGS=-L./extensions -Wl,-undefined,dynamic_lookup -lomp
endif
else ifeq ($(OSNAME),linux)
CGO_LDFLAGS=-L./extensions -Wl,-undefined,dynamic_lookup -lstdc++
endif
build: extensions
@echo "Building for $(OSNAME) $(ARCH) with CGO_LDFLAGS=$(CGO_LDFLAGS)"
@CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o bin/demo main.go 2> /dev/null
demo: build
@echo "Running demo"
@./bin/demo -db $(DBNAME)
clean:
@echo "Cleaning"
@rm -rf bin
extensions:
@echo "Downloading sqlite-vss $(VSS_VERSION)"
@mkdir -p extensions
@curl -sL "https://github.com/asg017/sqlite-vss/releases/download/$(VSS_VERSION)/sqlite-vss-$(VSS_VERSION)-static-$(VSSOS)-$(ARCH).tar.gz" | tar zx -C extensions