3 # $Id: update-makefile.sh,v 1.5 2002-01-18 01:32:52 dairiki Exp $
5 # This shell script is used to update the list of .po files and the
6 # dependencies for phpwiki.pot in the Makefile.
8 # Do not invoke this script directly, rather run:
12 # to update the Makefile.
15 # Generate the head (manually-edited part) of the new Makefile
18 sed '/^# DO NOT DELETE THIS LINE$/,$ d' Makefile && cat <<'EOF'
19 # DO NOT DELETE THIS LINE
21 # The remainder of this file is auto-generated
23 # (Run 'make dep' to regenerate this section.)
28 # Find all .po files in po/.
31 find po -name "*.po" |
34 s|^.*/\(.*\)\.po$|mo: \1/LC_MESSAGES/phpwiki.mo \1/LC_MESSAGES/phpwiki.php|;'
37 # Find all .php and .html source code which should be scanned
38 # by xgettext() for localizeable strings.
39 # find ../lib fails on cygwin
41 (cd ..; find lib templates themes \( -name "*.php" -o -name "*.tmpl" \)) |
42 sed 's|^|${POT_FILE}: ../|;' |
46 # Generate the new Makefile
50 pot_file_deps; } > Makefile.new || exit 1
52 if diff -q Makefile Makefile.new > /dev/null
54 # Don't touch the Makefile if unchanged.
55 # (This avoids updating the timestamp)
57 echo "Makefile unchanged" 1>&2
61 mv Makefile.new Makefile && echo "Makefile updated" 1>&2