-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
112 lines (82 loc) · 3.24 KB
/
Makefile
File metadata and controls
112 lines (82 loc) · 3.24 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
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
### Release configuration #################################
# Path to folder in S3 (without slash at end)
BUCKET = s3://dist.dividat.ch/releases/driver2
# where the BUCKET folder is accessible for getting updates (needs to end with a slash)
RELEASE_URL = https://dist.dividat.com/releases/driver2/
### Basic setup ###########################################
# Set GOPATH to repository path
CWD = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
GOPATH ?= $(CWD)
# Main source to build
SRC = ./src/dividat-driver/main.go
# Default location where built binary will be placed
OUT ?= bin/dividat-driver
# Only channel is main now
CHANNEL := main
VERSION ?= $(shell git describe --always HEAD)
CHECKSUM_SIGNING_CERT ?= ./keys/checksumsign.private.pem
### Simple debug build ####################################
.PHONY: build
build:
@./build.sh -i $(SRC) -o $(OUT) -v $(VERSION) -t debug
### Test suite ############################################
.PHONY: test
test: build
npm install
npm test
### Formatting ############################################
.PHONY: format
format:
gofmt -w src/
### Helper to quickly run the driver
.PHONY: run
run: build
$(OUT)
### Helper to start the recorder
.PHONY: record
record:
@go run src/dividat-driver/recorder/main.go ws://localhost:8382/senso
### Helper to start the recorder for Flex
.PHONY: record-flex
record-flex:
@go run src/dividat-driver/recorder/main.go ws://localhost:8382/flex
### Cross compilation #####################################
LINUX_BIN = bin/dividat-driver-linux-amd64
.PHONY: $(LINUX_BIN)
$(LINUX_BIN):
nix develop '.#crossBuild.x86_64-linux' --command bash -c "VERBOSE=1 ./build.sh -i $(SRC) -o $(LINUX_BIN) -v $(VERSION) "
WINDOWS_BIN = bin/dividat-driver-windows-amd64.exe
.PHONY: $(WINDOWS_BIN)
$(WINDOWS_BIN):
nix develop '.#crossBuild.x86_64-windows' --command bash -c "VERBOSE=1 ./build.sh -i $(SRC) -o $(WINDOWS_BIN) -v $(VERSION)"
crossbuild: $(LINUX_BIN) $(WINDOWS_BIN)
### macOS cross-compilation and app bundle #############
MACOS_ARM_BIN = bin/dividat-driver-darwin-arm64
.PHONY: $(MACOS_ARM_BIN)
$(MACOS_ARM_BIN):
nix develop '.#crossBuild.darwin.aarch64' --command bash -c "VERBOSE=1 ./build.sh -i $(SRC) -o $@ -v $(VERSION)"
MACOS_X86_BIN = bin/dividat-driver-darwin-amd64
.PHONY: $(MACOS_X86_BIN)
$(MACOS_X86_BIN):
nix develop '.#crossBuild.darwin.x86_64' --command bash -c "VERBOSE=1 ./build.sh -i $(SRC) -o $@ -v $(VERSION)"
MACOS_ARM_APP_BUNDLE = bin/DividatDriver-arm64.app
MACOS_ARM_APP_BUNDLE_ZIP = $(MACOS_ARM_APP_BUNDLE).zip
MACOS_X86_APP_BUNDLE = bin/DividatDriver-amd64.app
MACOS_X86_APP_BUNDLE_ZIP = $(MACOS_X86_APP_BUNDLE).zip
bin/DividatDriver-%.app: bin/dividat-driver-darwin-% macos/Info.plist macos/launcher
mkdir -p $@/Contents/MacOS
cp $< $@/Contents/MacOS/driver
chmod +x $@/Contents/MacOS/driver
cp macos/Info.plist $@/Contents/Info.plist
cp macos/launcher $@/Contents/MacOS/launcher
chmod +x $@/Contents/MacOS/launcher
sudo codesign --deep --force --sign "-" $@
bin/DividatDriver-%.app.zip: bin/DividatDriver-%.app
zip -r -y $@ $<
.PHONY: crossbuild_mac
crossbuild_mac: $(MACOS_X86_BIN) $(MACOS_ARM_BIN)
.PHONY: crossbuild_mac_bundles
crossbuild_mac_bundles: $(MACOS_X86_APP_BUNDLE_ZIP) $(MACOS_ARM_APP_BUNDLE_ZIP)
clean:
rm -rf bin/
go clean src/dividat-driver/main.go