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
92 # take precedence over automake's silent rules feature
94 /^AM_V_[A-Za-z]\+[ ]*=/ d
95 /^am__v_[A-Za-z]\+_0\?[ ]*=/ d
96 /^AM_DEFAULT_VERBOSITY[ ]*=/ d
100 # rewrite compiler flags
103 /^[^=]*[^R]CFLAGS/ b 8
108 # save -Wl, -Wa, and -Wp, flags, they're for linker, assember and preprocessor respectively
113 # delete all -W flags
116 # restore -Wl, -Wa, and -Wp, flags
121 # insert -w flag into MULECFLAGS and MULECXXFLAGS if it isn't already in
122 /^MULEC\(XX\)\?FLAGS/! b 9
131 # all rules contain ':' and start at the very beginning of the line
133 # no rules contain '=', so just skip these lines
136 # save rule target in secondary buffer
138 s/\([^:][^:]*\):.*/\1/
141 # skip continuation lines
148 # process rule commands
153 # delete comments inside rules
161 # if the current line is empty or not anymore a command, parse as usual
165 # get rid of the last pieces of automake's silent rules feature
166 s/^ $(AM_V_[A-Za-z]\+)/ /
171 # skipping install-strip target, since it will trigger the echo-denoiser,
172 # and would silence the whole installation, which is absolutely not wanted
179 # skip the check target, otherwise test results would be stripped
186 # do some output based on rule target
189 echo "Compiling $(<F)"
194 echo "Compiling $(<F)"
199 echo "Building $(@F)"
209 echo "Generating translations for $(<F:.po=)"
214 echo "Generating $(@F)"
219 echo "Compiling meta objects $(@)"
224 echo "Compiling $(<F)"
227 /^$(DOMAIN)\.pot-update$/ {
229 echo "Updating translation catalog template"
234 echo "Updating translation catalog for $(@F:.po=)"
237 /^\.nop\.po-update$/ {
239 echo "Updating translation catalog for $(<F:.nop=)"
243 # indicate that we already did the echo thingie
245 # s/^/\n/ works with newer sed versions like 4.1.2,
246 # but unfortunately msys uses sed 3.02, which does not
247 # translate \n to a newline in the replacement string.
250 # Compatible method: include a newline literally
255 # If --enable-maintainer-mode, Makefiles may be automatically regenerated.
256 # Denoise new Makefile aswell.
260 /config\.status[ ][ ]*[^ ][^ ]*/ s/\(config\.status[ ][ ]*[^ ][^ ]*[^;\&\|]*\)\(.*\)/\1 denoiser\2/
268 # Denoise echo commands (assuming that no echo command contains the ';' character)
270 # Denoising works by redirecting output to /dev/null, which is slower, though safer
271 # than removing the command.
274 /maintainer-clean-generic/ b 6a
276 # Install targets may contain echo commands that must not be redirected,
277 # so skip this echo unless it contains installation code
289 /$(RECURSIVE_TARGETS)/ b 6a
300 s/\(echo[^;][^;]*\).*/\1/
301 # do not redirect if it's already redirected
313 s/\(.*echo[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
318 # mkinstalldirs will also echo its job, sink its output too
322 s/\($(mkinstalldirs)[^;][^;]*\).*/\1/
323 # do not redirect if it's already redirected
335 s/\(.*$(mkinstalldirs)[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
340 # the above applies to msgfmt, but here it's enough to remove the '--statistics' flag
341 /$(GMSGFMT)/ s/--statistics//
343 # msgmerge needs a --silent flag
344 s/$(MSGMERGE)/\0 --silent/
345 s/$(MSGMERGE_UPDATE)/\0 --silent/
348 # the following two ruleset must be the last two in this block and in this order!
352 /^[ ]*rm -f[^;]*$(DESTDIR)/ {
357 s/.*rm -f[^;]*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Uninstalling \1"; \\/
363 # skip checking for install: 1) trivially false 2) uninstall would match /install/
370 /^[ ]*$([^)]*INSTALL/ {
375 s/.*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Installing \1"; \\/
376 s/$(modulesdir)$$dir/$(modulesdir)/
390 #endif (levels 2,3,4)
393 # ---- the preprocessor ----
395 ## default processing mode is 'true'
402 ## delete empty lines
433 ## check for "#endif"
444 ## process code lines according to #if/#else/#endif