Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
128 lines (116 loc) · 6.36 KB
/
Copy pathMakefile
File metadata and controls
128 lines (116 loc) · 6.36 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
SRCS = src/main.c src/theme.c src/fb.c src/ddr.c src/grid.c src/visualizers.c src/emby.c src/json.c src/session.c src/subtitles.c src/update.c src/input.c src/util.c src/draw.c src/screenshot.c src/sfx.c src/hls.c src/uifont.c
TARGET = misteremby
TARGET_ARM = misteremby-arm
# --abbrev=0 would collapse this to the exact tag name even when the build
# is N commits past it — indistinguishable from an actual release from the
# About screen's point of view. Without it, a build that isn't exactly at a
# tag gets the full "v0.9.6-2-g43bf1da" form instead, which the update
# check (main.c) compares against the latest GitHub release tag byte-for-
# byte — so a dev build correctly shows up as "different from the latest
# release" and offers to install it, rather than silently claiming to BE it.
# --dirty closes the remaining hole: UNCOMMITTED work on top of a tagged
# commit still described as exactly the tag (commit distance counts commits,
# not working-tree changes), so such a build claimed to BE the release and
# the About screen wrongly reported it up to date — confirmed in practice
# the day after v0.9.9 shipped.
VERSION ?= $(shell git describe --tags --dirty 2>/dev/null || echo "dev")
CC = gcc
CFLAGS = -O2 -Wall -Wextra -Isrc -DAPP_VERSION=\"$(VERSION)\"
CC_ARM = zig cc -target arm-linux-gnueabihf.2.31 -mcpu=cortex_a9
CFLAGS_ARM = -O2 -Isrc -DAPP_VERSION=\"$(VERSION)\" -D_FILE_OFFSET_BITS=64
MISTER_HOST ?= mister.local
.PHONY: all arm clean deploy test
all: $(TARGET)
# Unit tests. Host build only; neither of these has anything platform-specific
# in it. The JSON parser sits under every server response the client reads;
# the subtitle clean-up can only otherwise be checked during playback, which
# needs real hardware.
test:
$(CC) $(CFLAGS) -o /tmp/misteremby_test_json tests/test_json.c src/json.c
@/tmp/misteremby_test_json
$(CC) $(CFLAGS) -o /tmp/misteremby_test_subtitles \
tests/test_subtitles.c src/subtitles.c src/emby.c src/json.c
@/tmp/misteremby_test_subtitles
$(CC) $(CFLAGS) -o /tmp/misteremby_test_config \
tests/test_config.c src/emby.c src/json.c
@mkdir -p /tmp/misteremby_test_cfgdir && cd /tmp/misteremby_test_cfgdir && /tmp/misteremby_test_config
$(CC) $(CFLAGS) -o /tmp/misteremby_test_emby_queries \
tests/test_emby_queries.c src/emby.c src/json.c
@/tmp/misteremby_test_emby_queries
$(CC) $(CFLAGS) -o /tmp/misteremby_test_hls tests/test_hls.c src/hls.c src/emby.c src/json.c -lpthread
@/tmp/misteremby_test_hls
$(CC) $(CFLAGS) -o /tmp/misteremby_test_sfx tests/test_sfx.c -lpthread
@/tmp/misteremby_test_sfx
$(CC) $(CFLAGS) -o /tmp/misteremby_test_hero tests/test_hero.c src/draw.c
@/tmp/misteremby_test_hero
$(CC) $(CFLAGS) -o /tmp/misteremby_test_cache_sweep tests/test_cache_sweep.c src/util.c
@/tmp/misteremby_test_cache_sweep
# -lm: stb_image needs pow(), the visualizers need sinf/sincosf. The
# ARM build gets libm folded into libc by zig's target libc, so only the host
# build has to ask for it explicitly.
$(TARGET): $(SRCS)
$(CC) $(CFLAGS) -o $@ $^ -lpthread -lm
arm: $(SRCS)
$(CC_ARM) $(CFLAGS_ARM) -o $(TARGET_ARM) $^ -lpthread -ldl
clean:
rm -f $(TARGET) $(TARGET_ARM)
# Requires mplayer-arm (the fbdev-patched MPlayer committed in the repo root;
# rebuild with tools/build-mplayer.sh) — see README "Building from
# Source".
deploy: arm
sshpass -p "1" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no root@$(MISTER_HOST) \
"mkdir -p /media/fat/misteremby"
sshpass -p "1" scp -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
$(TARGET_ARM) root@$(MISTER_HOST):/media/fat/misteremby/misteremby-arm
@if [ -d assets/font ]; then \
sshpass -p "1" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no root@$(MISTER_HOST) \
"mkdir -p /media/fat/misteremby/font"; \
sshpass -p "1" scp -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
assets/font/font.desc assets/font/font-alpha.raw assets/font/font-bitmap.raw \
root@$(MISTER_HOST):/media/fat/misteremby/font/; \
echo "font deployed"; \
fi
@if [ -d assets/subfont ]; then \
sshpass -p "1" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no root@$(MISTER_HOST) \
"mkdir -p /media/fat/misteremby/subfont"; \
sshpass -p "1" scp -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
assets/subfont/font.desc assets/subfont/font-alpha.raw assets/subfont/font-bitmap.raw \
root@$(MISTER_HOST):/media/fat/misteremby/subfont/; \
echo "subfont deployed"; \
fi
@if [ -d assets/font2x ]; then \
sshpass -p "1" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no root@$(MISTER_HOST) \
"mkdir -p /media/fat/misteremby/font2x"; \
sshpass -p "1" scp -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
assets/font2x/font.desc assets/font2x/font-alpha.raw assets/font2x/font-bitmap.raw \
root@$(MISTER_HOST):/media/fat/misteremby/font2x/; \
echo "font2x deployed"; \
fi
@if [ -d assets/subfont2x ]; then \
sshpass -p "1" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no root@$(MISTER_HOST) \
"mkdir -p /media/fat/misteremby/subfont2x"; \
sshpass -p "1" scp -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
assets/subfont2x/font.desc assets/subfont2x/font-alpha.raw assets/subfont2x/font-bitmap.raw \
root@$(MISTER_HOST):/media/fat/misteremby/subfont2x/; \
echo "subfont2x deployed"; \
fi
@if [ -d assets/sfx ]; then \
sshpass -p "1" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no root@$(MISTER_HOST) \
"mkdir -p /media/fat/misteremby/sfx"; \
sshpass -p "1" scp -r -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
assets/sfx/. root@$(MISTER_HOST):/media/fat/misteremby/sfx/; \
echo "sfx deployed"; \
fi
@if [ -f mplayer-arm ]; then \
sshpass -p "1" scp -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
mplayer-arm root@$(MISTER_HOST):/media/fat/misteremby/mplayer-arm; \
echo "mplayer-arm deployed"; \
else \
echo "WARNING: mplayer-arm not found in project root — rebuild it with tools/build-mplayer.sh (see README)"; \
fi
sshpass -p "1" scp -o StrictHostKeyChecking=no -o PubkeyAuthentication=no \
tools/MiSTerEmby.sh root@$(MISTER_HOST):/media/fat/Scripts/MiSTerEmby.sh
sshpass -p "1" ssh -o StrictHostKeyChecking=no -o PubkeyAuthentication=no root@$(MISTER_HOST) \
"chmod +x /media/fat/Scripts/MiSTerEmby.sh"
@echo "Deployed. Run MiSTerEmby from the Scripts menu."
@echo "Don't forget to create /media/fat/misteremby/emby.conf (see emby.conf.example)."