~ubuntu-branches/ubuntu/maverick/qgo/maverick

« back to all changes in this revision

Viewing changes to admin/Makefile.common

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2005-01-01 23:07:10 UTC
  • Revision ID: james.westby@ubuntu.com-20050101230710-fhng6yidm47xlb2i
Tags: upstream-1.0.0-r2
ImportĀ upstreamĀ versionĀ 1.0.0-r2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
SHELL=/bin/sh
 
3
 
 
4
cvs:
 
5
        if test -x /usr/bin/autoconf2.50 ; then \
 
6
           AUTOCONF="/usr/bin/autoconf2.50" ;\
 
7
        else \
 
8
           AUTOCONF="autoconf" ;\
 
9
        fi; \
 
10
        AUTOCONF_VERSION=`$$AUTOCONF --version` ;\
 
11
        if test "x$$AUTOCONF_VERSION" = "xAutoconf version 2.13"; then \
 
12
           echo "*** YOU'RE USING AUTOCONF 2.13. We suggest updating." ;\
 
13
           echo "*** autoconf 2.5x works best for now, we will drop" ;\
 
14
           echo "*** support for autoconf 2.13 soon."; \
 
15
           test ! -f admin/libtool.m4.in || mv admin/libtool.m4.in admin/new-libtool.m4.in ;\
 
16
           test ! -f admin/ltmain.sh || mv admin/ltmain.sh admin/new-ltmain.sh ;\
 
17
           for file in libtool.m4.in ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh ltconfig ltmain.sh; do \
 
18
                rm -f admin/$$file ;\
 
19
                ln -s old-$$file admin/$$file ;\
 
20
           done ;\
 
21
        fi 
 
22
        @if grep '$$(top_srcdir)/acinclude.m4:' Makefile.am >/dev/null; then \
 
23
          echo "*** Creating acinclude.m4" ;\
 
24
          rm -f acinclude.m4 configure.files ;\
 
25
          $(MAKE) -f Makefile.am top_srcdir=. acinclude.m4 ;\
 
26
        fi
 
27
        @echo "!!! If you get recursion errors from autoconf, it is advisable to set the"
 
28
        @echo "    environment variable M4 to something including \"--nesting-limit=500\""
 
29
        @if test -r configure.in.in; then \
 
30
          rm -f subdirs configure.in ;\
 
31
          echo "*** Creating list of subdirectories" ;\
 
32
          $(MAKE) -f Makefile.am top_srcdir=. subdirs ;\
 
33
          echo "*** Creating configure.in" ;\
 
34
          $(MAKE) -f Makefile.am top_srcdir=. configure.in ;\
 
35
        fi
 
36
        @echo "*** Creating aclocal.m4"
 
37
        @aclocal
 
38
        @echo "*** Creating configure"
 
39
        @autoconf
 
40
        @if test -r configure.in.in ; then \
 
41
          perl -pi -e 'print "if test \"x\$$with_fast_perl\" = \"xyes\" ;\
 
42
          then\n  perl -i.bak \$$ac_aux_dir/conf.change.pl \$$CONFIG_STATUS\
 
43
          || mv \$$CONFIG_STATUS.bak \$$CONFIG_STATUS;\
 
44
          \n  rm -f \$$CONFIG_STATUS.bak;\nfi\
 
45
          \n" if /^\s*chmod\s+.*\+x\s+.*CONFIG_STATUS/;' configure ;\
 
46
        fi
 
47
        @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
 
48
#David's hack for autoconf bug when $INSTALL is set
 
49
        @perl -pi -e 'if (/\[\/\$$\]\*. INSTALL=/) { print $$_ ; $$_ = "\"\") ;;\n"; }' configure
 
50
        @if egrep "^AM_CONFIG_HEADER" configure.in >/dev/null 2>&1; then \
 
51
          echo "*** Creating config.h template" ;\
 
52
                autoheader ;\
 
53
        fi
 
54
        @echo "*** Creating Makefile templates"
 
55
        @automake
 
56
        @echo "*** Postprocessing Makefile templates"
 
57
        @perl admin/am_edit
 
58
        @if egrep "^cvs-local:" Makefile.am >/dev/null; then \
 
59
          $(MAKE) -f Makefile.am cvs-local ;\
 
60
        fi
 
61
        @echo "*** Creating date/time stamp"
 
62
        @touch stamp-h.in
 
63
        @echo "*** Finished"
 
64
        @echo "    Don't forget to run ./configure"
 
65
        @echo "    If you haven't done so in a while, run ./configure --help"
 
66
 
 
67
dist:   
 
68
        @if grep -e '$$(top_srcdir)/acinclude.m4:' Makefile.am >/dev/null; then \
 
69
          $(MAKE) -f Makefile.am top_srcdir=. acinclude.m4 ;\
 
70
        fi
 
71
        @if test -r configure.in.in; then \
 
72
          $(MAKE) -f Makefile.am top_srcdir=. subdirs configure.in; \
 
73
        fi ;\
 
74
        aclocal; \
 
75
        autoheader; \
 
76
        automake --foreign --include-deps; \
 
77
        perl admin/am_edit; \
 
78
        autoconf; \
 
79
        if test -r configure.in.in ; then \
 
80
          perl -pi -e 'print "if test \"x\$$with_fast_perl\" = \"xyes\" ;\
 
81
          then\n  perl -i.bak \$$ac_aux_dir/conf.change.pl \$$CONFIG_STATUS\
 
82
          || mv \$$CONFIG_STATUS.bak \$$CONFIG_STATUS;\
 
83
          \n  rm -f \$$CONFIG_STATUS.bak;\nfi\
 
84
          \n" if /^\s*chmod\s+.*\+x\s+.*CONFIG_STATUS/;' configure ;\
 
85
        fi ;\
 
86
        touch stamp-h.in; \
 
87
        if grep -e "^cvs-local:" Makefile.am >/dev/null; then \
 
88
          $(MAKE) -f Makefile.am cvs-local ;\
 
89
        fi ;\
 
90
        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 ;\
 
91
        if test -d po; then \
 
92
         LIST=`find ./po -name "*.po"`; \
 
93
         for i in $$LIST; do \
 
94
          file2=`echo $$i | sed -e "s#\.po#\.gmo#"`; \
 
95
          msgfmt -o $$file2 $$i || touch $$file2; \
 
96
         done ;\
 
97
        fi
 
98
        @if grep -e "^cvs-dist-local:" Makefile.am >/dev/null; then \
 
99
          $(MAKE) -f Makefile.am cvs-dist-local ;\
 
100
        fi
 
101
 
 
102
cvs-clean:
 
103
        @if test ! -d CVS; then \
 
104
          echo "You don't have a toplevel CVS directory."; \
 
105
          echo "You most certainly didn't use cvs to get these sources."; \
 
106
          echo "But this function depends on cvs's information."; \
 
107
          exit 1; \
 
108
        fi; \
 
109
        perl -e '\
 
110
        sub rmrf() \
 
111
        { \
 
112
          my $$fn = shift; \
 
113
          lstat ($$fn); \
 
114
          if (-d _) { \
 
115
            if (opendir (DIR, $$fn)) { \
 
116
              for my $$efn (grep (!/^\.\.?$$/, readdir (DIR))) { \
 
117
                &rmrf ($$fn."/".$$efn); \
 
118
              } \
 
119
              closedir (DIR); \
 
120
              rmdir ($$fn); \
 
121
            } \
 
122
          } else { \
 
123
            unlink ($$fn); \
 
124
          } \
 
125
        } \
 
126
         \
 
127
        sub newfiles() \
 
128
        { \
 
129
          my ($$indir, $$incvs) = @_; \
 
130
          for my $$n (keys (%$$incvs)) { delete $$$$indir{$$n} } \
 
131
          return sort (keys (%$$indir)); \
 
132
        } \
 
133
         \
 
134
        sub cvsclean() \
 
135
        { \
 
136
          my $$dir = shift; \
 
137
          my (%dirsdir, %filesdir, %dirscvs, %filescvs); \
 
138
          my $$dnam = $$dir ? $$dir : "."; \
 
139
          if (!opendir (DIR, $$dnam)) { \
 
140
            print STDERR "Cannot enter \"".$$dnam."\".\n"; \
 
141
            return; \
 
142
          } \
 
143
          for my $$fn (grep (!/^\.\.?$$/, readdir (DIR))) { \
 
144
            if (-d $$dir.$$fn) { \
 
145
              $$fn eq "CVS" or $$dirsdir{$$fn} = 1; \
 
146
            } else { \
 
147
              $$filesdir{$$fn} = 1; \
 
148
            } \
 
149
          } \
 
150
          closedir (DIR); \
 
151
          if (!open (FILE, "<".$$dir."CVS/Entries")) { \
 
152
            print STDERR "No CVS information in \"".$$dnam."\".\n"; \
 
153
            return; \
 
154
          } \
 
155
          while (<FILE>) { \
 
156
            m%^D/([^/]+)/.*$$% and $$dirscvs{$$1} = 1; \
 
157
            m%^/([^/]+)/.*$$% and $$filescvs{$$1} = 1; \
 
158
          } \
 
159
          close (FILE); \
 
160
          if (open (FILE, "<".$$dir."CVS/Entries.Log")) { \
 
161
            while (<FILE>) { \
 
162
              m%^A D/([^/]+)/.*$$% and $$dirscvs{$$1} = 1; \
 
163
              m%^A /([^/]+)/.*$$% and $$filescvs{$$1} = 1; \
 
164
              m%^R D/([^/]+)/.*$$% and delete $$dirscvs{$$1}; \
 
165
              m%^R /([^/]+)/.*$$% and delete $$filescvs{$$1}; \
 
166
            } \
 
167
            close (FILE); \
 
168
          } \
 
169
          for my $$fn (&newfiles (\%filesdir, \%filescvs)) { \
 
170
            print ("F ".$$dir.$$fn."\n"); \
 
171
            &rmrf ($$dir.$$fn); \
 
172
          } \
 
173
          for my $$fn (&newfiles (\%dirsdir, \%dirscvs)) { \
 
174
            print ("D ".$$dir.$$fn."\n"); \
 
175
            &rmrf ($$dir.$$fn); \
 
176
          } \
 
177
          for my $$fn (sort (keys (%dirscvs))) { \
 
178
            &cvsclean ($$dir.$$fn."/"); \
 
179
          } \
 
180
        } \
 
181
         \
 
182
        &cvsclean ("");'
 
183
 
 
184
 
 
185
# The Makefiles have to be sorted for slashes, since configure creates
 
186
# only one directory per Makefile not the whole hierarchy
 
187
configure.in: configure.files $(shell test -f configure.files && cat configure.files) subdirs
 
188
        @rm -f configure.in configure.in.new ;\
 
189
        kde_use_qt_param= ; \
 
190
        cat `cat configure.files | egrep -v "^configure.in.bot"` >> configure.in.new ;\
 
191
        echo "KDE_CREATE_SUBDIRSLIST" >> configure.in.new ;\
 
192
        echo "AC_OUTPUT( \\" >> configure.in.new ;\
 
193
        mfs=`find . -type d -print | fgrep -v "/." | sed -e "s#\./##" -e "/^debian/d" | sort`; \
 
194
        for i in $$mfs; do \
 
195
          topleveldir=`echo $$i| sed -e "s#/.*##"`; \
 
196
          if test -f $$topleveldir/configure.in; then \
 
197
                continue; \
 
198
          fi ;\
 
199
          if test ! -f $$i/Makefile.am; then \
 
200
                continue; \
 
201
          fi ;\
 
202
          if test -s inst-apps; then \
 
203
            if test -z "`grep \"^$$topleveldir\" inst-apps`"; then \
 
204
                continue; \
 
205
            fi ;\
 
206
          fi ;\
 
207
          echo "$$i/Makefile \\" >> configure.in.new ;\
 
208
        done ;\
 
209
        egrep '^dnl AC_OUTPUT\(.*\)' `cat configure.files` | sed -e "s#^.*dnl AC_OUTPUT(\(.*\))#\1 \\\\#" >> configure.in.new ;\
 
210
        echo ")" >> configure.in.new
 
211
        @modulename= ;\
 
212
        if test -f configure.in.in; then \
 
213
           if head -2 configure.in.in | egrep "^#MIN_CONFIG\(.*\)$$" > /dev/null; then \
 
214
              line=`egrep "^#MIN_CONFIG\(" configure.in.in` ;\
 
215
              if test -n "$$line"; then \
 
216
                  kde_use_qt_param=`echo $$line | sed -e "s/#MIN_CONFIG(\(.*\))/\1/"` ;\
 
217
              fi ;\
 
218
           fi ;\
 
219
           if head -2 configure.in.in | egrep "^#MIN_CONFI(G|G\(.*\))$$" > /dev/null; then \
 
220
              line=`egrep "^AM_INIT_AUTOMAKE\(" configure.in.in` ;\
 
221
              if test -n "$$line"; then \
 
222
                  modulename=`echo $$line | sed -e "s#AM_INIT_AUTOMAKE(\([^,]*\),.*#\1#"` ;\
 
223
                  VERSION=`echo $$line | sed -e "s#AM_INIT_AUTOMAKE([^,]*, *\([^)]*\)).*#\1#"` ;\
 
224
               fi ;\
 
225
              sed -e "s#AM_INIT_AUTOMAKE([^@].*#dnl PACKAGE set before#" configure.in.new > configure.in \
 
226
                  && mv configure.in configure.in.new ;\
 
227
           fi ;\
 
228
        fi ;\
 
229
        if test -z "$$modulename" || test "$$modulename" = "@MODULENAME@"; then \
 
230
           modulename=`pwd`; modulename=`basename $$modulename`; \
 
231
        fi ;\
 
232
        if test -z "$$VERSION" || test "$$VERSION" = "@VERSION@"; then \
 
233
             VERSION="\"3.0.3\"";  \
 
234
        fi ;\
 
235
        if test -n "$$kde_use_qt_param"; then \
 
236
              sed -e "s#^dnl KDE_USE_QT#KDE_USE_QT($$kde_use_qt_param)#" configure.in.new > configure.in \
 
237
                  && mv configure.in configure.in.new ;\
 
238
        fi ; \
 
239
        sed -e "s#@MODULENAME@#$$modulename#" configure.in.new | \
 
240
                sed -e "s#@VERSION@#$$VERSION#" > configure.in
 
241
        @if test -f configure.in.bot ; then cat configure.in.bot >> configure.in ; fi
 
242
        @rm -f configure.in.new
 
243
 
 
244
configure.files: subdirs
 
245
        @admindir=NO ;\
 
246
        for i in . .. ../.. ../../..; do \
 
247
          if test -x $$i/admin; then admindir=$$i/admin; break; fi; \
 
248
        done ;\
 
249
        rm -rf configure.files ;\
 
250
        if test -f configure.in.in && head -2 configure.in.in | egrep "^#MIN_CONFI(G|G\(.*\))$$" > /dev/null; then \
 
251
                echo $$admindir/configure.in.min >> configure.files  ;\
 
252
        fi
 
253
        @test -f configure.in.in && echo configure.in.in >> configure.files
 
254
        @list=`find . -name "configure.in.in" | sort`; \
 
255
        for i in $$list; do if test -f $$i && test ! `dirname $$i` = "." ; then \
 
256
          echo $$i >> configure.files ;\
 
257
        fi; done
 
258
        @if test -f configure.in.mid ; then echo configure.in.mid >> configure.files ; fi
 
259
        @if test -f configure.in.bot ; then echo configure.in.bot >> configure.files ; fi
 
260
 
 
261
subdirs:
 
262
        @files=`ls -1 | sort`; \
 
263
        dirs= ;\
 
264
        lib_dirs= ;\
 
265
        first_dirs= ;\
 
266
        last_dirs= ;\
 
267
        compilefirst=`grep '^COMPILE_FIRST[ ]*=' Makefile.am | \
 
268
                sed -e 's#^COMPILE_FIRST[ ]*=[ ]*#|#' | sed -e 's#$$#|#' | sed -e 's# #|#g'`;\
 
269
        compilelast=`grep '^COMPILE_LAST[ ]*=' Makefile.am | \
 
270
                sed -e 's#^COMPILE_LAST[ ]*=[ ]*#|#' | sed -e 's#$$#|#' | sed -e 's# #|#g'`;\
 
271
        for i in $$files; do if test -d $$i; then \
 
272
            if test -f $$i/Makefile.am; then \
 
273
                if echo $$compilefirst | grep "|$$i|" >/dev/null; then \
 
274
                        first_dirs="$$first_dirs $$i" ;\
 
275
                elif echo $$compilelast | grep "|$$i|" >/dev/null; then \
 
276
                        last_dirs="$$last_dirs $$i" ; \
 
277
                else dirs="$$dirs $$i" ;\
 
278
                fi ;\
 
279
             fi ;\
 
280
           fi; \
 
281
        done ;\
 
282
        rm -f _SUBDIRS ;\
 
283
        for i in $$dirs; do \
 
284
        echo $$i >> ./_SUBDIRS; \
 
285
        done
 
286
        @if test -r subdirs && diff subdirs _SUBDIRS > /dev/null; then \
 
287
          rm -f _SUBDIRS; \
 
288
        fi
 
289
        @test -r _SUBDIRS && mv _SUBDIRS subdirs || true
 
290
 
 
291
package-merge:
 
292
        @catalogs='$(POFILES)'; \
 
293
        for cat in $$catalogs; do \
 
294
        echo $$cat $$name; \
 
295
        msgmerge -o $$cat.new $$cat $(PACKAGE).pot ; \
 
296
        if test -s $$cat.new; then \
 
297
          grep -v "\"POT-Creation" $$cat.new > $$cat.new.2 ; \
 
298
          grep -v "\"POT-Creation" $$cat >> $$cat.new.1; \
 
299
          if diff $$cat.new.1 $$cat.new.2; then \
 
300
                rm $$cat.new;  \
 
301
          else  \
 
302
                mv $$cat.new $$cat ; \
 
303
        fi; \
 
304
        rm -f $$cat.new.1 $$cat.new.2 ;\
 
305
        fi ;\
 
306
        done
 
307
 
 
308
 
 
309
package-messages:
 
310
        @rm -rf po.backup ;\
 
311
        mkdir po.backup ;\
 
312
        for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do \
 
313
          egrep -v '^#([^:]|$)' po/$$i | egrep '^.*[^ ]+.*$$' | grep -v "\"POT-Creation" > po.backup/$$i ; \
 
314
          cp po/$$i po.backup/backup_$$i ;  \
 
315
          touch -r po/$$i po.backup/backup_$$i ;\
 
316
          rm po/$$i ;\
 
317
        done
 
318
        @podir=$${podir:-$$PWD/po} ;\
 
319
        files=`find . -name Makefile.am | xargs egrep -l '^messages:' `; \
 
320
        dirs=`for i in $$files; do echo \`dirname $$i\`; done`; \
 
321
        tmpname="$$PWD/messages.log" ;\
 
322
        if test -z "$$EXTRACTRC"; then EXTRACTRC=extractrc ; fi ;\
 
323
        if test -z "$$PREPARETIPS"; then PREPARETIPS=preparetips ; fi ;\
 
324
        export EXTRACTRC PREPARETIPS ;\
 
325
        for subdir in $$dirs; do \
 
326
          test -z "$$VERBOSE" || echo "Making messages in $$subdir"; \
 
327
          (cd $$subdir ;\
 
328
           if test -n "`grep -e '^messages:.*rc.cpp' Makefile.am`"; then \
 
329
                $$EXTRACTRC *.rc *.ui > rc.cpp ;\
 
330
           else \
 
331
                candidates=`ls -1 *.rc *.ui 2>/dev/null` ;\
 
332
                if test -n "$$candidates"; then \
 
333
                    echo "$$subdir has *.rc or *.ui files, but not correct messages line" ;\
 
334
                fi ;\
 
335
           fi ;\
 
336
           if test -n "`grep -r KAboutData *.c* *.C* 2>/dev/null`"; then \
 
337
                echo -e 'i18n("_: NAME OF TRANSLATORS\\n"\n"Your names")\ni18n("_: EMAIL OF TRANSLATORS\\n"\n"Your emails")' > _translatorinfo.cpp ;\
 
338
           else echo " " > _translatorinfo.cpp ;\
 
339
           fi; \
 
340
           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 ;\
 
341
           $(MAKE) -s -f _transMakefile podir=$$podir EXTRACTRC="$$EXTRACTRC" PREPARETIPS="$$PREPARETIPS" \
 
342
           XGETTEXT="$${XGETTEXT:-xgettext} -C -ki18n -ktr2i18n \
 
343
           -kI18N_NOOP -ktranslate -kaliasLocale \
 
344
           -x $${includedir:-$$KDEDIR/include}/kde.pot" \
 
345
           messages ) 2>&1 | grep -v '^make\[1\]' > $$tmpname; \
 
346
           test -s $$tmpname && (echo $$subdir ; cat $$tmpname) ;\
 
347
           test ! -f $$subdir/rc.cpp || rm -f $$subdir/rc.cpp ;\
 
348
           rm -f $$subdir/_translatorinfo.cpp ;\
 
349
           rm -f $$subdir/_transMakefile ;\
 
350
        done
 
351
        rm -f $$tmpname
 
352
        @for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do \
 
353
          if test ! -f po/$$i; then echo "disappeared: $$i"; fi ;\
 
354
        done
 
355
        @for  i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do \
 
356
           msgmerge -q -o po/$$i po/$$i po/$$i ;\
 
357
           egrep -v '^#([^:]|$)' po/$$i | egrep '^.*[^ ]+.*$$' | grep -v "\"POT-Creation" > temp.pot ;\
 
358
          if test -f po.backup/$$i && test -n "`diff temp.pot po.backup/$$i`"; then \
 
359
                echo "will update $$i"; \
 
360
                msgmerge -q po.backup/backup_$$i po/$$i > temp.pot ;\
 
361
                mv temp.pot po/$$i; \
 
362
           else \
 
363
            if test -f po.backup/backup_$$i; then \
 
364
              test -z "$$VERBOSE" || echo "I'm restoring $$i" ;\
 
365
              mv po.backup/backup_$$i po/$$i; \
 
366
              rm po.backup/$$i; \
 
367
            else \
 
368
              echo "will add $$i" ;\
 
369
            fi ;\
 
370
        fi ;\
 
371
        done
 
372
        @rm -f temp.pot
 
373
        @rm -rf po.backup
 
374
 
 
375
test:
 
376
        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
 
377
 
 
378
.SILENT:
 
379
 
 
380
.PHONY: cvs test dist cvs-clean package-merge package-messages
 
381