# Makefile for DAVAdmin # # @author Jan Dittberner # @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) SRCFILES += $(wildcard admin/scripts/*.php) JSFILES := admin/scripts/autocomplete.js admin/scripts/directories.js \ admin/scripts/users.js APISRC := $(shell echo $(SRCFILES) | sed 's/ /,/g' ) TEMPDIR := $(shell mktemp -t -d davadmin.XXXXXXXXXX) XSRCFILES := $(patsubst %,$(TEMPDIR)/%,$(SRCFILES)) XJSFILES := $(patsubst %,$(TEMPDIR)/%,$(JSFILES)) TRANSLANG := de POSRC := po POFILES := $(foreach lang,$(TRANSLANG),$(POSRC)/$(lang)/LC_MESSAGES/$(PROJECT).po) JSPOFILES := $(foreach lang,$(TRANSLANG),$(POSRC)/$(lang)/LC_MESSAGES/$(PROJECT)js.po) MOFILES := $(patsubst %.po,%.mo,$(POFILES)) JSMOFILES := $(patsubst %.po,%.mo,$(JSPOFILES)) POT=$(POSRC)/$(PROJECT).pot JSPOT=$(POSRC)/$(PROJECT)js.pot JSTRANS=$(POSRC)/transjs.txt .PHONY: all all: $(POT) $(JSPOT) $(JSTRANS) $(MOFILES) $(JSMOFILES) $(TEMPDIR)/delete $(MOFILES) $(JSMOFILES): %.mo: %.po @echo "msgfmt: $@" msgfmt -o$@ $< $(POFILES): %: $(POT) @echo "msgmerge: $@" msgmerge -U $@ $(POT) touch $@ $(JSPOFILES): %: $(JSPOT) @echo "msgmerge: $@" msgmerge -U $@ $(JSPOT) 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 $(JSPOT): $(XJSFILES) po/jspot.sed @echo "xgettext: $@" cd $(TEMPDIR) && \ xgettext --default-domain=$(PROJECT)js --language=Java \ --from-code=UTF-8 --keyword="intl.translate" \ --msgid-bugs-address="jan@dittberner.info" -o- $(JSFILES) \ | sed -f $(CURDIR)/po/jspot.sed \ > $(CURDIR)/$@ for pofile in $(JSPOFILES); do \ if test ! -f $(CURDIR)/$${pofile}; then \ cp $(CURDIR)/$@ $(CURDIR)/$${pofile}; \ fi; \ done $(JSTRANS): $(XJSFILES) @echo "generate table of translatable string: $@" cd $(TEMPDIR) && \ xgettext --default-domain=$(PROJECT)js --language=Java \ --from-code=UTF-8 \ --omit-header --keyword="intl.translate" --properties-output \ --no-location -o- $(JSFILES) \ | awk '/^!.+=$$/ { print }' \ | sed 's,.\(.*\)=,\1,g; s,\\=,=,g; s,\\ , ,g' \ > $(CURDIR)/$@ .INTERMEDIATE: $(XSRCFILES) $(XJSFILES) $(XSRCFILES): $(TEMPDIR)/%: % @echo "processing: $<" mkdir -p $(@D) cp $< $@ $(XJSFILES): $(TEMPDIR)/%: % @echo "processing: $<" mkdir -p $(@D) cp $< $@ $(TEMPDIR)/delete: rm -rf $(TEMPDIR) .PHONY: apidoc apidoc: if [ -d apidoc ]; then rm -r apidoc; fi phpdoc -ue on -f $(APISRC) -t apidoc -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