[MPlayer-DOCS] homepage build system

Torinthiel torinthiel at megapolis.pl
Sat Nov 6 09:11:17 CET 2004


On Sat, Nov 06, 2004 at 09:08:19AM +0100, Torinthiel wrote:
> As discussed with Diego, I've been trying to reimplement homepage
> generation based on make.

And I really should attach my work ;)
Torinthiel

-- 
 Waclaw "Torinthiel" Schiller       GG#: 542916, 3073512
   torinthiel(at)megapolis(dot)pl
   gpg: B06901F1 fpr: FAA3 559F CAE9 34DE CDC8  7346 2B6E 39F2 B069 01F1
 "No classmates may be used during this examination"
-------------- next part --------------
DESIGNS := design3 design4 design5 design6 design7
SOURCES := $(wildcard src/*.src.*)

.PHONY: all clean $(DESIGNS)
all: $(DESIGNS)

clean:
	rm -f $(foreach des, $(DESIGNS), $(wildcard $(des)/*.html))

$(DESIGNS) : % : %/src/upper %/src/lower $(wildcard %/src/selector*) $(SOURCES)
	make -C $@ -f ../Makefile.inc
-------------- next part --------------
TRANSLATIONS := es hu pl
SRC2HTML = $(addsuffix $(2).html, $(notdir $(basename $(basename $(1)))))
pl_ENCODING := iso-8859-2

all: en $(TRANSLATIONS)

# The English homepage requires some special treatment

en: $(call SRC2HTML, $(wildcard ../src/*.src.en))
$(call SRC2HTML, $(wildcard ../src/*.src.en)): %.html : ../src/%.src.en src/upper src/selector src/lower
	cat src/upper src/selector $< src/lower > $@

# And the rest of languages...

define lang-def
$(1): $(if $(wildcard src/selector-$(1)),$(call SRC2HTML, $(wildcard ../src/*.src.$(1)),-$(1)))
$(call SRC2HTML, $(wildcard ../src/*.src.en),-$(1)): %-$(1).html : ../src/%.src.$(1) src/upper src/selector-$(1) src/lower
	$(if $($(1)_ENCODING),\
	sed -e 's/iso-8859-1/$($(1)_ENCODING)/' src/upper | \
	cat - src/selector-$(1) $$< src/lower > $$@,\
	cat src/upper src/selector-$(1) $$< src/lower > $$@)
endef
$(foreach lang, $(TRANSLATIONS),$(eval $(call lang-def,$(lang))))

# vim:ft=make
-------------- next part --------------
DESIGNS := desing3 design4 design5 design6 design7
TRANSLATIONS := es hu pl
pl_ENCODING := iso-8859-2

# converts source file names to resulting HTML
# 1 - source name; 2 - design directory; 3 - language postfix (optional)
SRC2HTML = $(addprefix $(2)/, $(addsuffix $(3).html, $(notdir $(basename $(basename $(1))))))

.PHONY: all clean $(DESIGNS)
all: $(DESIGNS)

clean:
	rm -f $(foreach des, $(DESIGNS), $(wildcard $(des)/*.html))

# do single language of a single design (of any language except English)
# $(1) - language
# $(2) - design
define lang-def
$(2)-$(1): $(if $(wildcard $(2)/src/selector-$(1)),$(call SRC2HTML, $(wildcard src/*.src.$(1)),$(2),-$(1)))
$(call SRC2HTML, $(wildcard src/*.src.$(1)),$(2),-$(1)): $(2)/%-$(1).html : src/%.src.$(1) $(2)/src/upper $(2)/src/selector-$(1) $(2)/src/lower
	$(if $($(1)_ENCODING),\
	sed -e 's/iso-8859-1/$($(1)_ENCODING)/' $(2)/src/upper | \
	cat - $(2)/src/selector-$(1) $$< $(2)/src/lower > $$@,\
	cat $(2)/src/upper $(2)/src/selector-$(1) $$< $(2)/src/lower > $$@)
endef

# Do a single design
# $(1) - design name
define design-def
$(1): $(addprefix $(1)-, en $(TRANSLATIONS))

$(1)-en: $(call SRC2HTML, $(wildcard src/*.src.en),$(1))

$(call SRC2HTML, $(wildcard src/*.src.en),$(1)): $(1)/%.html: src/%src.en $(1)/src/upper $(1)/src/selector $(1)/src/lower
	cat $(1)/src/upper $(1)/src/selector $$< $(1)/src/lower > $$@

$(foreach lang, $(TRANSLATIONS),$(eval $(call lang-def,$(lang),$(1))))
endef

$(foreach design, $(DESIGNS),$(eval $(call design-def,$(design))))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-docs/attachments/20041106/5fd5b65c/attachment.pgp>


More information about the MPlayer-DOCS mailing list