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* ) : ;;
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* ) : ;;
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"
63
AUTOMAKE_STRING=`$AUTOMAKE --version | head -n 1`
64
required_automake_version="1.6.1 or newer"
65
case $AUTOMAKE_STRING in
66
automake*1.5d* | automake*1.5* | automake*1.5-* )
67
echo "*** YOU'RE USING $AUTOMAKE_STRING."
68
echo "*** KDE requires automake $required_automake_version"
71
automake*1.6.* | automake*1.7* | automake*1.8* | automake*1.9*) : ;;
73
echo "*** AUTOMAKE NOT FOUND!."
74
echo "*** KDE requires automake $required_automake_version"
78
echo "*** YOU'RE USING UNSERMAKE."
79
echo "*** GOOD LUCK!! :)"
83
echo "*** YOU'RE USING $AUTOMAKE_STRING."
84
echo "*** KDE requires automake $required_automake_version"
88
unset required_automake_version
93
check_autotool_versions
96
### Make new subdirs and configure.in.
97
### The make calls could be optimized away here,
98
### with a little thought.
99
if test -r configure.in.in; then
101
echo "*** Creating list of subdirectories"
104
if test -r Makefile.am.in; then
105
echo "*** Creating Makefile.am"
106
if grep '\$(top_srcdir)/Makefile.am:' $makefile_am >/dev/null; then
108
$MAKE -f $makefile_wo top_srcdir=. ./Makefile.am || exit 1
114
echo "*** Creating configure.in"
115
if grep '\$(top_srcdir)/configure.in:' $makefile_am >/dev/null; then
117
$MAKE -f $makefile_wo top_srcdir=. ./configure.in || exit 1
123
echo "*** Creating aclocal.m4"
124
$ACLOCAL $ACLOCALFLAGS || exit 1
125
echo "*** Creating configure"
126
call_and_fix_autoconf
128
if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then
129
echo "*** Creating config.h template"
130
$AUTOHEADER || exit 1
133
echo "*** Creating Makefile templates"
136
if test -z "$UNSERMAKE"; then
137
echo "*** Postprocessing Makefile templates"
138
perl -w admin/am_edit || exit 1
141
if egrep "^cvs-local:" $makefile_am >/dev/null; then \
143
$MAKE -f $makefile_wo cvs-local top_srcdir=. || exit 1
146
echo "*** Creating date/time stamp"
150
echo " Don't forget to run ./configure"
151
echo " If you haven't done so in a while, run ./configure --help"
156
check_autotool_versions
159
### First build all of the files necessary to do just "make"
162
if test -r configure.in.in; then
166
if test -r Makefile.am.in; then
167
if grep '\$(top_srcdir)/Makefile.am:' $makefile_am >/dev/null; then
169
$MAKE -f $makefile_wo top_srcdir=. ./Makefile.am || exit 1
175
if grep '\$(top_srcdir)/configure.in:' $makefile_am >/dev/null; then
177
$MAKE -f $makefile_wo top_srcdir=. ./configure.in || exit 1
182
$ACLOCAL $ACLOCALFLAGS
183
if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then
184
echo "*** Creating config.h template"
185
$AUTOHEADER || exit 1
188
if test -z "$UNSERMAKE"; then
189
echo "*** Postprocessing Makefile templates"
190
perl -w admin/am_edit || exit 1
192
call_and_fix_autoconf
194
if grep "^cvs-local:" $makefile_am >/dev/null; then
196
$MAKE -f $makefile_wo cvs-local top_srcdir=.
200
### Then make messages
203
LIST=`find ./po -name "*.po"`
205
file2=`echo $i | sed -e "s#\.po#\.gmo#"`
206
msgfmt -o $file2 $i || touch $file2
209
if grep "^cvs-dist-local:" $makefile_am >/dev/null; then
211
$MAKE -f $makefile_wo cvs-dist-local top_srcdir=.
217
$ACLOCAL $ACLOCALFLAGS
220
AUTOMAKE_STRING=`$AUTOMAKE --version | head -n 1`
221
case $AUTOMAKE_STRING in
225
perl -w ../admin/am_edit --path=../admin
227
call_and_fix_autoconf
233
rm -f configure.in configure.in.new
235
test -f configure.files || { echo "need configure.files for configure.in"; exit 1; }
236
list=`fgrep -v "configure.in.bot" < configure.files | fgrep -v "configure.in.mid"`
238
for file in $list; do
239
echo "dnl =======================================================" >> configure.in.new
240
echo "dnl FILE: $file" >> configure.in.new
241
echo "dnl =======================================================" >> configure.in.new
242
echo "" >> configure.in.new
243
cat $file >> configure.in.new
245
echo "KDE_CREATE_SUBDIRSLIST" >> configure.in.new
246
if test -f Makefile.am.in; then
247
subdirs=`cat subdirs`
248
for dir in $subdirs; do
249
vdir=`echo $dir | sed -e 's,[-+.@],_,g'`
250
echo "AM_CONDITIONAL($vdir""_SUBDIR_included, test \"x\$$vdir""_SUBDIR_included\" = xyes)" >> configure.in.new
251
if test -f "$dir/configure.in"; then
252
echo "if test \"x\$$vdir""_SUBDIR_included\" = xyes; then " >> configure.in.new
253
echo " AC_CONFIG_SUBDIRS($dir)" >> configure.in.new
254
echo "fi" >> configure.in.new
259
echo "AC_CONFIG_FILES([ Makefile ])" >> configure.in.new
261
if test -f inst-apps; then
262
topleveldirs=`cat inst-apps`
265
for dir in `ls -1d * | sort`; do
266
if test "$dir" != "debian" && test -d $dir; then
267
topleveldirs="$topleveldirs $dir"
272
for topleveldir in $topleveldirs; do
273
if test -f $topleveldir/configure.in; then
276
if test -f $topleveldir/Makefile.am; then :; else
280
mfs=`find $topleveldir -follow -name Makefile.am -print | fgrep -v "/." | \
281
sed -e 's#\./##; s#/Makefile.am$##' | sort | sed -e 's#$#/Makefile#'`
283
echo "AC_CONFIG_FILES([ $i ])" >> configure.in.new
287
files=`cat configure.files`
288
list=`egrep '^dnl AC_OUTPUT\(.*\)' $files | sed -e "s#^.*dnl AC_OUTPUT(\(.*\))#\1#"`
289
for file in $list; do
290
echo "AC_CONFIG_FILES([ $file ])" >> configure.in.new
293
midfiles=`cat configure.files | fgrep "configure.in.mid"`
294
test -n "$midfiles" && cat $midfiles >> configure.in.new
296
echo "AC_OUTPUT" >> configure.in.new
298
if test -f configure.in.in; then
299
if head -n 2 configure.in.in | egrep "^#MIN_CONFIG\(.*\)$" > /dev/null; then
300
kde_use_qt_param=`cat configure.in.in | sed -n -e "s/#MIN_CONFIG(\(.*\))/\1/p"`
302
if head -n 2 configure.in.in | egrep "^#MIN_CONFIG" > /dev/null; then
303
line=`grep "^AM_INIT_AUTOMAKE(" configure.in.in`
304
if test -n "$line"; then
305
modulename=`echo $line | sed -e "s#AM_INIT_AUTOMAKE(\([^,]*\),.*#\1#"`
306
VERSION=`echo $line | sed -e "s#AM_INIT_AUTOMAKE([^,]*, *\([^)]*\)).*#\1#"`
308
sed -e "s#AM_INIT_AUTOMAKE([^@].*#dnl PACKAGE set before#" \
309
configure.in.new > configure.in && mv configure.in configure.in.new
312
if test -z "$VERSION" || test "$VERSION" = "@VERSION@"; then
315
if test -z "$modulename" || test "$modulename" = "@MODULENAME@"; then
317
modulename=`basename $modulename`
318
esc_VERSION=`echo $VERSION | sed -e "s#[^.0-9a-zA-Z]##g"`
319
modulename=`echo $modulename | sed -e "s#-$esc_VERSION##"`
322
if test -n "$kde_use_qt_param"; then
323
sed -e "s#^dnl KDE_USE_QT#KDE_USE_QT($kde_use_qt_param)#" \
324
configure.in.new > configure.in && mv configure.in configure.in.new
326
sed -e "s#@MODULENAME@#$modulename#" configure.in.new |
327
sed -e "s#@VERSION@#$VERSION#" > configure.in
328
botfiles=`cat configure.files | egrep "configure.in.bot"`
329
test -n "$botfiles" && cat $botfiles >> configure.in
330
cat $admindir/configure.in.bot.end >> configure.in
331
rm -f configure.in.new
336
echo "*** Creating configure.files"
338
for i in . .. ../.. ../../..; do
339
if test -x $i/admin; then admindir=$i/admin; break; fi
341
rm -f configure.files
342
touch configure.files
343
if test -f configure.in.in && head -n 2 configure.in.in | grep "^#MIN_CONFIG" > /dev/null; then
344
echo $admindir/configure.in.min >> configure.files
346
test -f configure.in.in && echo configure.in.in >> configure.files
347
# we collect files in the subdirs and do some sorting tricks, so subsubdirs come after subdirs
348
if test -f inst-apps; then
352
list="$list `find $i/ -follow -name "configure.in.in" -o -name "configure.in.bot" -o -name "configure.in.mid" | \
353
sed -e "s,/configure,/aaaconfigure," | sort | sed -e "s,/aaaconfigure,/configure,"`"
356
list=`find . -follow -name "configure.in.in" -o -name "configure.in.bot" -o -name "configure.in.mid" | \
357
sed -e "s,/configure,/aaaconfigure," | sort | sed -e "s,/aaaconfigure,/configure,"`
359
for i in $list; do if test -f $i && test `dirname $i` != "." ; then
360
echo $i >> configure.files
362
test -f configure.in.mid && echo configure.in.mid >> configure.files
363
test -f configure.in.bot && echo configure.in.bot >> configure.files
364
if test ! -s configure.files; then
365
echo "There are no files to build a configure. Please check your checkout."
372
if grep '\$(top_srcdir)/subdirs:' $makefile_am >/dev/null; then
373
# as many modules contain rules to create subdirs without any
374
# dependencies make won't create it unless there is no file.
375
# so we check if that's a dummy rule or one that works
376
rm -f subdirs.cvs.sh.$$
377
if test -f subdirs; then
378
mv subdirs subdirs.cvs.sh.$$
381
$MAKE -f $makefile_wo top_srcdir=. ./subdirs || exit 1
382
if test -f subdirs.cvs.sh.$$; then
383
if test -s subdirs; then
386
mv subdirs.cvs.sh.$$ subdirs
398
if test -f inst-apps; then
399
idirs=`cat inst-apps`
404
compilefirst=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' $makefile_am | head -n 1`
405
compilelast=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' $makefile_am | head -n 1`
407
if test -f $i/Makefile.am; then
408
case " $compilefirst $compilelast " in
417
for d in $compilefirst; do
418
echo $d >> ./_SUBDIRS
422
list=`sed -ne "s#^COMPILE_BEFORE_$d""[ ]*=[ ]*##p" $makefile_am | head -n 1`
426
list=`sed -ne "s#^COMPILE_AFTER_$d""[ ]*=[ ]*##p" $makefile_am | head -n 1`
431
done ) | tsort >> ./_SUBDIRS
433
for d in $compilelast; do
434
echo $d >> ./_SUBDIRS
437
if test -r subdirs && cmp -s subdirs _SUBDIRS; then
440
test -r _SUBDIRS && mv _SUBDIRS subdirs || true
445
if test -f Makefile.am.in; then
446
compilefirst=`sed -ne 's#^COMPILE_FIRST[ ]*=[ ]*##p' $makefile_am | head -n 1`
447
compilelast=`sed -ne 's#^COMPILE_LAST[ ]*=[ ]*##p' $makefile_am | head -n 1`
451
if test -f inst-apps; then
452
idirs=`cat inst-apps`
457
case " $compilefirst $compilelast " in
463
adds=`fgrep '$(top_srcdir)/acinclude.m4:' Makefile.am.in | sed -e 's,^[^:]*: *,,; s,\$(top_srcdir)/,,g'`
464
if echo "$adds" | fgrep "*" >/dev/null ; then
465
adds=`ls -d -1 $adds 2>/dev/null`
466
fgrep -v '$(top_srcdir)/acinclude.m4:' Makefile.am.in > Makefile.am.in.adds
467
str='$(top_srcdir)/acinclude.m4:'
469
str="$str \$(top_srcdir)/$add"
471
echo $str >> Makefile.am.in.adds
473
cat Makefile.am.in > Makefile.am.in.adds
476
cat Makefile.am.in.adds | \
477
sed -e 's,^\s*\(COMPILE_BEFORE.*\),# \1,' | \
478
sed -e 's,^\s*\(COMPILE_AFTER.*\),# \1,' > Makefile.am
479
echo "SUBDIRS="'$(TOPSUBDIRS)' >> Makefile.am
480
rm Makefile.am.in.adds
486
echo "*** Creating acinclude.m4"
488
if grep '\$(top_srcdir)/acinclude.m4:' $makefile_am >/dev/null; then
491
adds=`grep '\$(top_srcdir)/acinclude.m4:' $makefile_wo | sed -e 's,^[^:]*: *,,; s,\$(top_srcdir),.,g'`
492
if echo $adds | fgrep "*" >/dev/null ; then
493
adds=`ls -d -1 $adds 2>/dev/null`
495
$MAKE -f $makefile_wo top_srcdir=. ./acinclude.m4 || exit 1
500
# if it wasn't created up to now, then we do it better
501
if test ! -f acinclude.m4; then
502
cat admin/acinclude.m4.in admin/libtool.m4.in admin/pkg.m4.in $adds > acinclude.m4
508
if test -d CVS; then :; else
509
echo "You don't have a toplevel CVS directory."
510
echo "You most certainly didn't use cvs to get these sources."
511
echo "But this function depends on cvs's information."
514
perl $admindir/cvs-clean.pl
520
for cat in $catalogs; do
521
msgmerge -o $cat.new $cat $PACKAGE.pot
522
if test -s $cat.new; then
523
grep -v "\"POT-Creation" $cat.new > $cat.new.2
524
grep -v "\"POT-Creation" $cat >> $cat.new.1
525
if diff $cat.new.1 $cat.new.2; then
530
rm -f $cat.new.1 $cat.new.2
537
podir=${podir:-$PWD/po}
538
files=`find . -name Makefile.am | xargs egrep -l '^messages:' `
539
dirs=`for i in $files; do echo \`dirname $i\`; done`
540
tmpname="$PWD/messages.log"
541
if test -z "$EXTRACTRC"; then EXTRACTRC=extractrc ; fi
542
if test -z "$PREPARETIPS"; then PREPARETIPS=preparetips ; fi
543
export EXTRACTRC PREPARETIPS
545
for subdir in $dirs; do
546
test -z "$VERBOSE" || echo "Making messages in $subdir"
548
if test -n "`grep -e '^messages:.*rc.cpp' Makefile.am`"; then
549
$EXTRACTRC *.rc *.ui *.kcfg > rc.cpp
551
candidates=`ls -1 *.rc *.ui *.kcfg 2>/dev/null`
552
if test -n "$candidates"; then
553
echo "$subdir has *.rc, *.ui or *.kcfg files, but not correct messages line"
556
if find . -name \*.c\* -o -name \*.h\* | xargs fgrep -s -q KAboutData ; then
557
echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp
558
else echo " " > _translatorinfo.cpp
560
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
562
kdepotpath=${includedir:-${KDEDIR:-`kde-config --prefix`}/include}/kde.pot
564
$MAKE -s -f _transMakefile podir=$podir EXTRACTRC="$EXTRACTRC" PREPARETIPS="$PREPARETIPS" srcdir=. \
565
XGETTEXT="${XGETTEXT:-xgettext} --foreign-user -C -ci18n -ki18n -ktr2i18n -kI18N_NOOP -kI18N_NOOP2 -kaliasLocale -x $kdepotpath" messages
567
if test "$exit_code" != 0; then
568
echo "make exit code: $exit_code"
570
) 2>&1 | grep -v '^make\[1\]' > $tmpname
571
test -s $tmpname && { echo $subdir ; cat "$tmpname"; }
572
test -f $subdir/rc.cpp && rm -f $subdir/rc.cpp
573
rm -f $subdir/_translatorinfo.cpp
574
rm -f $subdir/_transMakefile
584
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
585
egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > po.backup/$i
586
cat po/$i > po.backup/backup_$i
587
touch -r po/$i po.backup/backup_$i
593
for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do
594
test -f po/$i || echo "disappeared: $i"
596
for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do
597
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
598
#msgmerge -q -o po/$i po/$i po/$i
599
egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > temp.pot
600
if test -f po.backup/$i && ! cmp -s temp.pot po.backup/$i; then
601
echo "will update $i"
603
if test -f po.backup/backup_$i; then
604
test -z "$VERBOSE" || echo "I'm restoring $i"
605
mv po.backup/backup_$i po/$i
622
admindir=`echo "$0" | sed 's%[\\/][^\\/][^\\/]*$%%'`
623
test "x$admindir" = "x$0" && admindir=.
625
test "x$MAKE" = x && MAKE=make
626
makefile_am=Makefile.am
627
makefile_wo=Makefile.am.wo
628
if test -f Makefile.am.in; then
629
makefile_am=Makefile.am.in
630
makefile_wo=Makefile.am.in.wo
634
# Suck in the AUTOCONF detection code
635
. $admindir/detect-autoconf.sh
641
arg=`echo $1 | tr .- __`
643
cvs | dist | subdir_dist | configure_in | configure_files | subdirs | \
644
cvs_clean | package_merge | package_messages | Makefile_am | acinclude_m4 | extract_messages ) $arg ;;
645
configure ) call_and_fix_autoconf ;;
646
* ) echo "Usage: cvs.sh <target>"
647
echo "Target can be one of:"
648
echo " cvs cvs-clean dist"
649
echo " configure.in configure.files"
650
echo " package-merge package-messages"
652
echo "Usage: anything but $1"
656
if test -f $makefile_wo; then