# Nothing in here should require any modification. If you feel you need to # modify something first send mail to debian-www explaining why. CUR_YEAR := $(shell date +%Y) # Turn this on to stop ignoring errors in various places STRICT_ERROR_CHECKS = 0 ifeq ($(STRICT_ERROR_CHECKS), 0) IGNORE = - else IGNORE = endif # Turn this on to use (small) sample files for data that generated from # cronjobs on the official website. USE_SAMPLE_FILES := 0 ENGLISHSRCDIR := $(WMLBASE)/../english ENGLISHDIR := $(ENGLISHSRCDIR) # ^ just an alias ^ TEMPLDIR := $(ENGLISHDIR)/template/debian RELHTMLBASE := ../../www HTMLDIR = $(WMLBASE)/$(RELHTMLBASE)/$(CUR_DIR) VCSREVCACHE = $(WMLBASE)/../.git-revs-cache.db LOCALEDIR := $(WMLBASE)/../locale/$(LANGUAGE)/LC_MESSAGES essential-locale-files := templates countries langs date ifeq "$(LANGUAGE)" "en" locale = $(addsuffix .pot, $(addprefix $(ENGLISHDIR)/po/, $(1))) $(ENGLISHDIR)/po/%.pot: touch $@ # because of $(?F) else locale = $(addsuffix .mo, $(addprefix $(LOCALEDIR)/, $(1))) $(LOCALEDIR)/%.mo: touch $@ # because of $(?F) endif GETTEXTDEP := $(call locale, $(essential-locale-files) ) ifneq "$(LANGUAGE)" "en" ifneq "$(GETTEXTFILES)" "" GETTEXTDEP += $(addprefix $(LOCALEDIR)/,$(GETTEXTFILES)) endif endif WMLRCDEP := $(WMLBASE)/../.wmlrc $(WMLBASE)/.wmlrc LANGUAGECAP = $(shell echo $(LANGUAGE) | tr "a-z" "A-Z") WMLOPTIONS := -q -D CUR_YEAR=$(CUR_YEAR) WMLOUTFILE = $(@F) WMLPROLOG := WMLEPILOG := WML = wml $(WMLOPTIONS) -o UNDEFu$(LANGUAGECAP):$(WMLOUTFILE)@g+w $(WMLPROLOG) $(WMLEPILOG) WMLFILES = $(sort $(wildcard *.wml)) ifndef SUBLANG HTMLFILES = $(patsubst %.wml,%.$(LANGUAGE).html,$(WMLFILES)) HTMLDESTFILES = $(patsubst %.wml,$(HTMLDIR)/%.$(LANGUAGE).html,$(WMLFILES)) else HTMLFILES = $(sort $(foreach i,$(SUBLANG),\ $(patsubst %.wml,%.$(LANGUAGE)-$(i).html,$(WMLFILES)))) HTMLDESTFILES = $(sort $(foreach i,$(SUBLANG),\ $(patsubst %.wml,$(HTMLDIR)/%.$(LANGUAGE)-$(i).html,$(WMLFILES)))) endif OTHERFILES := $(sort $(wildcard *.ps.gz *.eps *.pdf *.css)) OTHERFILES += $(sort $(wildcard *.jpg *.jpeg *.gif *.png *.fig *.xcf *.xcf.gz *.ppm *.svg *.eot *.ttf *.woff *.woff2)) OTHERDESTFILES := $(patsubst %,$(HTMLDIR)/%,$(OTHERFILES)) existing-SUBS := $(shell for dir in $(sort $(wildcard $(SUBS))) ''; do test -d $$dir && echo $$dir; done) existing-SUBS-install := $(addsuffix -install,$(existing-SUBS)) existing-SUBS-clean := $(addsuffix -clean,$(existing-SUBS)) existing-SUBS-cleandest := $(addsuffix -cleandest,$(existing-SUBS)) # rules all:: $(HTMLFILES) $(existing-SUBS) $(existing-SUBS): $(IGNORE)$(MAKE) -C $@ install:: $(HTMLDESTFILES) $(OTHERDESTFILES) $(existing-SUBS-install) $(existing-SUBS-install): $(IGNORE)$(MAKE) -C $(patsubst %-install,%,$@) install clean:: rm -f *.$(LANGUAGE).html *~ *.forced ifeq "$(LANGUAGE)" "en" rm -f *.en-us.html *.en-gb.html endif clean:: $(existing-SUBS-clean) $(existing-SUBS-clean): $(IGNORE)$(MAKE) -C $(patsubst %-clean,%,$@) clean cleandest:: rm -f $(HTMLDIR)/*.$(LANGUAGE).html ifeq "$(LANGUAGE)" "en" rm -f $(HTMLDIR)/*.en-us.html $(HTMLDIR)/*.en-gb.html endif cleandest:: $(existing-SUBS-cleandest) $(existing-SUBS-cleandest): $(IGNORE)$(MAKE) -C $(patsubst %-cleandest,%,$@) cleandest $(VCSREVCACHE): $(WMLBASE)/../.git/index (cd $(WMLBASE)/.. && ./build_vcs_cache.pl) # the rule for every wml file ifndef NOGENERICDEP ifeq "$(LANGUAGE)" "en" EXTRAWMLDEP := $(WMLRCDEP) $(GETTEXTDEP) $(TEMPLDIR)/template.wml $(TEMPLDIR)/languages.wml else EXTRAWMLDEP := $(WMLRCDEP) $(GETTEXTDEP) $(TEMPLDIR)/template.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/translation-check.wml endif # The "| $(VCSREVCACHE)" here is an order-only prerequisite - always # check that the prerequisite exists and is up to date, but don't # rebuild everything whenever it's updated - see # https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html %.$(LANGUAGE).html : %.wml $(EXTRAWMLDEP) | $(VCSREVCACHE) $(WML) $( $(@F) @ln -sf $(@F) $(@D)/$(*F).no.html endif ifeq "$(LANGUAGE)" "en" @echo making a link $(@D)/$(*F).html -\> $(@F) @ln -sf $(@F) $(@D)/$(*F).html endif endif LOCALEDESTFILES := $(patsubst $(ENGLISHDIR)/po/%.pot,$(LOCALEDIR)/%.mo,$(sort $(wildcard $(ENGLISHDIR)/po/*.pot))) ifneq "$(LANGUAGE)" "en" # Ensure that MO files do exist # Translators have to run make under webwml//po if they # want it updated, it cannot be automatically performed. $(LOCALEDESTFILES): $(LOCALEDIR)/%.mo: $(WMLBASE)/po/%.$(LANGUAGE).po $(MAKE) -C $(WMLBASE)/po install-$*.mo else # English doesn't generate those .mo files, so just fake them $(LOCALEDESTFILES): $(LOCALEDIR)/%.mo: $(ENGLISHDIR)/po/%.pot endif $(OTHERDESTFILES): $(HTMLDIR)/%: % @test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR) install -m 664 -p $< $(HTMLDIR) ifeq "$(LANGUAGE)" "en" # probably doesn't work for *.gz files, FIXME [ -f "$(HTMLDIR)/$(basename $(basename $<))$(suffix $<)" ] || ln -s $< $(HTMLDIR)/$(basename $(basename $<))$(suffix $<) endif # template dependencies $(TEMPLDIR)/%.wml: ifeq "$(LANGUAGE)" "en" touch $@ # because of $(?F) else @if [ "$(findstring .mo,$(?F))" = "" ]; then \ touch $@; echo "touch $@ # because of $(?F)"; \ fi endif gendep: @for f in $(TEMPLDIR)/*.wml \ $(TEMPLDIR)/weeklynews/*.wml \ $(TEMPLDIR)/projectnews/*.wml; \ do \ grep -q '^#use wml::debian' $$f || continue; \ ../gendep.pl "$$f" |\ sed -e 's,X$(TEMPLDIR),X\$$(TEMPLDIR),' |\ fold -b -s -w 70 |\ sed -e 's/^\$$/ \$$/' -e 's/^X//' -e 's/callX/call /g' -e '$$!s/$$/\\/'; \ done # this dependency cannot be automatically computed $(TEMPLDIR)/basic.wml: $(TEMPLDIR)/navbar.wml # dependencies below are generated by gendep and manually checked $(TEMPLDIR)/basic.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/language_names.wml \ $(TEMPLDIR)/footer.wml $(TEMPLDIR)/blend.wml: $(TEMPLDIR)/template.wml $(TEMPLDIR)/cdimage.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/links.tags.wml $(TEMPLDIR)/basic.wml \ $(call locale,cdimage) $(TEMPLDIR)/common_translation.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/consultant.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml \ $(call locale,consultants) $(TEMPLDIR)/countries.wml: $(TEMPLDIR)/common_tags.wml \ $(call locale,countries) $(TEMPLDIR)/ctime.wml: $(TEMPLDIR)/common_tags.wml \ $(call locale,date) $(TEMPLDIR)/ddp.wml: $(TEMPLDIR)/basic.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/event.wml: $(TEMPLDIR)/events_common.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/events_common.wml: $(TEMPLDIR)/common_translation.wml \ $(call locale,newsevents) $(TEMPLDIR)/fixes_link.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/footer.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/links.tags.wml $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/release_info.wml $(TEMPLDIR)/installer.wml: $(TEMPLDIR)/release_info.wml $(TEMPLDIR)/language_names.wml: $(TEMPLDIR)/common_tags.wml \ $(call locale,langs) $(TEMPLDIR)/languages.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/language_names.wml $(TEMPLDIR)/countries.wml $(TEMPLDIR)/legal.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/submenu.wml \ $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/basic.wml $(call locale,legal) $(TEMPLDIR)/legal_lists.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/legal_tags.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/common_translation.wml $(call locale,legal) $(TEMPLDIR)/links.tags.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/mainpage.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/links.tags.wml \ $(TEMPLDIR)/languages.wml $(TEMPLDIR)/release_info.wml $(TEMPLDIR)/navbar.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/events_common.wml $(TEMPLDIR)/links.tags.wml \ $(TEMPLDIR)/stats_tags.wml $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/news.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/basic.wml $(call locale,newsevents) $(TEMPLDIR)/past_event.wml: $(TEMPLDIR)/events_common.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml $(TEMPLDIR)/profiles.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/faqs.wml $(TEMPLDIR)/basic.wml $(TEMPLDIR)/recent_list.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/recent_list_security.wml: $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/recent_list_common.wml $(TEMPLDIR)/release_images.wml: $(TEMPLDIR)/installer.wml \ $(TEMPLDIR)/release_info.wml $(TEMPLDIR)/release_info.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/release.wml: $(TEMPLDIR)/languages.wml $(TEMPLDIR)/security.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/fixes_link.wml \ $(TEMPLDIR)/languages.wml $(TEMPLDIR)/ctime.wml \ $(TEMPLDIR)/securityreferences.wml $(TEMPLDIR)/basic.wml \ $(call locale,security) $(TEMPLDIR)/stats_tags.wml: $(TEMPLDIR)/common_tags.wml \ $(call locale,stats) $(TEMPLDIR)/template.wml: $(TEMPLDIR)/basic.wml \ $(TEMPLDIR)/languages.wml $(TEMPLDIR)/translation-check.wml: $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/url.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/users.wml: $(TEMPLDIR)/common_translation.wml \ $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/basic.wml $(TEMPLDIR)/users_list.wml: $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/votebar.wml: $(TEMPLDIR)/languages.wml \ $(TEMPLDIR)/common_tags.wml $(call locale,vote) $(TEMPLDIR)/wnpp.wml: $(TEMPLDIR)/common_tags.wml $(call locale,wnpp) $(TEMPLDIR)/weeklynews/footer.wml: $(TEMPLDIR)/common_tags.wml \ $(call locale,newsevents) $(TEMPLDIR)/weeklynews/header.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/links.tags.wml \ $(TEMPLDIR)/template.wml $(TEMPLDIR)/projectnews/boilerplates.wml: \ $(TEMPLDIR)/common_tags.wml $(call locale,newsevents) $(TEMPLDIR)/projectnews/footer.wml: $(TEMPLDIR)/common_tags.wml \ $(call locale,newsevents) $(TEMPLDIR)/projectnews/header.wml: $(TEMPLDIR)/common_tags.wml \ $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/links.tags.wml $(TEMPLDIR)/toc.wml \ $(TEMPLDIR)/projectnews/boilerplates.wml $(TEMPLDIR)/template.wml $(TEMPLDIR)/navbar.wml: $(ENGLISHSRCDIR)/logos/openlogo-nd-50.png .SUFFIXES: .PHONY: all $(existing-SUBS) install $(existing-SUBS-install) .PHONY: clean $(existing-SUBS-clean) cleandest $(existing-SUBS-cleandest)