5 # This file contains support code from Makefile.common
6 # It defines a shell function for each known target
7 # and then does a case to call the correct function.
9 call_and_fix_autoconf
()
12 if test -r configure.
in.
in ; then
13 perl
-pi -e "print \"if test \\\"x\\\$with_fast_perl\\\" = \\\"xyes\\\"; then\
14 \\n perl -i.bak \\\$ac_aux_dir/conf.change.pl \\\$CONFIG_STATUS\
15 \\\\\\n || mv \\\$CONFIG_STATUS.bak \\\$CONFIG_STATUS\
16 \\n rm -f \\\$CONFIG_STATUS.bak\\nfi\
17 \\n\" if /^\\s*chmod\\s+.*\\+x\\s+.*CONFIG_STATUS/; s,^#line.*LINENO.*\$,/* \$& */, ;" configure
23 if test ! -f $makefile_wo; then
24 perl
-e '$in=0; while ( <> ) { $in = 1 if ($_ =~ m/^if / ); print $_ unless ($in || $_ =~ m/^include /); $in = 0 if ($_ =~ m/^endif/); }' < $makefile_am > $makefile_wo
28 check_autotool_versions
()
30 required_autoconf_version
="2.53 or newer"
31 AUTOCONF_VERSION
=`$AUTOCONF --version | head -n 1`
32 case $AUTOCONF_VERSION in
33 Autoconf
*2.5* | autoconf
*2.5* | autoconf
*2.6* ) : ;;
35 echo "*** AUTOCONF NOT FOUND!."
36 echo "*** KDE requires autoconf $required_autoconf_version"
40 echo "*** YOU'RE USING $AUTOCONF_VERSION."
41 echo "*** KDE requires autoconf $required_autoconf_version"
46 AUTOHEADER_VERSION
=`$AUTOHEADER --version | head -n 1`
47 case $AUTOHEADER_VERSION in
48 Autoconf
*2.5* | autoheader
*2.5* | autoheader
*2.6* ) : ;;
50 echo "*** AUTOHEADER NOT FOUND!."
51 echo "*** KDE requires autoheader $required_autoconf_version"
55 echo "*** YOU'RE USING $AUTOHEADER_VERSION."
56 echo "*** KDE requires autoheader $required_autoconf_version"
61 AUTOMAKE_STRING
=`$AUTOMAKE --version | head -n 1`
62 required_automake_version
="1.6.1 or newer"
63 case $AUTOMAKE_STRING in
64 automake
*1.5d
* | automake
*1.5* | automake
*1.5-* )
65 echo "*** YOU'RE USING $AUTOMAKE_STRING."
66 echo "*** KDE requires automake $required_automake_version"
69 automake
*1.6.
* | automake
*1.
[789]* ) : ;;
71 echo "*** AUTOMAKE NOT FOUND!."
72 echo "*** KDE requires automake $required_automake_version"
76 echo "*** YOU'RE USING UNSERMAKE."
77 echo "*** GOOD LUCK!! :)"
80 echo "*** YOU'RE USING $AUTOMAKE_STRING."
81 echo "*** KDE requires automake $required_automake_version"
85 unset required_automake_version
90 check_autotool_versions
93 ### Make new subdirs and configure.in.
94 ### The make calls could be optimized away here,
95 ### with a little thought.
96 if test -r configure.
in.
in; then
98 echo "*** Creating list of subdirectories"
101 if test -r Makefile.am.
in; then
102 echo "*** Creating Makefile.am"
103 if grep '\$(top_srcdir)/Makefile.am:' $makefile_am >/dev
/null
; then
105 $MAKE -f $makefile_wo top_srcdir
=. .
/Makefile.am ||
exit 1
111 echo "*** Creating configure.in"
112 if grep '\$(top_srcdir)/configure.in:' $makefile_am >/dev
/null
; then
114 $MAKE -f $makefile_wo top_srcdir
=. .
/configure.
in ||
exit 1
120 echo "*** Creating aclocal.m4"
121 $ACLOCAL $ACLOCALFLAGS ||
exit 1
122 echo "*** Creating configure"
123 call_and_fix_autoconf
125 if egrep "^AM_CONFIG_HEADER" configure.
in >/dev
/null
2>&1; then
126 echo "*** Creating config.h template"
127 $AUTOHEADER ||
exit 1
130 echo "*** Creating Makefile templates"
132 if test -z "$UNSERMAKE"; then
133 echo "*** Postprocessing Makefile templates"
134 perl
-w admin
/am_edit ||
exit 1
137 if egrep "^cvs-local:" $makefile_am >/dev
/null
; then \
139 $MAKE -f $makefile_wo cvs-local top_srcdir
=. ||
exit 1
142 echo "*** Creating date/time stamp"
146 echo " Don't forget to run ./configure"
147 echo " If you haven't done so in a while, run ./configure --help"
152 check_autotool_versions
155 ### First build all of the files necessary to do just "make"
158 if test -r configure.
in.
in; then
162 if test -r Makefile.am.
in; then
163 if grep '\$(top_srcdir)/Makefile.am:' $makefile_am >/dev
/null
; then
165 $MAKE -f $makefile_wo top_srcdir
=. .
/Makefile.am ||
exit 1
171 if grep '\$(top_srcdir)/configure.in:' $makefile_am >/dev
/null
; then
173 $MAKE -f $makefile_wo top_srcdir
=. .
/configure.
in ||
exit 1
178 $ACLOCAL $ACLOCALFLAGS
179 if egrep "^AM_CONFIG_HEADER" configure.
in >/dev
/null
2>&1; then
180 echo "*** Creating config.h template"
181 $AUTOHEADER ||
exit 1
184 perl
-w admin
/am_edit
185 call_and_fix_autoconf
187 if grep "^cvs-local:" $makefile_am >/dev
/null
; then
189 $MAKE -f $makefile_wo cvs-local top_srcdir
=.
193 ### Then make messages
196 LIST
=`find ./po -name "*.po"`
198 file2
=`echo $i | sed -e "s#\.po#\.gmo#"`
199 msgfmt
-o $file2 $i ||
touch $file2
202 if grep "^cvs-dist-local:" $makefile_am >/dev
/null
; then
204 $MAKE -f $makefile_wo cvs-dist-local top_srcdir
=.
210 $ACLOCAL $ACLOCALFLAGS
213 perl
-w ..
/admin
/am_edit
--path=..
/admin
214 call_and_fix_autoconf
220 rm -f configure.
in configure.
in.new
222 test -f configure.files ||
{ echo "need configure.files for configure.in"; exit 1; }
223 list
=`fgrep -v "configure.in.bot" < configure.files | fgrep -v "configure.in.mid"`
225 for file in $list; do
226 echo "dnl =======================================================" >> configure.
in.new
227 echo "dnl FILE: $file" >> configure.
in.new
228 echo "dnl =======================================================" >> configure.
in.new
229 echo "" >> configure.
in.new
230 cat $file >> configure.
in.new
232 echo "KDE_CREATE_SUBDIRSLIST" >> configure.
in.new
233 if test -f Makefile.am.
in; then
234 subdirs
=`cat subdirs`
235 for dir
in $subdirs; do
236 dir
=`echo $dir | sed -e "s,[-+.],_,g"`
237 echo "AM_CONDITIONAL($dir""_SUBDIR_included, test \"x\$$dir""_SUBDIR_included\" = xyes)" >> configure.
in.new
238 if test -f $dir/configure.
in; then
239 echo "if test \"x\$$dir""_SUBDIR_included\" = xyes; then " >> configure.
in.new
240 echo " AC_CONFIG_SUBDIRS($dir)" >> configure.
in.new
241 echo "fi" >> configure.
in.new
246 echo "AC_CONFIG_FILES([ Makefile ])" >> configure.
in.new
247 if test -n "$UNSERMAKE"; then
248 echo "AC_CONFIG_FILES([ Makefile.rules ])" >> configure.
in.new
249 echo "AC_CONFIG_FILES([ Makefile.calls ])" >> configure.
in.new
252 if test -f inst-apps
; then
253 topleveldirs
=`cat inst-apps`
256 for dir
in `ls -1d * | sort`; do
257 if test "$dir" != "debian" && test -d $dir; then
258 topleveldirs
="$topleveldirs $dir"
263 for topleveldir
in $topleveldirs; do
264 if test -f $topleveldir/configure.
in; then
267 if test -f $topleveldir/Makefile.am
; then :; else
271 mfs
=`find $topleveldir -name Makefile.am -print | fgrep -v "/." | \
272 sed -e 's#\./##; s#/Makefile.am$##' | sort | sed -e 's#$#/Makefile#'`
274 echo "AC_CONFIG_FILES([ $i ])" >> configure.
in.new
275 if test -n "$UNSERMAKE"; then
276 echo "AC_CONFIG_FILES([ $i.rules ])" >> configure.
in.new
277 echo "AC_CONFIG_FILES([ $i.calls ])" >> configure.
in.new
282 files
=`cat configure.files`
283 list
=`egrep '^dnl AC_OUTPUT\(.*\)' $files | sed -e "s#^.*dnl AC_OUTPUT(\(.*\))#\1#"`
284 for file in $list; do
285 echo "AC_CONFIG_FILES([ $file ])" >> configure.
in.new
288 if test -n "$UNSERMAKE"; then
289 echo "AC_CONFIG_FILES([ MakeVars ])" >> configure.
in.new
292 midfiles
=`cat configure.files | fgrep "configure.in.mid"`
293 test -n "$midfiles" && cat $midfiles >> configure.
in.new
295 echo "AC_OUTPUT" >> configure.
in.new
297 if test -f configure.
in.
in; then
298 if head -n 2 configure.
in.
in |
egrep "^#MIN_CONFIG\(.*\)$" > /dev
/null
; then
299 kde_use_qt_param
=`cat configure.in.in | sed -n -e "s/#MIN_CONFIG(\(.*\))/\1/p"`
301 if head -n 2 configure.
in.
in |
egrep "^#MIN_CONFIG" > /dev
/null
; then
302 line
=`grep "^AM_INIT_AUTOMAKE(" configure.in.in`
303 if test -n "$line"; then
304 modulename
=`echo $line | sed -e "s#AM_INIT_AUTOMAKE(\([^,]*\),.*#\1#"`
305 VERSION
=`echo $line | sed -e "s#AM_INIT_AUTOMAKE([^,]*, *\([^)]*\)).*#\1#"`
307 sed -e "s#AM_INIT_AUTOMAKE([^@].*#dnl PACKAGE set before#" \
308 configure.
in.new
> configure.
in && mv configure.
in configure.
in.new
311 if test -z "$VERSION" ||
test "$VERSION" = "@VERSION@"; then
314 if test -z "$modulename" ||
test "$modulename" = "@MODULENAME@"; then
316 modulename
=`basename $modulename`
317 esc_VERSION
=`echo $VERSION | sed -e "s#[^.0-9a-zA-Z]##g"`
318 modulename
=`echo $modulename | sed -e "s#-$esc_VERSION##"`
321 if test -n "$kde_use_qt_param"; then
322 sed -e "s#^dnl KDE_USE_QT#KDE_USE_QT($kde_use_qt_param)#" \
323 configure.
in.new
> configure.
in && mv configure.
in configure.
in.new
325 sed -e "s#@MODULENAME@#$modulename#" configure.
in.new |
326 sed -e "s#@VERSION@#$VERSION#" > configure.
in
327 botfiles
=`cat configure.files | egrep "configure.in.bot"`
328 test -n "$botfiles" && cat $botfiles >> configure.
in
329 cat $admindir/configure.
in.bot.end
>> configure.
in
330 rm -f configure.
in.new
335 echo "*** Creating configure.files"
337 for i
in . .. ..
/.. ..
/..
/..
; do
338 if test -x $i/admin
; then admindir
=$i/admin
; break; fi
340 rm -f configure.files
341 touch configure.files
342 if test -f configure.
in.
in && head -n 2 configure.
in.
in |
grep "^#MIN_CONFIG" > /dev
/null
; then
343 echo $admindir/configure.
in.min
>> configure.files
345 test -f configure.
in.
in && echo configure.
in.
in >> configure.files
346 # we collect files in the subdirs and do some sorting tricks, so subsubdirs come after subdirs
347 if test -f inst-apps
; then
351 list
="$list `find $i/ -name "configure.
in.
in" -o -name "configure.
in.bot
" -o -name "configure.
in.mid
" | \
352 sed -e "s
,/configure
,/aaaconfigure
," | sort | sed -e "s
,/aaaconfigure
,/configure
,"`"
355 list
=`find . -name "configure.in.in" -o -name "configure.in.bot" -o -name "configure.in.mid" | \
356 sed -e "s,/configure,/aaaconfigure," | sort | sed -e "s,/aaaconfigure,/configure,"`
358 for i
in $list; do if test -f $i && test `dirname $i` != "." ; then
359 echo $i >> configure.files
361 test -f configure.
in.mid
&& echo configure.
in.mid
>> configure.files
362 test -f configure.
in.bot
&& echo configure.
in.bot
>> configure.files
363 if test ! -s configure.files
; then
364 echo "There are no files to build a configure. Please check your checkout."
371 if grep '\$(top_srcdir)/subdirs:' $makefile_am >/dev
/null
; then
372 # as many modules contain rules to create subdirs without any
373 # dependencies make won't create it unless there is no file.
374 # so we check if that's a dummy rule or one that works
375 rm -f subdirs.cvs.sh.$$
376 if test -f subdirs
; then
377 mv subdirs subdirs.cvs.sh.$$
380 $MAKE -f $makefile_wo top_srcdir
=. .
/subdirs ||
exit 1
381 if test -f subdirs.cvs.sh.$$
; then
382 if test -s subdirs
; then
385 mv subdirs.cvs.sh.$$ subdirs
397 if test -f inst-apps
; then
398 idirs
=`cat inst-apps`
403 compilefirst
=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' $makefile_am | head -n 1`
404 compilelast
=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' $makefile_am | head -n 1`
406 if test -f $i/Makefile.am
; then
407 case " $compilefirst $compilelast " in
416 for d
in $compilefirst; do
417 echo $d >> .
/_SUBDIRS
421 list
=`sed -ne "s#^COMPILE_BEFORE_$d""[ ]*=[ ]*##p" $makefile_am | head -n 1`
425 list
=`sed -ne "s#^COMPILE_AFTER_$d""[ ]*=[ ]*##p" $makefile_am | head -n 1`
430 done ) |
tsort >> .
/_SUBDIRS
432 for d
in $compilelast; do
433 echo $d >> .
/_SUBDIRS
436 if test -r subdirs
&& cmp -s subdirs _SUBDIRS
; then
439 test -r _SUBDIRS
&& mv _SUBDIRS subdirs || true
444 if test -f Makefile.am.
in; then
445 compilefirst
=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' $makefile_am | head -n 1`
446 compilelast
=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' $makefile_am | head -n 1`
450 if test -f inst-apps
; then
451 idirs
=`cat inst-apps`
456 case " $compilefirst $compilelast " in
462 if test -n "$UNSERMAKE"; then
463 cat Makefile.am.
in > Makefile.am
465 for i
in $compilefirst $dirs $compilelast; do
466 vari
=`echo $i | sed -e "s,[-+],_,g"`
467 echo "if $vari""_SUBDIR_included" >> Makefile.am
468 echo "$vari""_SUBDIR=$i" >> Makefile.am
469 echo "endif" >> Makefile.am
470 topsubdirs
="$topsubdirs \$($vari""_SUBDIR)"
472 echo "SUBDIRS=$topsubdirs" >> Makefile.am
474 cat Makefile.am.
in | \
475 sed -e 's,^\s*\(COMPILE_BEFORE.*\),# \1,' | \
476 sed -e 's,^\s*\(COMPILE_AFTER.*\),# \1,' > Makefile.am
477 echo "SUBDIRS="'$(TOPSUBDIRS)' >> Makefile.am
484 echo "*** Creating acinclude.m4"
486 if grep '\$(top_srcdir)/acinclude.m4:' $makefile_am >/dev
/null
; then
489 $MAKE -f $makefile_wo top_srcdir
=. .
/acinclude.
m4 ||
exit 1
490 adds
=`grep '\$(top_srcdir)/acinclude.m4:' $makefile_wo | sed -e 's,^[^:]*: *,,; s,\$(top_srcdir),.,g'`
494 # if it wasn't created up to now, then we do it better
495 if test ! -f acinclude.
m4; then
496 cat admin
/acinclude.
m4.
in admin
/libtool.
m4.
in $adds > acinclude.
m4
502 if test -d CVS
; then :; else
503 echo "You don't have a toplevel CVS directory."
504 echo "You most certainly didn't use cvs to get these sources."
505 echo "But this function depends on cvs's information."
508 perl
$admindir/cvs-clean.pl
514 for cat in $catalogs; do
515 msgmerge
-o $cat.new
$cat $PACKAGE.pot
516 if test -s $cat.new
; then
517 grep -v "\"POT-Creation" $cat.new
> $cat.new
.2
518 grep -v "\"POT-Creation" $cat >> $cat.new
.1
519 if diff $cat.new
.1 $cat.new
.2; then
524 rm -f $cat.new
.1 $cat.new
.2
534 for i
in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
535 egrep -v '^#([^:]|$)' po
/$i |
egrep '^.*[^ ]+.*$' |
grep -v "\"POT-Creation" > po.backup
/$i
536 cat po
/$i > po.backup
/backup_
$i
537 touch -r po
/$i po.backup
/backup_
$i
541 podir
=${podir:-$PWD/po}
542 files
=`find . -name Makefile.am | xargs egrep -l '^messages:' `
543 dirs=`for i in $files; do echo \`dirname $i\
`; done`
544 tmpname
="$PWD/messages.log"
545 if test -z "$EXTRACTRC"; then EXTRACTRC
=extractrc
; fi
546 if test -z "$PREPARETIPS"; then PREPARETIPS
=preparetips
; fi
547 export EXTRACTRC PREPARETIPS
549 for subdir
in $dirs; do
550 test -z "$VERBOSE" ||
echo "Making messages in $subdir"
552 if test -n "`grep -e '^messages:.*rc.cpp' Makefile.am`"; then
553 $EXTRACTRC *.rc
*.ui
*.kcfg
> rc.cpp
555 candidates
=`ls -1 *.rc *.ui *.kcfg 2>/dev/null`
556 if test -n "$candidates"; then
557 echo "$subdir has *.rc, *.ui or *.kcfg files, but not correct messages line"
560 if test -n "`grep -r KAboutData *.c* *.C* 2>/dev/null`"; then
561 echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp
562 else echo " " > _translatorinfo.cpp
564 perl
-e '$mes=0; while (<STDIN>) { next if (/^(if\s|else\s|endif)/); if (/^messages:/) { $mes=1; print $_; next; } if ($mes) { if (/$\\(XGETTEXT\)/ && / -o/) { s/ -o \$\(podir\)/ _translatorinfo.cpp -o \$\(podir\)/ } print $_; } else { print $_; } }' < Makefile.am |
egrep -v '^include ' > _transMakefile
566 $MAKE -s -f _transMakefile podir
=$podir EXTRACTRC
="$EXTRACTRC" PREPARETIPS
="$PREPARETIPS" \
567 XGETTEXT
="${XGETTEXT:-xgettext} -C -ki18n -ktr2i18n -kI18N_NOOP -kaliasLocale -x ${includedir:-${KDEDIR:-/usr/local/kde}/include}/kde.pot" \
570 if test "$exit_code" != 0; then
571 echo "make exit code: $exit_code"
573 ) 2>&1 |
grep -v '^make\[1\]' > $tmpname
574 test -s $tmpname && { echo $subdir ; cat "$tmpname"; }
575 test -f $subdir/rc.cpp
&& rm -f $subdir/rc.cpp
576 rm -f $subdir/_translatorinfo.cpp
577 rm -f $subdir/_transMakefile
580 for i
in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do
581 test -f po
/$i ||
echo "disappeared: $i"
583 for i
in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
584 sed -e 's,^"Content-Type: text/plain; charset=CHARSET\\n"$,"Content-Type: text/plain; charset=UTF-8\\n",' po
/$i > po
/$i.new
&& mv po
/$i.new po
/$i
585 msgmerge
-q -o po
/$i po
/$i po
/$i
586 egrep -v '^#([^:]|$)' po
/$i |
egrep '^.*[^ ]+.*$' |
grep -v "\"POT-Creation" > temp.pot
587 if test -f po.backup
/$i && test -n "`diff temp.pot po.backup/$i`"; then
588 echo "will update $i"
589 sed -e 's,^"Content-Type: text/plain; charset=CHARSET\\n"$,"Content-Type: text/plain; charset=UTF-8\\n",' po.backup
/$backup_$i > po
/$i.new
&& mv po
/$i.new po.backup
/backup_
$i
590 msgmerge
-q po.backup
/backup_
$i po
/$i > temp.pot
593 if test -f po.backup
/backup_
$i; then
594 test -z "$VERBOSE" ||
echo "I'm restoring $i"
595 mv po.backup
/backup_
$i po
/$i
612 admindir
=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
613 test "x$admindir" = "x$0" && admindir
=.
615 test "x$MAKE" = x
&& MAKE
=make
616 makefile_am
=Makefile.am
617 makefile_wo
=Makefile.am.wo
618 if test -f Makefile.am.
in; then
619 makefile_am
=Makefile.am.
in
620 makefile_wo
=Makefile.am.
in.wo
624 # Suck in the AUTOCONF detection code
625 .
$admindir/detect-autoconf.sh
631 arg
=`echo $1 | tr '\-.' __`
633 cvs | dist | subdir_dist | configure_in | configure_files | subdirs | \
634 cvs_clean | package_merge | package_messages | Makefile_am | acinclude_m4
) $arg ;;
635 configure
) call_and_fix_autoconf
;;
636 * ) echo "Usage: cvs.sh <target>"
637 echo "Target can be one of:"
638 echo " cvs cvs-clean dist"
639 echo " configure.in configure.files"
640 echo " package-merge package-messages"
642 echo "Usage: anything but $1"
646 if test -f $makefile_wo; then