Makefile.common 10.4 KB
Newer Older
Josip Rodin's avatar
Josip Rodin committed
1 2 3
# Nothing in here should require any modification. If you feel you need to
# modify something first send mail to debian-www explaining why.

4 5
CUR_YEAR := $(shell date +%Y)

6
ENGLISHSRCDIR := $(WMLBASE)/../english
7 8
ENGLISHDIR := $(ENGLISHSRCDIR)
# ^ just an alias ^
9

10
TEMPLDIR := $(ENGLISHDIR)/template/debian
11
RELHTMLBASE := ../../www
Josip Rodin's avatar
Josip Rodin committed
12 13
HTMLDIR = $(WMLBASE)/$(RELHTMLBASE)/$(CUR_DIR)

14
LOCALEDIR := $(WMLBASE)/../locale/$(LANGUAGE)/LC_MESSAGES
15 16 17 18 19 20 21 22 23 24 25 26
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) )

27
ifneq "$(LANGUAGE)" "en"
28 29 30
ifneq "$(GETTEXTFILES)" ""
GETTEXTDEP += $(addprefix $(LOCALEDIR)/,$(GETTEXTFILES))
endif
31 32
endif

33 34
WMLRCDEP := $(WMLBASE)/../.wmlrc $(WMLBASE)/.wmlrc

Josip Rodin's avatar
Josip Rodin committed
35
LANGUAGECAP = $(shell echo $(LANGUAGE) | tr "a-z" "A-Z")
36
WMLOPTIONS := -q -D CUR_YEAR=$(CUR_YEAR)
Josip Rodin's avatar
Josip Rodin committed
37 38 39 40 41 42
WMLOUTFILE = $(@F)
WMLPROLOG :=
WMLEPILOG :=
WML = wml $(WMLOPTIONS) -o UNDEFu$(LANGUAGECAP):$(WMLOUTFILE)@g+w $(WMLPROLOG) $(WMLEPILOG)

WMLFILES = $(wildcard *.wml)
43
ifndef SUBLANG
Josip Rodin's avatar
Josip Rodin committed
44 45
HTMLFILES = $(patsubst %.wml,%.$(LANGUAGE).html,$(WMLFILES))
HTMLDESTFILES = $(patsubst %.wml,$(HTMLDIR)/%.$(LANGUAGE).html,$(WMLFILES))
46
else
47 48 49 50 51
HTMLFILES = $(sort $(foreach i,$(SUBLANG),\
	$(patsubst %.wml,%.$(LANGUAGE)-$(i).html,$(WMLFILES))))
HTMLDESTFILES = $(sort $(foreach i,$(SUBLANG),\
	$(patsubst %.wml,$(HTMLDIR)/%.$(LANGUAGE)-$(i).html,$(WMLFILES))))
endif
52

53
OTHERFILES := $(wildcard *.ps.gz *.eps *.pdf *.css)
54
OTHERFILES += $(wildcard *.jpg *.jpeg *.gif *.png *.fig *.xcf *.xcf.gz *.ppm *.svg)
55
OTHERDESTFILES := $(patsubst %,$(HTMLDIR)/%,$(OTHERFILES))
Josip Rodin's avatar
Josip Rodin committed
56 57

existing-SUBS := $(shell for dir in $(wildcard $(SUBS)) ''; do test -d $$dir && echo $$dir; done)
58 59 60
existing-SUBS-install := $(addsuffix -install,$(existing-SUBS))
existing-SUBS-clean := $(addsuffix -clean,$(existing-SUBS))
existing-SUBS-cleandest := $(addsuffix -cleandest,$(existing-SUBS))
Josip Rodin's avatar
Josip Rodin committed
61

62
# rules
Josip Rodin's avatar
Josip Rodin committed
63 64 65
all:: $(HTMLFILES) $(existing-SUBS)

$(existing-SUBS):
66
	-$(MAKE) -C $@
Josip Rodin's avatar
Josip Rodin committed
67

68
install:: $(HTMLDESTFILES) $(OTHERDESTFILES) $(existing-SUBS-install)
Josip Rodin's avatar
Josip Rodin committed
69 70

$(existing-SUBS-install):
71
	-$(MAKE) -C $(patsubst %-install,%,$@) install
Josip Rodin's avatar
Josip Rodin committed
72 73

clean::
Josip Rodin's avatar
Josip Rodin committed
74
	rm -f *.$(LANGUAGE).html *~ *.forced
75 76 77
ifeq "$(LANGUAGE)" "en"
	rm -f *.en-us.html *.en-gb.html
endif
Josip Rodin's avatar
Josip Rodin committed
78 79 80
clean:: $(existing-SUBS-clean)

$(existing-SUBS-clean):
81
	-$(MAKE) -C $(patsubst %-clean,%,$@) clean
Josip Rodin's avatar
Josip Rodin committed
82 83 84

cleandest::
	rm -f $(HTMLDIR)/*.$(LANGUAGE).html
85 86 87
ifeq "$(LANGUAGE)" "en"
	rm -f $(HTMLDIR)/*.en-us.html $(HTMLDIR)/*.en-gb.html
endif
Josip Rodin's avatar
Josip Rodin committed
88 89 90
cleandest:: $(existing-SUBS-cleandest)

$(existing-SUBS-cleandest):
91
	-$(MAKE) -C $(patsubst %-cleandest,%,$@) cleandest
Josip Rodin's avatar
Josip Rodin committed
92 93

# the rule for every wml file
94
ifndef NOGENERICDEP
95

96 97
%.$(LANGUAGE).html : %.wml $(WMLRCDEP) $(GETTEXTDEP) \
  $(TEMPLDIR)/template.wml $(TEMPLDIR)/languages.wml
Josip Rodin's avatar
Josip Rodin committed
98
	$(WML) $(<F)
99
ifeq "$(LANGUAGE)" "en"
100
	-$(WMLBASE)/../touch_translations.pl $(CURDIR)/$(<F) $(LANGUAGE)
101 102
else
ifneq "$(findstring international,$(CUR_DIR))" ""
103
	-$(WMLBASE)/../touch_translations.pl $(CURDIR)/$(<F) $(LANGUAGE)
104
endif
105
endif
Josip Rodin's avatar
Josip Rodin committed
106

107 108
endif

109
ifndef NOGENERICINSTDEP
110 111
$(HTMLDIR)/%.$(LANGUAGE).html: %.$(LANGUAGE).html
	@test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR)
Josip Rodin's avatar
Josip Rodin committed
112
	@echo copying $(@F) to $(HTMLDIR)
113
	-@install -m 664 -p $(@F) $(HTMLDIR)
114 115 116
ifeq "$(LANGUAGE)" "nb"
	@echo making a link $(@D)/$(*F).no.html -\> $(@F)
	@ln -sf $(@F) $(@D)/$(*F).no.html
117
endif
118
ifeq "$(LANGUAGE)" "en"
Josip Rodin's avatar
Josip Rodin committed
119
	@echo making a link $(@D)/$(*F).html -\> $(@F)
120
	@ln -sf $(@F) $(@D)/$(*F).html
Josip Rodin's avatar
Josip Rodin committed
121
endif
122
endif
Josip Rodin's avatar
Josip Rodin committed
123

124 125 126
LOCALEDESTFILES := $(patsubst $(ENGLISHDIR)/po/%.pot,$(LOCALEDIR)/%.mo,$(wildcard $(ENGLISHDIR)/po/*.pot))

ifneq "$(LANGUAGE)" "en"
127 128 129
#    Ensure that MO files do exist
#    Translators have to run make under webwml/<lang>/po if they
#    want it updated, it cannot be automatically performed.
130 131 132 133 134 135
$(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
136

137
$(OTHERDESTFILES): $(HTMLDIR)/%: %
138
	@test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR)
139
	install -m 664 -p $< $(HTMLDIR)
140
ifeq "$(LANGUAGE)" "en"
141
# probably doesn't work for *.gz files, FIXME
142
	[ -f "$(HTMLDIR)/$(basename $(basename $<))$(suffix $<)" ] || ln -s $< $(HTMLDIR)/$(basename $(basename $<))$(suffix $<)
143
endif
Josip Rodin's avatar
Josip Rodin committed
144 145

# template dependencies
146
$(TEMPLDIR)/%.wml:
147 148 149 150 151 152 153
ifeq "$(LANGUAGE)" "en"
	touch $@ # because of $(?F)
else
	@if [ "$(findstring .mo,$(?F))" = "" ]; then \
	  touch $@; echo "touch $@ # because of $(?F)"; \
	fi
endif
Josip Rodin's avatar
Josip Rodin committed
154

155
gendep:
156 157 158 159
	@for f in $(TEMPLDIR)/*.wml \
		  $(TEMPLDIR)/weeklynews/*.wml \
		  $(TEMPLDIR)/projectnews/*.wml; \
	do \
160
	  grep -q '^#use wml::debian' $$f || continue; \
161 162
	  ../gendep.pl "$$f" |\
	    sed -e 's,X$(TEMPLDIR),X\$$(TEMPLDIR),' |\
163
	    fold -b -s -w 70 |\
164
	    sed -e 's/^\$$/  \$$/' -e 's/^X//' -e 's/callX/call /g' -e '$$!s/$$/\\/'; \
165 166 167 168 169 170
	done

#  this dependency cannot be automatically computed
$(TEMPLDIR)/basic.wml: $(TEMPLDIR)/navbar.wml

#  dependencies below are generated by gendep and manually checked
171
$(TEMPLDIR)/basic.wml: $(TEMPLDIR)/common_translation.wml \
172 173 174
  $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/language_names.wml \
  $(TEMPLDIR)/footer.wml
$(TEMPLDIR)/blend.wml: $(TEMPLDIR)/template.wml
175 176
$(TEMPLDIR)/cdimage.wml: $(TEMPLDIR)/common_translation.wml \
  $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \
177 178
  $(TEMPLDIR)/links.tags.wml $(TEMPLDIR)/basic.wml \
  $(call locale,cdimage)
179 180
$(TEMPLDIR)/common_translation.wml: $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/consultant.wml: $(TEMPLDIR)/common_tags.wml \
181 182
  $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml \
  $(call locale,consultants)
183
$(TEMPLDIR)/countries.wml: $(TEMPLDIR)/common_tags.wml \
184
  $(call locale,countries)
185
$(TEMPLDIR)/ctime.wml: $(TEMPLDIR)/common_tags.wml \
186
  $(call locale,date)
187 188 189 190
$(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
191
$(TEMPLDIR)/events_common.wml: $(TEMPLDIR)/common_translation.wml \
192
  $(call locale,newsevents)
193
$(TEMPLDIR)/fixes_link.wml: $(TEMPLDIR)/common_tags.wml
194
$(TEMPLDIR)/footer.wml: $(TEMPLDIR)/ctime.wml \
195 196 197
  $(TEMPLDIR)/links.tags.wml $(TEMPLDIR)/common_tags.wml \
  $(TEMPLDIR)/release_info.wml
$(TEMPLDIR)/installer.wml: $(TEMPLDIR)/release_info.wml
198 199
$(TEMPLDIR)/language_names.wml: $(TEMPLDIR)/common_tags.wml \
  $(call locale,langs)
200
$(TEMPLDIR)/languages.wml: $(TEMPLDIR)/common_tags.wml \
201
  $(TEMPLDIR)/language_names.wml $(TEMPLDIR)/countries.wml
202 203 204
$(TEMPLDIR)/legal.wml: $(TEMPLDIR)/common_tags.wml \
  $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/languages.wml \
  $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/submenu.wml \
205
  $(TEMPLDIR)/legal_tags.wml $(TEMPLDIR)/basic.wml $(call locale,legal)
Frank Lichtenheld's avatar
Frank Lichtenheld committed
206 207 208
$(TEMPLDIR)/legal_lists.wml: $(TEMPLDIR)/ctime.wml \
  $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/legal_tags.wml
$(TEMPLDIR)/legal_tags.wml: $(TEMPLDIR)/common_tags.wml \
209
  $(TEMPLDIR)/common_translation.wml $(call locale,legal)
210 211 212
$(TEMPLDIR)/links.tags.wml: $(TEMPLDIR)/common_tags.wml
$(TEMPLDIR)/mainpage.wml: $(TEMPLDIR)/common_translation.wml \
  $(TEMPLDIR)/basic.wml $(TEMPLDIR)/links.tags.wml \
213
  $(TEMPLDIR)/languages.wml $(TEMPLDIR)/release_info.wml
214
$(TEMPLDIR)/navbar.wml: $(TEMPLDIR)/common_translation.wml \
215 216
  $(TEMPLDIR)/events_common.wml $(TEMPLDIR)/links.tags.wml \
  $(TEMPLDIR)/stats_tags.wml $(TEMPLDIR)/common_tags.wml
217 218
$(TEMPLDIR)/news.wml: $(TEMPLDIR)/common_translation.wml \
  $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \
219
  $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/basic.wml $(call locale,newsevents)
220 221
$(TEMPLDIR)/past_event.wml: $(TEMPLDIR)/events_common.wml \
  $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml
222 223 224
$(TEMPLDIR)/profiles.wml: $(TEMPLDIR)/common_translation.wml \
  $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/languages.wml \
  $(TEMPLDIR)/faqs.wml $(TEMPLDIR)/basic.wml
Frank Lichtenheld's avatar
Frank Lichtenheld committed
225 226
$(TEMPLDIR)/recent_list.wml: $(TEMPLDIR)/ctime.wml \
  $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/legal_tags.wml
227 228
$(TEMPLDIR)/recent_list_security.wml: $(TEMPLDIR)/ctime.wml \
  $(TEMPLDIR)/common_tags.wml $(TEMPLDIR)/recent_list_common.wml
229
$(TEMPLDIR)/release_images.wml: $(TEMPLDIR)/installer.wml \
230 231 232 233
  $(TEMPLDIR)/release_info.wml
$(TEMPLDIR)/release_info.wml: $(TEMPLDIR)/common_tags.wml \
  $(TEMPLDIR)/ctime.wml
$(TEMPLDIR)/release.wml: $(TEMPLDIR)/languages.wml
234 235 236
$(TEMPLDIR)/security.wml: $(TEMPLDIR)/common_tags.wml \
  $(TEMPLDIR)/common_translation.wml $(TEMPLDIR)/fixes_link.wml \
  $(TEMPLDIR)/languages.wml $(TEMPLDIR)/ctime.wml \
237 238
  $(TEMPLDIR)/securityreferences.wml $(TEMPLDIR)/basic.wml \
  $(call locale,security)
239
$(TEMPLDIR)/speakers.wml: $(TEMPLDIR)/common_tags.wml \
240
  $(TEMPLDIR)/basic.wml $(TEMPLDIR)/languages.wml \
241 242 243
  $(call locale,newsevents)
$(TEMPLDIR)/stats_tags.wml: $(TEMPLDIR)/common_tags.wml \
  $(call locale,stats)
244 245 246 247
$(TEMPLDIR)/template.wml: $(TEMPLDIR)/basic.wml \
  $(TEMPLDIR)/languages.wml
$(TEMPLDIR)/translation-check.wml: $(TEMPLDIR)/languages.wml \
  $(TEMPLDIR)/common_tags.wml
248
$(TEMPLDIR)/url.wml: $(TEMPLDIR)/common_tags.wml
249 250 251 252
$(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
253
$(TEMPLDIR)/votebar.wml: $(TEMPLDIR)/languages.wml \
254 255
  $(TEMPLDIR)/common_tags.wml $(call locale,vote)
$(TEMPLDIR)/wnpp.wml: $(TEMPLDIR)/common_tags.wml $(call locale,wnpp)
256 257
$(TEMPLDIR)/weeklynews/footer.wml: $(TEMPLDIR)/common_tags.wml \
  $(call locale,newsevents)
258
$(TEMPLDIR)/weeklynews/header.wml: $(TEMPLDIR)/common_tags.wml \
259 260
  $(TEMPLDIR)/ctime.wml $(TEMPLDIR)/links.tags.wml \
  $(TEMPLDIR)/template.wml
261 262 263 264 265 266 267
$(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
268

David Prévot's avatar
David Prévot committed
269
$(TEMPLDIR)/navbar.wml: $(ENGLISHSRCDIR)/logos/openlogo-nd-50.png
270 271 272 273 274

$(TEMPLDIR)/votebar.wml: $(ENGLISHSRCDIR)/Pics/blue-upperleft.png \
  $(ENGLISHSRCDIR)/Pics/blue-upperright.png \
  $(ENGLISHSRCDIR)/Pics/blue-lowerleft.png \
  $(ENGLISHSRCDIR)/Pics/blue-lowerright.png
Josip Rodin's avatar
Josip Rodin committed
275 276 277 278

.SUFFIXES: 
.PHONY: all $(existing-SUBS) install $(existing-SUBS-install)
.PHONY: clean $(existing-SUBS-clean) cleandest $(existing-SUBS-cleandest)