1 # This file is part of the aMule project.
3 # Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
4 # Copyright (c) 2006-2008 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
96 # rewrite compiler flags
99 /^[^=]*[^R]CFLAGS/ b 8
104 # save -Wl, -Wa, and -Wp, flags, they're for linker, assember and preprocessor respectively
109 # delete all -W flags
112 # restore -Wl, -Wa, and -Wp, flags
117 # insert -w flag into MULECFLAGS and MULECXXFLAGS if it isn't already in
118 /^MULEC\(XX\)\?FLAGS/! b 9
127 # all rules contain ':' and start at the very beginning of the line
129 # no rules contain '=', so just skip these lines
132 # save rule target in secondary buffer
134 s/\([^:][^:]*\):.*/\1/
137 # skip continuation lines
144 # process rule commands
149 # delete comments inside rules
157 # if the current line is empty or not anymore a command, parse as usual
164 # skipping install-strip target, since it will trigger the echo-denoiser,
165 # and would silence the whole installation, which is abolutely not wanted
172 # do some output based on rule target
175 echo "Compiling $(<F)"
180 echo "Compiling $(<F)"
185 echo "Building $(@F)"
195 echo "Generating translations for $(<F:.po=)"
200 echo "Generating $(@F)"
205 echo "Compiling $(<F)"
208 /^$(DOMAIN)\.pot-update$/ {
210 echo "Updating translation catalog template"
215 echo "Updating translation catalog for $(@F:.po=)"
218 /^\.nop\.po-update$/ {
220 echo "Updating translation catalog for $(<F:.nop=)"
224 # indicate that we already did the echo thingie
226 # s/^/\n/ works with newer sed versions like 4.1.2,
227 # but unfortunately msys uses sed 3.02, which does not
228 # translate \n to a newline in the replacement string.
231 # Compatible method: include a newline literally
236 # If --enable-maintainer-mode, Makefiles may be automatically regenerated.
237 # Denoise new Makefile aswell.
241 /config\.status[ ][ ]*[^ ][^ ]*/ s/\(config\.status[ ][ ]*[^ ][^ ]*[^;\&\|]*\)\(.*\)/\1 denoiser\2/
249 # Denoise echo commands (assuming that no echo command contains the ';' character)
251 # Denoising works by redirecting output to /dev/null, which is slower, though safer
252 # than removing the command.
255 /maintainer-clean-generic/ b 6a
258 /$(RECURSIVE_TARGETS)/ b 6a
269 s/\(echo[^;][^;]*\).*/\1/
270 # do not redirect if it's already redirected
282 s/\(.*echo[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
287 # mkinstalldirs will also echo its job, sink its output too
291 s/\($(mkinstalldirs)[^;][^;]*\).*/\1/
292 # do not redirect if it's already redirected
304 s/\(.*$(mkinstalldirs)[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
309 # the above applies to msgfmt, but here it's enough to remove the '--statistics' flag
310 /$(GMSGFMT)/ s/--statistics//
312 # msgmerge needs a --silent flag
313 s/$(MSGMERGE)/\0 --silent/
314 s/$(MSGMERGE_UPDATE)/\0 --silent/
317 # the following two ruleset must be the last two in this block and in this order!
321 /^[ ]*rm -f[^;]*$(DESTDIR)/ {
326 s/.*rm -f[^;]*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Uninstalling \1"; \\/
332 # skip checking for install: 1) trivially false 2) uninstall would match /install/
339 /^[ ]*$([^)]*INSTALL/ {
344 s/.*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Installing \1"; \\/
358 #endif (levels 2,3,4)
361 # ---- the preprocessor ----
363 ## default processing mode is 'true'
370 ## delete empty lines
401 ## check for "#endif"
412 ## process code lines according to #if/#else/#endif