2008-11-20 11:27:31 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
2008-11-25 19:54:23 +00:00
|
|
|
# $Id$
|
2008-11-20 11:27:31 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
LANGS := $(call preprocess, $(APPSDIR)/lang/SOURCES)
|
|
|
|
LANGOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.lng)
|
2012-05-19 15:14:35 +00:00
|
|
|
VOICEOBJ := $(LANGS:$(ROOTDIR)/%.lang=$(BUILDDIR)/%.vstrings)
|
2009-03-02 06:13:18 +00:00
|
|
|
LANG_O = $(BUILDDIR)/lang/lang_core.o
|
2020-07-21 12:54:14 +00:00
|
|
|
ENGLISH := english
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2009-03-02 06:13:18 +00:00
|
|
|
CLEANOBJS += $(BUILDDIR)/lang/max_language_size.h $(BUILDDIR)/lang/lang*
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# $(BUILDDIR)/apps/lang must exist before we create dependencies on it,
|
|
|
|
# otherwise make will simply ignore those dependencies.
|
|
|
|
# Therefore we create it here.
|
|
|
|
#DUMMY := $(shell mkdir -p $(BUILDDIR)/apps/lang)
|
|
|
|
|
2009-10-18 00:56:42 +00:00
|
|
|
# Calculate the maximum language size. Currently based on the file size
|
2020-07-27 05:10:34 +00:00
|
|
|
# of the largest lng file. Subtract 10 due to HEADER_SIZE and
|
2009-10-18 00:56:42 +00:00
|
|
|
# SUBHEADER_SIZE.
|
|
|
|
# TODO: In the future generate this file within genlang or another script
|
|
|
|
# in order to only calculate the maximum size based on the core strings.
|
2012-05-19 15:14:35 +00:00
|
|
|
$(BUILDDIR)/lang/max_language_size.h: $(LANGOBJ) $(BUILDDIR)/apps/lang/voicestrings.zip
|
2010-07-17 15:33:35 +00:00
|
|
|
$(call PRINTS,GEN $(subst $(BUILDDIR)/,,$@))
|
2012-06-09 21:04:42 +00:00
|
|
|
$(SILENT)echo "#define MAX_LANGUAGE_SIZE `ls -ln $(BUILDDIR)/apps/lang/*.lng | awk '{print $$5-10}' | sort -n | tail -1`" > $@
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2016-08-20 14:25:11 +00:00
|
|
|
$(BUILDDIR)/lang/lang_core.o: $(BUILDDIR)/lang/lang.h $(BUILDDIR)/lang/lang_core.c
|
2009-03-02 06:13:18 +00:00
|
|
|
$(call PRINTS,CC lang_core.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang/lang_core.c -o $@
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2017-09-24 21:25:08 +00:00
|
|
|
# genlang creates *both* lang.c and lang.h but in Make there is no wat to express this rule
|
|
|
|
# (multiple target rules DO NOT express that, they are a simple shortcut for multiple rules)
|
|
|
|
# instead we pretend that genlang create lang_core.c and that lang.c depends from lang.h
|
|
|
|
# it will work fine as long as one never manually removes lang.c and not lang.h, and it will avoid
|
|
|
|
# race conditions such as running genlang twice or worse in parallel with other things!
|
2020-07-21 12:54:14 +00:00
|
|
|
$(BUILDDIR)/lang/lang.h: $(APPSDIR)/lang/$(ENGLISH).lang $(BUILDDIR)/apps/features
|
2017-09-22 19:06:30 +00:00
|
|
|
$(call PRINTS,GEN lang.h)
|
2016-08-20 14:25:11 +00:00
|
|
|
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
|
|
|
|
perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $<
|
2017-09-24 21:25:08 +00:00
|
|
|
$(BUILDDIR)/lang/lang_core.c: $(BUILDDIR)/lang/lang.h
|
2010-01-17 13:03:10 +00:00
|
|
|
|
2019-02-04 01:12:50 +00:00
|
|
|
$(BUILDDIR)/lang_enum.h: $(BUILDDIR)/lang/lang.h
|
|
|
|
|
2017-09-24 21:25:08 +00:00
|
|
|
# NOTE: for some weird reasons in GNU make, multi targets rules WITH patterns actually express
|
|
|
|
# the fact that the two files are created as the result of one invocation of the rule
|
2020-07-27 05:10:34 +00:00
|
|
|
$(BUILDDIR)/%.lng $(BUILDDIR)/%.vstrings: $(ROOTDIR)/%.lang $(BUILDDIR)/apps/genlang-features $(TOOLSDIR)/genlang $(TOOLSDIR)/updatelang
|
2008-11-20 11:27:31 +00:00
|
|
|
$(call PRINTS,GENLANG $(subst $(ROOTDIR)/,,$<))
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2020-07-27 05:10:34 +00:00
|
|
|
$(SILENT)$(TOOLSDIR)/updatelang $(APPSDIR)/lang/$(ENGLISH).lang $< $@.tmp
|
2020-07-21 12:54:14 +00:00
|
|
|
$(SILENT)$(TOOLSDIR)/genlang -e=$(APPSDIR)/lang/$(ENGLISH).lang -t=$(MODELNAME):`cat $(BUILDDIR)/apps/genlang-features` -i=$(TARGET_ID) -b=$*.lng -c=$*.vstrings $@.tmp
|
2020-07-21 04:34:37 +00:00
|
|
|
$(SILENT)rm -f $@.tmp
|
2012-05-19 15:14:35 +00:00
|
|
|
|
2020-12-11 21:15:02 +00:00
|
|
|
$(BUILDDIR)/apps/lang/voice-corrections.txt: $(ROOTDIR)/tools/voice-corrections.txt
|
2020-12-11 21:26:27 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2020-12-11 21:15:02 +00:00
|
|
|
$(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $@
|
|
|
|
|
|
|
|
$(BUILDDIR)/apps/lang/voicestrings.zip: $(VOICEOBJ) $(wildcard $(BUILDDIR)/apps/lang/*.talk) $(BUILDDIR)/apps/lang/voice-corrections.txt
|
2012-05-19 15:14:35 +00:00
|
|
|
$(call PRINTS,ZIP $(subst $(BUILDDIR)/,,$@))
|
|
|
|
$(SILENT)zip -9 -q $@ $(subst $(BUILDDIR)/,,$^)
|
2020-09-20 17:29:02 +00:00
|
|
|
|
|
|
|
#copy any included talk files to the /lang directory
|
|
|
|
$(BUILDDIR)/apps/lang/%.talk: $(ROOTDIR)/apps/lang/%.talk
|
|
|
|
$(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/lang
|