-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
120 lines (96 loc) · 4.86 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
PACKAGE := opensatelliteproject/SatHelperApp
REV_VAR := github.com/opensatelliteproject/SatHelperApp.RevString
VERSION_VAR := github.com/opensatelliteproject/SatHelperApp.VersionString
BUILD_DATE_VAR := github.com/opensatelliteproject/SatHelperApp.CompilationDate
BUILD_TIME_VAR := github.com/opensatelliteproject/SatHelperApp.CompilationTime
REPO_VERSION := $(shell git describe --always --dirty --tags)
REPO_REV := $(shell git rev-parse --sq HEAD)
BUILD_DATE := $(shell date +"%b %d %Y")
BUILD_TIME := $(shell date +"%H:%M:%S")
PATH := $(PATH):/usr/lib/go-1.11/bin
GOBIN := $(shell PATH=$PATH:/usr/lib/go-1.11/bin:/usr/local/Cellar/go/1.11.2/bin command -v go 2> /dev/null)
BASEDIR := $(CURDIR)
GOPATH := $(CURDIR)/.gopath
BASE := $(GOPATH)/src/$(PACKAGE)
DESTDIR?=/usr/local/bin
GOBUILD_VERSION_ARGS := -ldflags "-X $(REV_VAR)=$(REPO_REV) -X $(VERSION_VAR)=$(REPO_VERSION) -X \"$(BUILD_DATE_VAR)=$(BUILD_DATE)\" -X $(BUILD_TIME_VAR)=$(BUILD_TIME)"
INTSIZE := $(shell getconf LONG_BIT)
.PHONY: all build
.NOTPARALLEL: pre deps update
all: | $(BASE) pre deps update build
$(BASE):
@echo Linking virtual GOPATH
@mkdir -p $(dir $@)
@ln -sf $(CURDIR) $@
pre:
@echo Prechecking
ifndef GOBIN
$(error "GO executable not found")
endif
clean:
@echo Cleaning virtual GOPATH
@rm -fr .gopath
deps: | $(BASE)
@echo Downloading dependencies
@cd $(BASE) && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for SatHelperApp
@cd $(BASE)/cmd/SatHelperApp && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for DemuxReplay
@cd $(BASE)/cmd/demuxReplay && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for xritparse
@cd $(BASE)/cmd/xritparse && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for xritcat
@cd $(BASE)/cmd/xritcat && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for xritimg
@cd $(BASE)/cmd/xritimg && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for xritpdcs
@cd $(BASE)/cmd/xritpdcs && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for MultiSegmentDump
@cd $(BASE)/cmd/MultiSegmentDump && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
@echo Deps for rpcClient
@cd $(BASE)/cmd/rpcClient && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) get
do-static: | $(BASE)
@echo "Updating Code to have static libLimeSuite"
@sed -i 's/-lLimeSuite/-l:libLimeSuite.a -l:libstdc++.a -static-libgcc -lm -lusb-1.0/g' $(GOPATH)/pkg/mod/github.com/myriadrf/limedrv*/limewrap/limewrap.go
update: | do-static $(BASE)
@echo Updating AirspyDevice Wrapper
@cd $(BASE) && swig -cgo -go -c++ -intgosize $(INTSIZE) Frontend/AirspyDevice/AirspyDevice.i
@echo Updating RTLSDR Wrappper
@cd $(BASE) && swig -cgo -go -c++ -intgosize $(INTSIZE) Frontend/RTLSDRDevice/RTLSDRDevice.i
build: | $(BASE)
@echo Building SatHelperApp
@cd $(BASE)/cmd/SatHelperApp && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/SatHelperApp
@echo Building DemuxReplay
@cd $(BASE)/cmd/demuxReplay && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/DemuxReplay
@echo Building xritparse
@cd $(BASE)/cmd/xritparse && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/xritparse
@echo Building xritcat
@cd $(BASE)/cmd/xritcat && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/xritcat
@echo Building xritimg
@cd $(BASE)/cmd/xritimg && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/xritimg
@echo Building xritpdcs
@cd $(BASE)/cmd/xritpdcs && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/xritpdcs
@echo Building MultiSegmentDump
@cd $(BASE)/cmd/MultiSegmentDump && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/SatHelperDump
@echo Building rpcClient
@cd $(BASE)/cmd/rpcClient && GO111MODULE=on GOPATH=$(GOPATH) $(GOBIN) build $(GOBUILD_VERSION_ARGS) -o $(BASEDIR)/SatHelperClient
install: | $(BASE)
@echo Installing
@cd $(BASE) && cp $(BASEDIR)/SatHelperApp $(DESTDIR)/SatHelperApp
@chmod +x $(DESTDIR)/SatHelperApp
@cd $(BASE) && cp $(BASEDIR)/DemuxReplay $(DESTDIR)/DemuxReplay
@chmod +x $(DESTDIR)/DemuxReplay
@cd $(BASE) && cp $(BASEDIR)/xritparse $(DESTDIR)/xritparse
@chmod +x $(DESTDIR)/xritparse
@cd $(BASE) && cp $(BASEDIR)/xritcat $(DESTDIR)/xritcat
@chmod +x $(DESTDIR)/xritcat
@cd $(BASE) && cp $(BASEDIR)/xritimg $(DESTDIR)/xritimg
@chmod +x $(DESTDIR)/xritimg
@cd $(BASE) && cp $(BASEDIR)/xritpdcs $(DESTDIR)/xritpdcs
@chmod +x $(DESTDIR)/xritpdcs
@cd $(BASE) && cp $(BASEDIR)/SatHelperDump $(DESTDIR)/SatHelperDump
@chmod +x $(DESTDIR)/SatHelperDump
@cd $(BASE) && cp $(BASEDIR)/SatHelperClient $(DESTDIR)/SatHelperClient
@chmod +x $(DESTDIR)/SatHelperClient
test:
go test -v -race $(shell go list ./... | grep -v /parts/ | grep -v /prime/ | grep -v /snap/ | grep -v /stage/ | grep -v /tmp/ | grep -v /librtlsdr/ )