Makefile 1.28 KB
Newer Older
1
SHELL=/usr/bin/env bash
2

3
all: build
4
5
.PHONY: all

6
7
# git submodules that need to be loaded
SUBMODULES:=
8

9
10
# things to clean up, e.g. libfilecoin.a
CLEAN:=
11

12
13
14
15
16
17
18
19
20
FFI_PATH:=extern/filecoin-ffi/
FFI_DEPS:=libfilecoin.a filecoin.pc filecoin.h
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))

$(FFI_DEPS): build/.filecoin-ffi-install ;

# dummy file that marks the last time the filecoin-ffi project was built
build/.filecoin-ffi-install: $(FFI_PATH)
	$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
21
22
	@touch $@

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SUBMODULES+=$(FFI_PATH)
BUILD_DEPS+=build/.filecoin-ffi-install
CLEAN+=build/.filecoin-ffi-install

$(SUBMODULES): build/.update-submodules ;

# dummy file that marks the last time submodules were updated
build/.update-submodules:
	git submodule update --init --recursive
	touch $@

CLEAN+=build/.update-submodules

# build and install any upstream dependencies, e.g. filecoin-ffi
deps: $(BUILD_DEPS)
.PHONY: deps

test: $(BUILD_DEPS)
41
	RUST_LOG=info go test -v -timeout 120m ./...
42
43
44
.PHONY: test

lint: $(BUILD_DEPS)
45
	golangci-lint run -v --concurrency 2 --new-from-rev origin/master
46
47
48
49
50
.PHONY: lint

build: $(BUILD_DEPS)
	go build -v $(GOFLAGS) ./...
.PHONY: build
51

52
53
54
55
fetch-params: $(BUILD_DEPS)
	go test -run=^TestDownloadParams
.PHONY: fetch-params

56
clean:
57
58
	rm -rf $(CLEAN)
	-$(MAKE) -C $(FFI_PATH) clean
59
.PHONY: clean