Index: apps/Makefile
===================================================================
RCS file: /cvsroot/rockbox/apps/Makefile,v
retrieving revision 1.107
diff -u -r1.107 Makefile
--- apps/Makefile	29 Sep 2006 16:15:06 -0000	1.107
+++ apps/Makefile	19 Oct 2006 08:02:02 -0000
@@ -192,10 +192,26 @@
 
 include $(TOOLSDIR)/make.inc
 
-$(OBJDIR)/lang.o: lang/$(LANGUAGE).lang
+# apps/features.txt is a file that (is preprocessed and) lists named features
+# based on defines in the config-*.h files. The named features will be passed
+# to genlang and thus (translated) phrases can be used based on those names.
+#
+$(OBJDIR)/features: features.txt
+	$(SILENT)(cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
+	$(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - | \
+	grep -v "^\#" > $@; \
+	echo "" >/dev/null )
+
+$(OBJDIR)/lang.o: lang/$(LANGUAGE).lang $(OBJDIR)/features
 	@echo "GENLANG"
-	@mkdir -p `dirname $@`
-	$(SILENT)perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(ARCHOS) $<
+	$(SILENT)mkdir -p `dirname $@`
+	$(SILENT)(for f in `cat $(OBJDIR)/features`; do \
+	  if test -n "$$feat"; then \
+	    feat="$$feat:"; \
+	  fi; \
+	  feat="$$feat$$f"; \
+	done; \
+	perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(ARCHOS):$$feat $< )
 	@echo "CC lang.c"
 	@$(CC) $(CFLAGS) -c $(BUILDDIR)/lang.c -o $@
 
