home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 2001 January / CT_SW0101.ISO / pc / software / kommunik / ftp / kmago112.tgz / kmago112.tar / kmago-1.1.2 / admin / Makefile.common < prev    next >
Makefile  |  2001-03-12  |  11KB  |  287 lines

  1.  
  2. cvs:
  3.     @if grep '$$(top_srcdir)/acinclude.m4:' Makefile.am >/dev/null; then \
  4.       echo "*** Concatenating configure tests into acinclude.m4" ;\
  5.       rm -f acinclude.m4 configure.files ;\
  6.       $(MAKE) -f Makefile.am top_srcdir=. acinclude.m4 ;\
  7.     fi
  8.     @if test -r configure.in.in; then \
  9.       rm -f subdirs configure.in ;\
  10.       echo "*** Creating list of subdirectories in subdirs" ;\
  11.       $(MAKE) -f Makefile.am top_srcdir=. subdirs ;\
  12.       echo "*** Searching for subdirectories..." ;\
  13.       $(MAKE) -f Makefile.am top_srcdir=. configure.in ;\
  14.     fi
  15.     @echo "*** Retrieving configure tests needed by configure.in"
  16.     @aclocal
  17.     @echo "*** Scanning for include statements"
  18.     @autoheader
  19.     @echo "*** Building Makefile templates"
  20.     @automake
  21.     @echo "*** Scanning for moc files and kde tags"
  22.     @perl admin/am_edit
  23.     @echo "*** Building configure"
  24.     @autoconf
  25.     @if test -r configure.in.in ; then \
  26.       perl -pi -e 'print "if test \"x\$$with_fast_perl\" = \"xyes\" ;\
  27.       then\n  perl -i.bak \$$ac_aux_dir/conf.change.pl \$$CONFIG_STATUS\
  28.       || mv \$$CONFIG_STATUS.bak \$$CONFIG_STATUS;\
  29.       \n  rm -f \$$CONFIG_STATUS.bak;\nfi\
  30.       \n" if /^\s*chmod\s+.*\+x\s+.*CONFIG_STATUS/;' configure ;\
  31.     fi
  32.     @echo "*** Creating date/time stamp"
  33.     @touch stamp-h.in
  34.     @if egrep "^cvs-local:" Makefile.am >/dev/null; then \
  35.       $(MAKE) -f Makefile.am cvs-local ;\
  36.     fi
  37.     @if grep '} \$$ac_kw foo' configure >/dev/null 2>&1; then perl -p -i -e "s/ac_kw foo/ac_kw int foo/" configure; fi
  38. #David's hack for autoconf bug when $INSTALL is set
  39.     @perl -pi -e 'if (/\[\/\$$\]\*. INSTALL=/) { print $$_ ; $$_ = "\"\") ;;\n"; }' configure
  40.     @echo "*** Finished"
  41.     @echo "    Don't forget to run ./configure"
  42.     @echo "    If you haven't done so in a while, run ./configure --help"
  43.  
  44. dist:    
  45.     @if grep -e '$$(top_srcdir)/acinclude.m4:' Makefile.am >/dev/null; then \
  46.       $(MAKE) -f Makefile.am top_srcdir=. acinclude.m4 ;\
  47.     fi
  48.     @if test -r configure.in.in; then \
  49.       $(MAKE) -f Makefile.am top_srcdir=. subdirs configure.in; \
  50.     fi ;\
  51.     aclocal; \
  52.     autoheader; \
  53.     automake --foreign --include-deps; \
  54.     perl admin/am_edit; \
  55.     autoconf; \
  56.     if test -r configure.in.in ; then \
  57.       perl -pi -e 'print "if test \"x\$$with_fast_perl\" = \"xyes\" ;\
  58.       then\n  perl -i.bak \$$ac_aux_dir/conf.change.pl \$$CONFIG_STATUS\
  59.       || mv \$$CONFIG_STATUS.bak \$$CONFIG_STATUS;\
  60.       \n  rm -f \$$CONFIG_STATUS.bak;\nfi\
  61.       \n" if /^\s*chmod\s+.*\+x\s+.*CONFIG_STATUS/;' configure ;\
  62.     fi ;\
  63.     touch stamp-h.in; \
  64.     if grep -e "^cvs-local:" Makefile.am >/dev/null; then \
  65.       $(MAKE) -f Makefile.am cvs-local ;\
  66.     fi ;\
  67.     if grep "ac_kw foo" configure >/dev/null 2>&1; then perl -p -i -e "s/ac_kw foo/ac_kw int foo/" configure; fi ;\
  68.     if test -d po; then \
  69.      LIST=`find ./po -name "*.po"`; \
  70.      for i in $$LIST; do \
  71.       file2=`echo $$i | sed -e "s#\.po#\.gmo#"`; \
  72.       msgfmt -o $$file2 $$i || touch $$file2; \
  73.      done ;\
  74.     fi
  75.     @if grep -e "^cvs-dist-local:" Makefile.am >/dev/null; then \
  76.       $(MAKE) -f Makefile.am cvs-dist-local ;\
  77.     fi
  78.  
  79. cvs-clean:
  80.     @if test ! -d CVS; then \
  81.       echo "You don't have a toplevel CVS directory."; \
  82.       echo "You most certainly didn't use cvs to get these sources."; \
  83.       echo "But this function depends on cvs's information."; \
  84.       exit 1 ;\
  85.     fi;\
  86.     pwd=`pwd` ;\
  87.     dirs=`find . -type d | grep -v CVS | sed -e "s#^./##"` ;\
  88.     for i in $$dirs; do \
  89.       if test ! -d "$$pwd/$$i/CVS"; then \
  90.         echo "D $$i" ;\
  91.         rm -rf "$$pwd/$$i"; \
  92.         continue; \
  93.       fi ;\
  94.       cd $$pwd/$$i ;\
  95.       for f in * .*; do \
  96.         if test ! -d "$$f"; then \
  97.           if grep "^/$$f/" CVS/Entries > /dev/null; then \
  98.         a="b"; \
  99.           else \
  100.             echo "F $$i/$$f"; \
  101.         rm -f "$$pwd/$$i/$$f"; \
  102.           fi; \
  103.         fi ; \
  104.       done; \
  105.     done
  106.  
  107.  
  108. # The Makefiles have to be sorted for slashes, since configure creates
  109. # only one directory per Makefile not the whole hierarchy
  110. configure.in: configure.files $(shell test -f configure.files && cat configure.files) subdirs
  111.     @rm -f configure.in rm -f configure.in.new ;\
  112.     cat `cat configure.files | egrep -v "^configure.in.bot"` >> configure.in.new ;\
  113.     echo "KDE_CREATE_SUBDIRSLIST" >> configure.in.new ;\
  114.     echo "AC_OUTPUT( \\" >> configure.in.new ;\
  115.     mfs=`find . -type d -print | fgrep -v "/." | sed -e "s#\./##" -e "/^debian/d" | sort`; \
  116.     for i in $$mfs; do \
  117.       topleveldir=`echo $$i| sed -e "s#/.*##"`; \
  118.       if test -f $$topleveldir/configure.in; then \
  119.         continue; \
  120.       fi ;\
  121.       if test ! -f $$i/Makefile.am; then \
  122.         continue; \
  123.       fi ;\
  124.       if test -s inst-apps; then \
  125.         if test -z "`grep \"^$$topleveldir\" inst-apps`"; then \
  126.         continue; \
  127.         fi ;\
  128.       fi ;\
  129.       echo "$$i/Makefile \\" >> configure.in.new ;\
  130.     done ;\
  131.     egrep '^dnl AC_OUTPUT\(.*\)' `cat configure.files` | sed -e "s#^.*dnl AC_OUTPUT(\(.*\))#\1#" >> configure.in.new ;\
  132.     echo ")" >> configure.in.new 
  133.     @modulename= ;\
  134.     if test -f configure.in.in; then \
  135.        if head -2 configure.in.in | egrep "^#MIN_CONFIG$$" > /dev/null; then \
  136.           line=`egrep "^AM_INIT_AUTOMAKE\(" configure.in.in` ;\
  137.           if test -n "$$line"; then \
  138.           modulename=`echo $$line | sed -e "s#AM_INIT_AUTOMAKE(\([^,]*\),.*#\1#"` ;\
  139.           VERSION=`echo $$line | sed -e "s#AM_INIT_AUTOMAKE([^,]*, *\([^)]*\)).*#\1#"` ;\
  140.            fi ;\
  141.           sed -e "s#AM_INIT_AUTOMAKE([^@].*#dnl PACKAGE set before#" configure.in.new > configure.in \
  142.           && mv configure.in configure.in.new ;\
  143.        fi ;\
  144.     fi ;\
  145.     if test -z "$$modulename" || test "$$modulename" = "@MODULENAME@"; then \
  146.        modulename=`pwd`; modulename=`basename $$modulename`; \
  147.     fi ;\
  148.     if test -z "$$VERSION" || test "$$VERSION" = "@VERSION@"; then \
  149.          VERSION="\"2.1\"";  \
  150.     fi ;\
  151.     sed -e "s#@MODULENAME@#$$modulename#" configure.in.new | \
  152.         sed -e "s#@VERSION@#$$VERSION#" > configure.in
  153.     @if test -f configure.in.bot ; then cat configure.in.bot >> configure.in ; fi
  154.     @rm -f configure.in.new
  155.  
  156. configure.files: subdirs
  157.     @admindir=NO ;\
  158.     for i in . .. ../.. ../../..; do \
  159.       if test -x $$i/admin; then admindir=$$i/admin; break; fi; \
  160.     done ;\
  161.     rm -rf configure.files ;\
  162.     if test -f configure.in.in && head -2 configure.in.in | egrep "^#MIN_CONFIG$$" > /dev/null; then \
  163.         echo $$admindir/configure.in.min >> configure.files  ;\
  164.     fi
  165.     @test -f configure.in.in && echo configure.in.in >> configure.files
  166.     @list=`find . -name "configure.in.in" | sort`; \
  167.     for i in $$list; do if test -f $$i && test ! `dirname $$i` = "." ; then \
  168.       echo $$i >> configure.files ;\
  169.     fi; done
  170.     @if test -f configure.in.mid ; then echo configure.in.mid >> configure.files ; fi 
  171.     @if test -f configure.in.bot ; then echo configure.in.bot >> configure.files ; fi
  172.  
  173. subdirs:
  174.     @files=`ls -1 | sort`; \
  175.     dirs= ;\
  176.     lib_dirs= ;\
  177.     first_dirs= ;\
  178.     last_dirs= ;\
  179.     compilefirst=`grep '^COMPILE_FIRST[ ]*=' Makefile.am | \
  180.         sed -e 's#^COMPILE_FIRST[ ]*=[ ]*#|#' | sed -e 's#$$#|#' | sed -e 's# #|#g'`;\
  181.     compilelast=`grep '^COMPILE_LAST[ ]*=' Makefile.am | \
  182.         sed -e 's#^COMPILE_LAST[ ]*=[ ]*#|#' | sed -e 's#$$#|#' | sed -e 's# #|#g'`;\
  183.     for i in $$files; do if test -d $$i; then \
  184.         if test -f $$i/Makefile.am; then \
  185.         if echo $$compilefirst | grep "|$$i|" >/dev/null; then \
  186.             first_dirs="$$first_dirs $$i" ;\
  187.         elif echo $$compilelast | grep "|$$i|" >/dev/null; then \
  188.             last_dirs="$$last_dirs $$i" ; \
  189.         else dirs="$$dirs $$i" ;\
  190.         fi ;\
  191.          fi ;\
  192.        fi; \
  193.     done ;\
  194.     rm -f SUBDIRS ;\
  195.     for i in $$dirs; do \
  196.     echo $$i >> ./SUBDIRS; \
  197.     done
  198.     @if test -r subdirs && diff subdirs SUBDIRS > /dev/null; then \
  199.       rm -f SUBDIRS; \
  200.     fi
  201.     @test -r SUBDIRS && mv SUBDIRS subdirs || true
  202.  
  203. package-merge:
  204.     @catalogs='$(POFILES)'; \
  205.     for cat in $$catalogs; do \
  206.     echo $$cat $$name; \
  207.     msgmerge -o $$cat.new $$cat $(PACKAGE).pot ; \
  208.     if test -s $$cat.new; then \
  209.       grep -v "\"POT-Creation" $$cat.new > $$cat.new.2 ; \
  210.       grep -v "\"POT-Creation" $$cat >> $$cat.new.1; \
  211.       if diff $$cat.new.1 $$cat.new.2; then \
  212.         rm $$cat.new;  \
  213.       else  \
  214.         mv $$cat.new $$cat ; \
  215.     fi; \
  216.     rm -f $$cat.new.1 $$cat.new.2 ;\
  217.     fi ;\
  218.     done
  219.  
  220.  
  221. package-messages:
  222.     @rm -rf po.backup ;\
  223.     mkdir po.backup ;\
  224.     for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do \
  225.       egrep -v '^#([^:]|$)' po/$$i | egrep '^.*[^ ]+.*$$' | grep -v "\"POT-Creation" > po.backup/$$i ; \
  226.       cp po/$$i po.backup/backup_$$i ;  \
  227.       touch -r po/$$i po.backup/backup_$$i ;\
  228.       rm po/$$i ;\
  229.     done
  230.     @podir=$${podir:-$$PWD/po} ;\
  231.     files=`find . -name Makefile.am | xargs egrep -l '^messages:' `; \
  232.     dirs=`for i in $$files; do echo \`dirname $$i\`; done`; \
  233.     tmpname="$$PWD/messages.log" ;\
  234.     for subdir in $$dirs; do \
  235.       test -z "$$VERBOSE" || echo "Making messages in $$subdir"; \
  236.       (cd $$subdir ;\
  237.        if test -n "`grep -e '^messages:.*rc.cpp' Makefile.am`"; then \
  238.            $${EXTRACTRC:-extractrc} *.rc *.ui > rc.cpp ;\
  239.        else \
  240.         candidates=`ls -1 *.rc *.ui 2>/dev/null` ;\
  241.         if test -n "$$candidates"; then \
  242.             echo "$$subdir has *.rc or *.ui files, but not correct messages line" ;\
  243.         fi ;\
  244.        fi ;\
  245.        if test -n "`grep -r KAboutData *.c* *.C* 2>/dev/null`"; then \
  246.         echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp ;\
  247.        else echo " " > _translatorinfo.cpp ;\
  248.        fi; \
  249.        perl -e '$$mes=0; while (<STDIN>) { if (/^messages:/) { $$mes=1; print $$_; next; } if ($$mes) { if (/$$\\(XGETTEXT\)/ && / -o/) { s/ -o \$$\(podir\)/ _translatorinfo.cpp -o \$$\(podir\)/ } print $$_; } else { print $$_; } }' < Makefile.am > _transMakefile ;\
  250.        $(MAKE) -s -f _transMakefile podir=$$podir \
  251.        XGETTEXT="$${XGETTEXT:-xgettext} -C -ki18n \
  252.        -kI18N_NOOP -ktranslate -kaliasLocale \
  253.        -x $${includedir:-$$KDEDIR/include}/kde.pot" \
  254.        messages ) >$$tmpname 2>&1 ;\
  255.        test -s $$tmpname && (echo $$subdir ; cat $$tmpname) ;\
  256.        test ! -f $$subdir/rc.cpp || rm -f $$subdir/rc.cpp ;\
  257.        rm -f $$subdir/_translatorinfo.cpp ;\
  258.        rm -f $$subdir/_transMakefile ;\
  259.     done
  260.     rm -f $$tmpname
  261.     @for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do \
  262.       if test ! -f po/$$i; then echo "disappeared: $$i"; fi ;\
  263.     done
  264.     @for  i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do \
  265.        egrep -v '^#([^:]|$)' po/$$i | egrep '^.*[^ ]+.*$$' | grep -v "\"POT-Creation" > temp.pot ;\
  266.       if test -f po.backup/$$i && test -n "`diff temp.pot po.backup/$$i`"; then \
  267.          echo "will update $$i"; \
  268.         msgmerge -q po.backup/backup_$$i po/$$i > temp.pot ;\
  269.             mv temp.pot po/$$i; \
  270.        else \
  271.         if test -f po.backup/backup_$$i; then \
  272.           test -z "$$VERBOSE" || echo "I'm restoring $$i" ;\
  273.           mv po.backup/backup_$$i po/$$i; \
  274.           rm po.backup/$$i; \
  275.         else \
  276.           echo "will add $$i" ;\
  277.         fi ;\
  278.     fi ;\
  279.     done
  280.     @rm -f temp.pot
  281.     @rm -rf po.backup
  282.  
  283. test:
  284.     perl -e '$$mes=0; while (<STDIN>) { if (/^messages:/) { $$mes=1; print $$_; next; } if ($$mes) { if (! /^\t/) { exit(0); } if (/$$\\(XGETTEXT\)/ && / -o/) { s/ -o/ _translatorinfo.cpp -o/ } print $$_;  } }' < Makefile.am 
  285.  
  286. .SILENT:
  287.