1 # This file is part of the aMule project.
3 # Copyright (c) 2003-2008 aMule Project ( admin@amule.org / http://www.amule.org )
4 # Copyright (c) 2006-2008 Dévai Tamás aka GonoszTopi
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
104 # save -Wl, -Wa, and -Wp, flags, they're for linker, assember and preprocessor respectively
109 # delete all -W flags
112 # insert -w flag, if it isn't already in the flags
115 # restore -Wl, -Wa, and -Wp, flags
126 # all rules contain ':' and start at the very beginning of the line
128 # no rules contain '=', so just skip these lines
131 # save rule target in secondary buffer
133 s/\([^:][^:]*\):.*/\1/
136 # skip continuation lines
143 # process rule commands
148 # delete comments inside rules
156 # if the current line is empty or not anymore a command, parse as usual
163 # skipping install-strip target, since it will trigger the echo-denoiser,
164 # and would silence the whole installation, which is abolutely not wanted
171 # do some output based on rule target
174 echo "Compiling $(<F)"
179 echo "Compiling $(<F)"
184 echo "Building $(@F)"
194 echo "Generating translations for $(<F:.po=)"
199 echo "Generating $(@F)"
204 echo "Compiling $(<F)"
207 /^$(DOMAIN)\.pot-update$/ {
209 echo "Updating translation catalog template"
214 echo "Updating translation catalog for $(@F:.po=)"
217 /^\.nop\.po-update$/ {
219 echo "Updating translation catalog for $(<F:.nop=)"
223 # indicate that we already did the echo thingie
225 # s/^/\n/ works with newer sed versions like 4.1.2,
226 # but unfortunately msys uses sed 3.02, which does not
227 # translate \n to a newline in the replacement string.
230 # Compatible method: include a newline literally
235 # If --enable-maintainer-mode, Makefiles may be automatically regenerated.
236 # Denoise new Makefile aswell.
240 /config\.status[ ][ ]*[^ ][^ ]*/ s/\(config\.status[ ][ ]*[^ ][^ ]*[^;\&\|]*\)\(.*\)/\1 denoiser\2/
248 # Denoise echo commands (assuming that no echo command contains the ';' character)
250 # Denoising works by redirecting output to /dev/null, which is slower, though safer
251 # than removing the command.
254 /maintainer-clean-generic/ b 6a
257 /$(RECURSIVE_TARGETS)/ b 6a
268 s/\(echo[^;][^;]*\).*/\1/
269 # do not redirect if it's already redirected
281 s/\(.*echo[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
286 # mkinstalldirs will also echo its job, sink its output too
290 s/\($(mkinstalldirs)[^;][^;]*\).*/\1/
291 # do not redirect if it's already redirected
303 s/\(.*$(mkinstalldirs)[^;][^;]*\)\(.*\)/\1>\/dev\/null\2/
308 # the above applies to msgfmt, but here it's enough to remove the '--statistics' flag
309 /$(GMSGFMT)/ s/--statistics//
311 # msgmerge needs a --silent flag
312 s/$(MSGMERGE)/\0 --silent/
313 s/$(MSGMERGE_UPDATE)/\0 --silent/
316 # the following two ruleset must be the last two in this block and in this order!
320 /^[ ]*rm -f[^;]*$(DESTDIR)/ {
325 s/.*rm -f[^;]*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Uninstalling \1"; \\/
331 # skip checking for install: 1) trivially false 2) uninstall would match /install/
338 /^[ ]*$([^)]*INSTALL/ {
343 s/.*$(DESTDIR)\([^;" ][^;" ]*\).*/ echo "Installing \1"; \\/
357 #endif (levels 2,3,4)
360 # ---- the preprocessor ----
362 ## default processing mode is 'true'
369 ## delete empty lines
400 ## check for "#endif"
411 ## process code lines according to #if/#else/#endif