Index: apps/Makefile
===================================================================
RCS file: /cvsroot/rockbox/apps/Makefile,v
retrieving revision 1.111
diff -u -r1.111 Makefile
--- apps/Makefile	27 Oct 2006 21:47:46 -0000	1.111
+++ apps/Makefile	28 Oct 2006 21:37:54 -0000
@@ -192,9 +192,25 @@
 
 include $(TOOLSDIR)/make.inc
 
-$(OBJDIR)/lang.o: lang/$(LANGUAGE).lang
-	@mkdir -p $(dir $@)
-	$(call PRINTS,GENLANG)perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(ARCHOS) $<
+# 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
+	$(SILENT)mkdir -p `dirname $@`
+	$(SILENT)for f in `cat $(OBJDIR)/features`; do \
+	  if test -n "$$feat"; then \
+	    feat="$$feat:"; \
+	  fi; \
+	  feat="$$feat$$f"; \
+	done;
+	$(call PRINTS,GENLANG)perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(ARCHOS):$$feat $<
 	$(call PRINTS,CC lang.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang.c -o $@
 
 clean:
