-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (35 loc) · 1.58 KB
/
Makefile
File metadata and controls
48 lines (35 loc) · 1.58 KB
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
# Makefile for Logos Storage Go Bindings
LOGOS_STORAGE_NIM_DIR := vendor/logos-storage-nim
LOGOS_STORAGE_NIM_LIB_DIR := $(abspath $(LOGOS_STORAGE_NIM_DIR)/library)
LOGOS_STORAGE_NIM_BUILD_DIR := $(abspath $(LOGOS_STORAGE_NIM_DIR)/build)
CGO_CFLAGS := -I$(LOGOS_STORAGE_NIM_LIB_DIR)
CGO_LDFLAGS := -L$(LOGOS_STORAGE_NIM_BUILD_DIR) -lstorage -Wl,-rpath,$(LOGOS_STORAGE_NIM_BUILD_DIR)
.PHONY: all clean update libstorage build test
all: build
submodules:
@echo "Fetching submodules..."
@git submodule update --init --recursive
update: | submodules
@echo "Updating logos-storage-nim..."
@$(MAKE) -C $(LOGOS_STORAGE_NIM_DIR) update
libstorage:
@echo "Building libstorage..."
@$(MAKE) -C $(LOGOS_STORAGE_NIM_DIR) libstorage
libstorage-with-debug-api:
@echo "Building libstorage..."
@$(MAKE) -C $(LOGOS_STORAGE_NIM_DIR) libstorage STORAGE_LIB_PARAMS="-d:storage_enable_api_debug_peers"
build:
@echo "Building Logos Storage Go Bindings..."
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o storage-go ./storage
test:
@echo "Running tests..."
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOTESTFLAGS="-timeout=2m" gotestsum --packages="./..." -f testname -- $(if $(filter-out test,$(MAKECMDGOALS)),-run "$(filter-out test,$(MAKECMDGOALS))")
test-with-params:
@echo "Running tests..."
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOTESTFLAGS="-timeout=2m" gotestsum --packages="./..." -f testname -- $(ARGS)
%:
@:
clean:
@echo "Cleaning up..."
@git submodule deinit -f $(LOGOS_STORAGE_NIM_DIR)
@rm -f storage-go