[MPlayer-DOCS] [homepage]: r3310 - trunk/Makefile

diego subversion at mplayerhq.hu
Sat Nov 15 14:01:28 CET 2008


Author: diego
Date: Sat Nov 15 14:01:27 2008
New Revision: 3310

Log:
non-recursive make


Modified:
   trunk/Makefile

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	(original)
+++ trunk/Makefile	Sat Nov 15 14:01:27 2008
@@ -1,38 +1,42 @@
+# Makefile to generate the MPlayer homepage from template files
+# Note that the build will fail if there is an English master file
+# without translation.
+
 DESIGNS      = design7 design6 design5 design4 design3
 TRANSLATIONS = es hu pl ru
-SRCDIRS      = src essays/src
-
-homepage: $(DESIGNS)
+SRCS         = dload donations info mailing_lists media news news-archive projects screen
+SRCS_ESSAYS  = interview-arpi interview-gabucino interview-pontscho konf2002 konf2002-arpi konf2002-pontscho
+SRCS_PATH        = $(foreach design,$(DESIGNS),$(foreach source,$(SRCS),$(design)/$(source)))
+SRCS_ESSAYS_PATH = $(foreach design,$(DESIGNS),$(foreach source,$(SRCS_ESSAYS),$(design)/$(source)))
 
-$(DESIGNS):
-	make -C $@ -f ../Makefile en $(TRANSLATIONS)
+homepage: $(foreach source,$(SRCS_PATH) $(SRCS_ESSAYS_PATH), $(source).html) \
+          $(foreach source,$(SRCS_PATH),$(foreach lang,$(TRANSLATIONS),$(source)-$(lang).html)) \
+          $(foreach source,$(SRCS_ESSAYS_PATH), $(source)-hu.html)
 
-SRC2HTML = $(addsuffix $(2).html, $(notdir $(basename $(basename $(1)))))
+define page_template
+$(design)/$(source)$(3).html: $(1)/$(source).$(2)
+	cat $(design)/src/upper $(design)/src/selector$(4) $$< $(design)/src/lower > $$@
+endef
 
-# The English homepage requires some special treatment
-en: $(call SRC2HTML, $(foreach dir, $(SRCDIRS), $(wildcard ../$(dir)/*.en)))
+# English is available for all designs
+$(foreach design,$(DESIGNS),$(foreach source,$(SRCS),$(eval $(call page_template,src,en))))
 
-define en-dir-def
-$(call SRC2HTML, $(wildcard ../$(1)/*.en)):  %.html : ../$(1)/%.en src/upper src/selector src/lower
-	cat src/upper src/selector $$< src/lower > $$@
-endef
+# design7 has translated templates
+$(foreach design,design7,$(foreach source,$(SRCS),$(foreach lang,$(TRANSLATIONS),$(eval $(call page_template,src,$(lang),-$(lang),-$(lang))))))
 
-# And the rest of languages...
-define lang-def
-#$(1): $(if $(wildcard src/selector-$(1)),$(call SRC2HTML, $(wildcard ../src/*.$(1)) $(wildcard ../essays/src/*.$(1)),-$(1)))
-$(1): $(if $(wildcard src/selector-$(1)),$(call SRC2HTML, $(foreach dir, $(SRCDIRS), $(wildcard ../$(dir)/*.$(1))),-$(1)))
-endef
+# design6 has Hungarian templates available
+$(foreach design,design6,$(foreach source,$(SRCS),$(eval $(call page_template,src,hu,-hu,-hu))))
+$(foreach design,design6,$(foreach source,$(SRCS),$(foreach lang,es pl ru,$(eval $(call page_template,src,$(lang),-$(lang))))))
 
-define lang-dir-def
-$(call SRC2HTML, $(wildcard ../$(2)/*.$(1)),-$(1)): %-$(1).html : ../$(2)/%.$(1) src/upper src/selector-$(1) src/lower
-	cat src/upper src/selector-$(1) $$< src/lower > $$@
-endef
+# no translated templates for old designs
+$(foreach design,design5 design4 design3,$(foreach source,$(SRCS),$(foreach lang,$(TRANSLATIONS),$(eval $(call page_template,src,$(lang),-$(lang))))))
 
-$(foreach lang, $(TRANSLATIONS), $(eval $(call lang-def,$(lang))))
-$(foreach lang, $(TRANSLATIONS), $(foreach dir, $(SRCDIRS), $(eval $(call lang-dir-def,$(lang),$(dir)))))
-$(foreach dir,  $(SRCDIRS),      $(eval $(call en-dir-def,$(dir))))
+# essays are available in English and Hungarian
+$(foreach design,$(DESIGNS),$(foreach source,$(SRCS_ESSAYS),$(eval $(call page_template,essays/src,en))))
+$(foreach design,design7 design6,$(foreach source,$(SRCS_ESSAYS),$(eval $(call page_template,essays/src,hu,-hu,-hu))))
+$(foreach design,design5 design4 design3,$(foreach source,$(SRCS_ESSAYS),$(eval $(call page_template,essays/src,hu,-hu))))
 
 clean:
 	rm -f $(addsuffix /*.html,$(DESIGNS))
 
-.PHONY: homepage $(TRANSLATIONS) $(DESIGNS) clean
+.PHONY: clean homepage



More information about the MPlayer-DOCS mailing list