comparison kdiff3/admin/Makefile.common @ 14:415083d043f3

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