-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathMakefile
More file actions
144 lines (110 loc) · 2.66 KB
/
Copy pathMakefile
File metadata and controls
144 lines (110 loc) · 2.66 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
default: build
PACKAGES := node_modules/.build
BUILD := build.json
ifeq ($(OS),Windows_NT)
WINBLOWS := true
else
T := $(shell uname -s)
ifeq ($(T),Linux)
LINUX := true
endif
ifeq ($(UNAME_S),Darwin)
MAC := true
endif
endif
MODS := $(CURDIR)/node_modules
NPATH := $(MODS)/.bin
NODE := ELECTRON_RUN_AS_NODE=1 $(NPATH)/electron
TOOLPATH := $(CURDIR)/tools/bin
ifndef WINBLOWS
PAGES_SRC := $(shell find pages -type f)
endif
$(PACKAGES): package.json
npm clean-install
echo "" > $@
$(BUILD): $(PAGES_SRC) $(PACKAGES) sass deps Makefile .git/index test
$(NODE) tools/bin/buildenv $@
build: $(BUILD)
run: $(BUILD)
npm start
run-debug: $(BUILD)
npm run start-debug
run-debug-brk: $(BUILD)
npm run start-debug-brk
fix-windows-integrity:
rm -rf dist/.cache # asar/fuses corrupt without this
ifdef WINBLOWS
MAYBE_FIX_WINDOWS_INTEGRITY := fix-windows-integrity
endif
unpacked: $(BUILD) $(MAYBE_FIX_WINDOWS_INTEGRITY)
ifndef WINBLOWS
SKIP_NOTARIZE=1 npm run unpacked
else
npm run unpacked
endif
packed: $(BUILD) $(MAYBE_FIX_WINDOWS_INTEGRITY)
ifndef WINBLOWS
SKIP_NOTARIZE=1 npm run build
else
npm run build
endif
publish: $(BUILD) $(MAYBE_FIX_WINDOWS_INTEGRITY)
ifdef LINUX
ifneq ($(LINUX_SAFE_PUBLISH),true)
@echo
@echo Use publish-docker-linux-native for linux to avoid libc issues
exit 1
endif
endif
GH_TOKEN="$${GH_TOKEN_SAUCE4ZWIFT_RELEASE}" npm run publish
publish-docker-linux-native:
docker build --build-arg arch=amd64 -t linux-s4z-build -f ./build/linux.Dockerfile .
docker run -it --rm -v $$HOME/.git-credentials:/root/.git-credentials \
-e GH_TOKEN_SAUCE4ZWIFT_RELEASE -e LINUX_SAFE_PUBLISH=true \
-v $(CURDIR)/dist/docker-dist:/sauce4zwift/dist linux-s4z-build make publish
deps:
$(MAKE) -j 32 -C pages/deps
$(MAKE) -j 32 -C shared/deps
sass:
$(NPATH)/sass pages/scss:pages/css
sass-watch:
$(NPATH)/sass pages/scss:pages/css --watch
lint:
$(NPATH)/eslint src shared pages/src
lint-watch:
ifndef WINBLOWS
ifdef LINUX
tools/bin/lintwatch
else
while true ; do \
$(MAKE) lint; \
sleep 5; \
done
endif
else
@echo Unsupported on winblows
endif
realclean: clean
rm -rf node_modules
clean:
rm -f $(BUILD)
rm -rf pages/css
ifdef WINBLOWS
rm -rf dist/.cache dist/win-unpacked
endif
ifdef LINUX
rm -rf dist/linux-unpacked
sudo rm -rf dist/docker-dist/linux-unpacked
endif
ifdef MAC
rm -rf dist/mac-universal dist/mac-arm64
endif
$(MAKE) -C shared/deps clean
$(MAKE) -C pages/deps clean
test:
$(NODE) --test
test-debug:
$(NODE) --test --experimental-test-isolation=none --inspect-brk
test-watch:
$(NODE) --test --watch
.PHONY: build packed unpacked publish lint sass deps clean realclean test fix-windows-integrity