# Makefile # # This is a sample Makfile for generating necessary infrastructure for # languages. It is not necessarily the most pretty thing you have ever # seen and I'm sure there are a gazillion better ways to do all of this. # # This file is used here in accordance with the GNU GPL which is copied in the # COPYING file accompanying this file. # # Copyright 2006, Creative Commons. # Copyright 2006, Jon Phillips. # # TODO: There is still a problem becuase the make generates new # po files on every make all becuase I think they are being # generated by the exteranl update script. # # TODO: If there is a POFILE that we want and it doesn't exist, then this # script should copy the master pot file to that location and wait for # further instruction. even better would be to have a default master po # file that already has a users comments in it and then copy that to any # folders where the po is expected, but doesn't exist. BE CAREFUL TO NOT # TO OVERWRITE ones tha already exist. This will solve the case of # when one changes the appname for what the requested PO files are being # updated. # # TODO: Make this script all generic so that it can simply be included # in other makefiles so that it can exist alongside other installs # simply. Then it will be more modular, etc. # srcdir = . # add your own unique folders here and to the POFILES and CATALOGS # list if you have different translations for your site localedir = locale/default # testlocaledir = locale/cchost.localhost APPNAME = cchost POTFILE = $(APPNAME).pot PO_NAME = LC_MESSAGES/$(APPNAME).po MO_NAME = LC_MESSAGES/$(APPNAME).mo POFILES = \ $(localedir)/pt_BR/$(PO_NAME) \ $(localedir)/zh_CN/$(PO_NAME) \ $(localedir)/zh_TW/$(PO_NAME) \ $(localedir)/de_DE/$(PO_NAME) \ $(localedir)/it_IT/$(PO_NAME) \ $(localedir)/vi/$(PO_NAME) \ $(localedir)/fr_FR/$(PO_NAME) #$(testlocaledir)/pt_BR/$(PO_NAME) \ #$(testlocaledir)/zh_CN/$(PO_NAME) # $(localedir)/de_DE/$(PO_NAME) \ # $(localedir)/zh_CN/$(PO_NAME) # $(testlocaledir)/en_US/$(PO_NAME) \ # $(testlocaledir)/de_DE/$(PO_NAME) \ # $(testlocaledir)/zh_CN/$(PO_NAME) \ # POTFILES = \ # index.php \ # test1.php # NOTE: Trying to cut down work here by generating the POTFILES.in # so that it can just be included with the variable, POTFILES containing # what is needed include POTFILES CATALOGS = \ $(localedir)/pt_BR/$(MO_NAME) \ $(localedir)/zh_CN/$(MO_NAME) \ $(localedir)/zh_TW/$(MO_NAME) \ $(localedir)/de_DE/$(MO_NAME) \ $(localedir)/it_IT/$(MO_NAME) \ $(localedir)/vi/$(MO_NAME) \ $(localedir)/fr_FR/$(MO_NAME) # $(testlocaledir)/pt_BR/$(MO_NAME) \ #$(testlocaledir)/zh_CN/$(MO_NAME) # $(localedir)/de_DE/$(MO_NAME) \ # $(localedir)/zh_CN/$(MO_NAME) \ # $(testlocaledir)/en_US/$(MO_NAME) \ # $(testlocaledir)/de_DE/$(MO_NAME) \ # $(testlocaledir)/zh_CN/$(MO_NAME) \ # $(ccexplocaledir)/en_US/$(MO_NAME) \ # $(ccexplocaledir)/de_DE/$(MO_NAME) \ # $(ccexplocaledir)/zh_CN/$(MO_NAME) INSTALL = /usr/bin/install -c INSTALL_DATA = $(INSTALL) -m 644 GMSGFMT = /usr/bin/gmsgfmt MSGFMT = /usr/bin/msgfmt XGETTEXT = /usr/bin/xgettext -n XGETTEXT_PHP = $(XGETTEXT) -L PHP UPDATE_PO_SCRIPT = ./bin/update_po_files.sh all: $(POTFILE) $(POTFILES) $(CATALOGS) # before had: all: $(POTFILE) $(POTFILES) $(POFILES) $(CATALOGS) update-po-files: $(UPDATE_PO_SCRIPT) create-pot: $(XGETTEXT_PHP) $(POTFILES) -o $(POTFILE) clean: rm -f $(CATALOGS) rm -f $(POTFILE) @# do not delete POFILES (only the main POTFILE which is generated) clean-all: clean-mo @#find . -depth -name "*.mo" -type f -exec rm -Rf {} \; @#find . -depth -name "*.gmo" -type f -exec rm -Rf {} \; clean-mo: rm -f $(CATALOGS) $(POTFILES): update-po-files $(POTFILE): create-pot $(POFILES): update-po-files $(CATALOGS): $(MSGFMT) `dirname $@`/`basename $@ mo`po -o $@ .po.mo: $(MSGFMT) -o $@ $< # POTFILES is created from POTFILES.in by stripping comments, empty lines # and Intltool tags (enclosed in square brackets), and appending a full # relative path to them # # OLD: POTFILES: POTFILES.in POTFILES: ( posrcprefix='$(top_srcdir)/'; \ rm -f $@-t $@ \ && (sed -e '/^#/d' \ -e 's/^[[].*] *//' \ -e '/^[ ]*$$/d' \ -e "s@^@ $$posrcprefix@" $(srcdir)/$@.in \ | sed -e '$$!s/$$/ \\/') > $@-t \ && chmod a-w $@-t \ && mv $@-t $@ )