# 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/testsite.org #ccexplocaledir = locale/ccexperimental.localhost APPNAME = ccsearch POTFILE = $(APPNAME).pot PO_NAME = LC_MESSAGES/$(APPNAME).po MO_NAME = LC_MESSAGES/$(APPNAME).mo POFILES = \ $(localedir)/af/$(PO_NAME) \ $(localedir)/en_US/$(PO_NAME) \ $(localedir)/zh_CN/$(PO_NAME) \ $(localedir)/zh_TW/$(PO_NAME) \ $(localedir)/ja/$(PO_NAME) #$(testlocaledir)/en_US/$(PO_NAME) \ $(testlocaledir)/de_DE/$(PO_NAME) \ $(testlocaledir)/zh_CN/$(PO_NAME) \ $(ccexplocaledir)/en_US/$(PO_NAME) \ $(ccexplocaledir)/de_DE/$(PO_NAME) \ $(ccexplocaledir)/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 # $(MAKE) POTFILES.in include POTFILES CATALOGS = \ $(localedir)/en_US/$(MO_NAME) \ $(localedir)/af/$(MO_NAME) \ $(localedir)/zh_TW/$(MO_NAME) \ $(localedir)/zh_CN/$(MO_NAME) \ $(localedir)/ja/$(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 UPDATE_PO_SCRIPT = ./bin/update_po_files.sh # NOTE: if POTFILES directive is working, add first to make all all: $(POTFILES) $(POTFILE) $(CATALOGS) echo "All, okay." just_mo: $(CATALOGS) echo "Just mo!" # before had: all: $(POTFILE) $(POTFILES) $(POFILES) $(CATALOGS) update-po-files: $(UPDATE_PO_SCRIPT) locale $(POTFILE): $(POTFILES) $(XGETTEXT) $(POTFILES) -o $(POTFILE) clean: rm -f $(CATALOGS) rm -f $(POTFILE) 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) check: echo $(POFILES) echo $(CATALOGS) # POTFILE: update-po-files #$(POTFILE): create-pot #$(POFILES): update-po-files #$(CATALOGS): # $(MSGFMT) `dirname $@`/`basename $@ mo`po -o $@ %.mo: %.po $(MSGFMT) -o $*.mo $*.po %.po: $(POTFILE) cp $*.po $*.po.old && \ msgmerge $*.po.old ccsearch.pot >> $*.po.tmp && \ mv -f $*.po.tmp $*.po # NOTE: This is disabled currently. # # 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 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 \ && echo -e 'POTFILES = \' `cat $@-t` > $@ \ && rm -f $@-t )