A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10LANGS := $(call preprocess, $(APPSDIR)/lang/SOURCES)
11LANGOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.lng)
12VOICEOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.vstrings)
13LANG_O = $(BUILDDIR)/lang/lang_core.o
14ENGLISH := english
15
16CLEANOBJS += $(BUILDDIR)/lang/max_language_size.h $(BUILDDIR)/lang/lang*
17
18# $(BUILDDIR)/apps/lang must exist before we create dependencies on it,
19# otherwise make will simply ignore those dependencies.
20# Therefore we create it here.
21#DUMMY := $(shell mkdir -p $(BUILDDIR)/apps/lang)
22
23# Calculate the maximum language size. Currently based on the file size
24# of the largest lng file. Subtract 10 due to HEADER_SIZE and
25# SUBHEADER_SIZE.
26# TODO: In the future generate this file within genlang or another script
27# in order to only calculate the maximum size based on the core strings.
28$(BUILDDIR)/lang/max_language_size.h: $(LANGOBJ) $(BUILDDIR)/apps/lang/voicestrings.zip
29 $(call PRINTS,GEN $(subst $(BUILDDIR)/,,$@))
30 $(SILENT)echo "#define MAX_LANGUAGE_SIZE `ls -ln $(BUILDDIR)/apps/lang/*.lng | awk '{print $$5-10}' | sort -n | tail -1`" > $@
31
32$(BUILDDIR)/lang/lang_core.o: $(BUILDDIR)/lang/lang.h $(BUILDDIR)/lang/lang_core.c
33 $(call PRINTS,CC lang_core.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang/lang_core.c -o $@
34
35# genlang creates *both* lang.c and lang.h but in Make there is no wat to express this rule
36# (multiple target rules DO NOT express that, they are a simple shortcut for multiple rules)
37# instead we pretend that genlang create lang_core.c and that lang.c depends from lang.h
38# it will work fine as long as one never manually removes lang.c and not lang.h, and it will avoid
39# race conditions such as running genlang twice or worse in parallel with other things!
40$(BUILDDIR)/lang/lang.h: $(APPSDIR)/lang/$(ENGLISH).lang $(BUILDDIR)/apps/genlang-features $(TOOLSDIR)/genlang
41 $(call PRINTS,GEN lang.h)
42 $(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/$(ENGLISH).lang -p=$(BUILDDIR)/lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` $<
43$(BUILDDIR)/lang/lang_core.c: $(BUILDDIR)/lang/lang.h $(TOOLSDIR)/genlang
44
45$(BUILDDIR)/lang_enum.h: $(BUILDDIR)/lang/lang.h $(TOOLSDIR)/genlang
46
47# NOTE: for some weird reasons in GNU make, multi targets rules WITH patterns actually express
48# the fact that the two files are created as the result of one invocation of the rule
49$(BUILDDIR)/%.lng $(BUILDDIR)/%.vstrings: $(ROOTDIR)/%.lang $(APPSDIR)/lang/$(ENGLISH).lang $(BUILDDIR)/apps/genlang-features $(TOOLSDIR)/genlang $(TOOLSDIR)/updatelang
50 $(call PRINTS,GENLANG $(subst $(ROOTDIR)/,,$<))
51 $(SILENT)mkdir -p $(dir $@)
52 $(SILENT)$(TOOLSDIR)/updatelang $(APPSDIR)/lang/$(ENGLISH).lang $< $@.tmp
53 $(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/$(ENGLISH).lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` -i=$(TARGET_ID) -b=$*.lng -c=$*.vstrings $@.tmp
54 $(SILENT)rm -f $@.tmp
55
56$(BUILDDIR)/apps/lang/voice-corrections.txt: $(ROOTDIR)/tools/voice-corrections.txt
57 $(SILENT)mkdir -p $(dir $@)
58 $(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $@
59
60$(BUILDDIR)/apps/lang/voicestrings.zip: $(VOICEOBJ) $(wildcard $(BUILDDIR)/apps/lang/*.talk) $(BUILDDIR)/apps/lang/voice-corrections.txt
61 $(call PRINTS,ZIP $(subst $(BUILDDIR)/,,$@))
62 $(SILENT)zip -9 -q $@ $(subst $(BUILDDIR)/,,$^)
63
64#copy any included talk files to the /lang directory
65$(BUILDDIR)/apps/lang/%.talk: $(ROOTDIR)/apps/lang/%.talk
66 $(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/lang