Blame testpage/Makefile

b189b7
###############################################################################
b189b7
#
b189b7
#  The Apache HTTP server test page Makefile
b189b7
#  Copyright (C) 2019  Alain Reguera Delgado
b189b7
#
b189b7
#  This program is free software: you can redistribute it and/or modify it
b189b7
#  under the terms of the GNU General Public License as published by the Free
b189b7
#  Software Foundation, either version 3 of the License, or (at your option)
b189b7
#  any later version.
b189b7
#
b189b7
#  This program is distributed in the hope that it will be useful, but WITHOUT
b189b7
#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b189b7
#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
b189b7
#  more details.
b189b7
#
b189b7
#  You should have received a copy of the GNU General Public License along with
b189b7
#  this program.  If not, see <https: www.gnu.org="" licenses=""/>.
b189b7
#
b189b7
###############################################################################
b189b7
b189b7
#==============================================================================
b189b7
# Configuration
b189b7
#==============================================================================
b189b7
lang = en_US
b189b7
prefix = .
b189b7
srcdir = .
b189b7
datarootdir = $(prefix)/$(lang)
b189b7
localedir = PO
b189b7
b189b7
#==============================================================================
b189b7
# Requirements
b189b7
#==============================================================================
b189b7
all: $(datarootdir)/index.html
b189b7
b189b7
#======================================================================
b189b7
# Translations
b189b7
#======================================================================
b189b7
$(localedir)/$(lang).pot: $(srcdir)/index.tpl.html
b189b7
	xml2po -o /tmp/$(lang).pot $(srcdir)/index.tpl.html
b189b7
	if [[ ! -f $(localedir)/$(lang).pot ]];then \
b189b7
		msginit -i /tmp/$(lang).pot -o $(localedir)/$(lang).pot -l $(lang) --no-translator --width=80; \
b189b7
	else \
b189b7
		msgmerge -U $(localedir)/$(lang).pot /tmp/$(lang).pot; \
b189b7
	fi
b189b7
	rm /tmp/$(lang).pot
b189b7
$(localedir)/$(lang).po: $(localedir)/$(lang).pot
b189b7
	if [[ ! -f $(localedir)/$(lang).po ]];then \
b189b7
		msginit -i $(localedir)/$(lang).pot -o $(localedir)/$(lang).po -l $(lang) --no-translator --width=80; \
b189b7
	else \
b189b7
		msgmerge -U $(localedir)/$(lang).po $(localedir)/$(lang).pot; \
b189b7
	fi
b189b7
b189b7
#======================================================================
b189b7
# Pages
b189b7
#======================================================================
b189b7
$(datarootdir):
b189b7
	mkdir -p $(datarootdir)
b189b7
$(datarootdir)/index.html: $(datarootdir) $(localedir)/$(lang).po $(srcdir)/index.tpl.html
b189b7
	xmllint -noout $(srcdir)/index.tpl.html
b189b7
	xml2po -p $(localedir)/$(lang).po -o $(datarootdir)/index.html $(srcdir)/index.tpl.html