diff --git a/apps/lang/lang.make b/apps/lang/lang.make index 6465b426b7..cee2456b5d 100644 --- a/apps/lang/lang.make +++ b/apps/lang/lang.make @@ -31,11 +31,19 @@ $(BUILDDIR)/lang/max_language_size.h: $(LANGOBJ) $(BUILDDIR)/apps/lang/voicestri $(BUILDDIR)/lang/lang_core.o: $(BUILDDIR)/lang/lang.h $(BUILDDIR)/lang/lang_core.c $(call PRINTS,CC lang_core.c)$(CC) $(CFLAGS) -c $(BUILDDIR)/lang/lang_core.c -o $@ -$(BUILDDIR)/lang/lang.h $(BUILDDIR)/lang/lang_core.c: $(APPSDIR)/lang/$(LANGUAGE).lang $(BUILDDIR)/apps/features +# 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! +$(BUILDDIR)/lang/lang.h: $(APPSDIR)/lang/$(LANGUAGE).lang $(BUILDDIR)/apps/features $(call PRINTS,GEN lang.h) $(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \ perl -s $(TOOLSDIR)/genlang -p=$(BUILDDIR)/lang -t=$(MODELNAME)$$feat $< +$(BUILDDIR)/lang/lang_core.c: $(BUILDDIR)/lang/lang.h +# 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 $(BUILDDIR)/%.lng $(BUILDDIR)/%.vstrings: $(ROOTDIR)/%.lang $(BUILDDIR)/apps/genlang-features $(call PRINTS,GENLANG $(subst $(ROOTDIR)/,,$<)) $(SILENT)mkdir -p $(dir $@)