forked from application-research/filclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (58 loc) · 1.65 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
71
72
73
74
75
76
77
78
79
80
SHELL=/usr/bin/env bash
GO_BUILD_IMAGE?=golang:1.16
COMMIT := $(shell git rev-parse --short=8 HEAD)
# GITVERSION is the nearest tag plus number of commits and short form of most recent commit since the tag, if any
GITVERSION=$(shell git describe --always --tag --dirty)
unexport GOFLAGS
CLEAN:=
BINS:=
GOFLAGS:=
.PHONY: all
all: build
## FFI
FFI_PATH:=extern/filecoin-ffi/
FFI_DEPS:=.install-filcrypto
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
$(FFI_DEPS): build/.filecoin-install ;
build/.filecoin-install: $(FFI_PATH)
@mkdir -p build
$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
@touch $@
MODULES+=$(FFI_PATH)
BUILD_DEPS+=build/.filecoin-install
CLEAN+=build/.filecoin-install
ffi-version-check:
@[[ "$$(awk '/const Version/{print $$5}' extern/filecoin-ffi/version.go)" -eq 3 ]] || (echo "FFI version mismatch, update submodules"; exit 1)
BUILD_DEPS+=ffi-version-check
.PHONY: ffi-version-check
$(MODULES): build/.update-modules ;
# dummy file that marks the last time modules were updated
build/.update-modules:
git submodule update --init --recursive
@mkdir -p build
touch $@
CLEAN+=build/.update-modules
# Once filclient has it's own version cmd add this back in
#ldflags=-X=github.com/application-research/filclient/version.GitVersion=$(GITVERSION)
#ifneq ($(strip $(LDFLAGS)),)
# ldflags+=-extldflags=$(LDFLAGS)
#endif
#GOFLAGS+=-ldflags="$(ldflags)"
.PHONY: build
build: deps filclient
.PHONY: deps
deps: $(BUILD_DEPS)
.PHONY: filclient
filclient:
go build
.PHONY: filc
filc: filclient
make -C filc
.PHONY: clean
clean:
rm -rf $(CLEAN) $(BINS)
make -C filc clean
.PHONY: dist-clean
dist-clean:
git clean -xdff
git submodule deinit --all -f