davadmin/Makefile
Jan Dittberner a978fb5ef0 addresses #17
* Makefile creates/updates po/davadmin.pot, .po, and .mo files
 * admin/i18n.inc.php sets the locale and puts it in the session
 * admin/common.inc.php and admin/getgroups.php use admin/i18n.inc.php
 * po/pot.sed replaces generated header of po/davadmin.pot
2007-11-30 21:25:52 +00:00

93 lines
2.5 KiB
Makefile

# Makefile for DAVAdmin
#
# @author Jan Dittberner <jan@dittberner.info>
# @version $Id$
# @license GPL
# @package DAVAdmin
#
# Copyright (c) 2007 Jan Dittberner
#
# This file is part of DAVAdmin.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
VERSION := 0.2
PROJECT := davadmin
SRCFILES := $(wildcard admin/*.php)
APISRC := $(SRCFILES:,= )
TEMPDIR := $(shell mktemp -t -d davadmin.XXXXXXXXXX)
XSRCFILES := $(patsubst %,$(TEMPDIR)/%,$(SRCFILES))
TRANSLANG := de
POSRC := po
POFILES := $(foreach lang,$(TRANSLANG),$(POSRC)/$(lang).po)
MOFILES := $(patsubst %.po,%.mo,$(POFILES))
POT=$(POSRC)/$(PROJECT).pot
.PHONY: all
all: $(POT) $(MOFILES) $(TEMPDIR)/delete
$(MOFILES): %.mo: %.po
@echo "msgfmt: $@"
msgfmt -o$@ $<
$(POFILES): %: $(POT)
@echo "msgmerge: $@"
msgmerge -U $@ $(POT)
touch $@
$(POT): $(XSRCFILES) po/pot.sed
@echo "xgettext: $@"
cd $(TEMPDIR) && \
xgettext --default-domain=$(PROJECT) --language=php \
--from-code=UTF-8 \
--msgid-bugs-address="jan@dittberner.info" -o- $(SRCFILES) \
| sed -f $(CURDIR)/po/pot.sed \
> $(CURDIR)/$@
for pofile in $(POFILES); do \
if test ! -f $(CURDIR)/$${pofile}; then \
cp $(CURDIR)/$@ $(CURDIR)/$${pofile}; \
fi; \
done
.INTERMEDIATE: $(XSRCFILES)
$(XSRCFILES): $(TEMPDIR)/%: %
@echo "processing: $<"
mkdir -p $(@D)
cp $< $@
$(TEMPDIR)/delete:
rm -rf $(TEMPDIR)
.PHONY: apidoc
apidoc:
if [ -d apidoc ]; then rm -r apidoc; fi
phpdoc -f $(APISRC) -t apidoc --undocumentedelements on -s
.PHONY: clean distclean
clean: $(TEMPDIR)/delete
find -name '*~' -type f -exec rm {} \;
distclean: clean
if [ -d apidoc ]; then rm -r apidoc; fi
RELPREFIX := $(PROJECT)-$(VERSION)
dist: distclean
cd .. ; if test ! -d $(RELPREFIX); then \
ln -s trunk $(RELPREFIX)-dev; \
tar czh --exclude=.svn -f $(RELPREFIX)-dev.tar.gz $(RELPREFIX)-dev; \
rm -f $(RELPREFIX)-dev; \
else \
tar czhf $(PROJECT)-$(VERSION).tar.gz $(PROJECT)-$(VERSION); \
fi