1 # This file is part of the aMule project.
3 # Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
4 # Copyright (c) 2006-2011 Dévai Tamás ( gonosztopi@amule.org )
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either
9 # version 2 of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 # The sed script is tested with GNU sed versions 3.02, 4.1.2
22 # The generated Makefiles are tested with GNU make versions 3.79.1, 3.80
27 # 0 - do nothing, handled outside the scope of this script.
29 # 1 - only strip Makefiles from comments and empty lines, this should
30 # theoretically speed up 'make', although not as much that you could
33 # 2 - leave directory change messages from make, but silence normal
34 # command printing. No echo denoising at this level.
36 # 3 - silence all messages from make, and partial echo denoising.
39 # * silence all messages from make
40 # * full echo denoising
41 # * compiler warning suppression
44 # Syntax of this file:
46 # This file gets preprocessed, all comments and empty lines removed. The
47 # preprocessor understands '#if ', '#else' and '#endif' commands, as long
48 # as they start on the first character on the line. No whitespace is
49 # allowed before the commands. Note that the space character after #if is
50 # part of the command, if it is replaced by a tab then it won't make a
55 # #if currently understands only one keyword: 'level', followed by a number
56 # - the current denoising level. There may be any arbitrary characters
57 # between the keyword and the value - i.e. 'levels 2,3' will also match
58 # when 'level 3' matches.
60 # #if preprocessor commands may be nested for at least 4000 levels deep :-)
62 # The preprocessor script can be found at the end of this file.
65 # ----- now the code -----
67 # suppress messages from make
71 MAKEFLAGS=-s --no-print-directory
91 # delete HAVE_CONFIG_H
94 # take precedence over automake's silent rules feature
96 /^AM_V_[A-Za-z]\+[ ]*=/ d
97 /^am__v_[A-Za-z]\+_0\?[ ]*=/ d
98 /^AM_DEFAULT_VERBOSITY[ ]*=/ d
102 # rewrite compiler flags
105 /^[^=]*[^R]CFLAGS/ b 8
110 # save -Wl, -Wa, and -Wp, flags, they're for linker, assember and preprocessor respectively
115 # delete all -W flags
118 # restore -Wl, -Wa, and -Wp, flags
123 # insert -w flag into MULECFLAGS and MULECXXFLAGS if it isn't already in
124 /^MULEC\(XX\)\?FLAGS/! b 9
133 # all rules contain ':' and start at the very beginning of the line
135 # no rules contain '=', so just skip these lines
138 # save rule target in secondary buffer
140 s/\([^:][^:]*\):.*/\1/
143 # skip continuation lines
150 # process rule commands
155 # delete comments inside rules
163 # if the current line is empty or not anymore a command, parse as usual
167 # get rid of the last pieces of automake's silent rules feature
168 s/^ $(AM_V_[A-Za-z]\+)/ /
173 # skipping install-strip target, since it will trigger the echo-denoiser,
174 # and would silence the whole installation, which is absolutely not wanted
181 # skip the check target, otherwise test results would be stripped
188 # do some output based on rule target
191 echo "Compiling $(<F)"
196 echo "Compiling $(<F)"
201 echo "Building $(@F)"
211 echo "Generating translations for $(<F:.po=)"
216 echo "Generating $(@F)"
221 echo "Compiling meta objects $(@)"
226 echo "Compiling $(<F)"
229 /^$(DOMAIN)\.pot-update$/ {
231 echo "Updating translation catalog template"
236 echo "Updating translation catalog for $(@F:.po=)"
239 /^\.nop\.po-update$/ {
241 echo "Updating translation catalog for $(<F:.nop=)"
245 # indicate that we already did the echo thingie
247 # s/^/\n/ works with newer sed versions like 4.1.2,
248 # but unfortunately msys uses sed 3.02, which does not
249 # translate \n to a newline in the replacement string.
252 # Compatible method: include a newline literally
257 # If --enable-maintainer-mode, Makefiles may be automatically regenerated.
258 # Denoise new Makefile aswell.
262 /config\.status[ ][ ]*[^ ][^ ]*/ s/\(config\.status[ ][ ]*[^ ][^ ]*[^;\&\|]*\)\(.*\)/\1 denoiser\2/
270 # Denoise echo commands (assuming that no echo command contains the ';' character)
272 # Denoising works by redirecting output to /dev/null, which is slower, though safer
273 # than removing the command.
276 /maintainer-clean-generic/ b 6a
278 # Install targets may contain echo commands that must not be redirected,
279 # so skip this echo unless it contains installation code
291 /$(RECURSIVE_TARGETS)/ b 6a
302 s/\(echo[^;][^;]*\).*/\1/
303 # do not redirect if it's already redirected
315 s/\(.*echo[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
320 # mkinstalldirs will also echo its job, sink its output too
324 s/\($(mkinstalldirs)[^;][^;]*\).*/\1/
325 # do not redirect if it's already redirected
337 s/\(.*$(mkinstalldirs)[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
342 # the above applies to msgfmt, but here it's enough to remove the '--statistics' flag
343 /$(GMSGFMT)/ s/--statistics//
345 # msgmerge needs a --silent flag
346 s/$(MSGMERGE)/\0 --silent/
347 s/$(MSGMERGE_UPDATE)/\0 --silent/
350 # the following two ruleset must be the last two in this block and in this order!
354 /^[ ]*rm -f[^;]*$(DESTDIR)/ {
359 s/.*rm -f[^;]*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Uninstalling \1"; \\/
365 # skip checking for install: 1) trivially false 2) uninstall would match /install/
372 /^[ ]*$([^)]*INSTALL/ {
377 s/.*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Installing \1"; \\/
378 s/$(modulesdir)$$dir/$(modulesdir)/
392 #endif (levels 2,3,4)
395 # ---- the preprocessor ----
397 ## default processing mode is 'true'
404 ## delete empty lines
435 ## check for "#endif"
446 ## process code lines according to #if/#else/#endif