summaryrefslogtreecommitdiff
path: root/jmake/jmake.SH
diff options
context:
space:
mode:
authorManoj Srivastava <srivasta@golden-gryphon.com>2014-04-27 17:54:01 -0700
committerManoj Srivastava <srivasta@golden-gryphon.com>2014-04-27 17:54:01 -0700
commit8f5e5726134ce5b4bd436b16f367796d851df553 (patch)
tree0ce2ad130721dcf917d7f81fb8495bf0a189d266 /jmake/jmake.SH
parent02bf7be6fc0f798790ef5b2160bc89a77b909428 (diff)
Imported Upstream version 3.5-36
Diffstat (limited to 'jmake/jmake.SH')
-rwxr-xr-xjmake/jmake.SH26
1 files changed, 24 insertions, 2 deletions
diff --git a/jmake/jmake.SH b/jmake/jmake.SH
index 9b06899..392952f 100755
--- a/jmake/jmake.SH
+++ b/jmake/jmake.SH
@@ -11,16 +11,17 @@ case $CONFIG in
. $TOP/config.sh
;;
esac
+REVISION=`grep REVISION $TOP/revision.h | head -n1 | cut -d' ' -f4`
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac
echo "Extracting jmake/jmake (with variable substitutions)"
$spitshell >jmake <<!GROK!THIS!
$startperl
- eval 'exec perl -S \$0 "\$@"'
+ eval 'exec perl -S \$0 \${1+"\$@"}'
if \$runnning_under_some_shell;
-# $Id: jmake.SH 25 2008-05-28 11:19:25Z rmanfredi $
+# $Id: jmake.SH 47 2010-11-28 22:23:13Z rmanfredi $
#
# Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
#
@@ -218,6 +219,8 @@ $SPIT_END = "!NO!SUBS!\n";
$GROK_START = "\$spitshell >>Makefile <<!GROK!THIS!\n";
$GROK_END = "!GROK!THIS!\n";
+%target = (); # Will record seen targets (actually generated)
+
open(MAKEFILE, ">Makefile.SH");
# We have to use for instead of foreach to handle 'skip' easily
line: for ($i = 0; $i <= $#makefile; $i++) {
@@ -308,6 +311,20 @@ line: for ($i = 0; $i <= $#makefile; $i++) {
s/<TAG>/[jmake $version-$revision]/;
+ # Lines starting with ?target?: (resp. %target%:) are to be processd
+ # only when target is used (resp. unused) in the generated makefile.
+
+ # Apply in sequence
+ while (/^\s*\?|\s*%/) {
+ if (s/^\s*\?([\w-.]+)\?://) { # Wanted target ?
+ next line unless $target{$1};
+ } elsif (s/^\s*%([\w-.]+)%://) { # Unwanted target ?
+ next line if $target{$1};
+ } else {
+ last;
+ }
+ }
+
# Lines starting with ?SYMBOL: (resp. %SYMBOL:) are to be processed
# only if SYMBOL is defined (resp. undefined).
@@ -396,6 +413,11 @@ line: for ($i = 0; $i <= $#makefile; $i++) {
print MAKEFILE "$_\n";
}
} else {
+ # Keep track of the targets we generate for ?target? and %target% type
+ # of tests in the templates, which can generate specific code when
+ # a target is indeed present.
+ $target{$1}++ if /^([\w.-]+):/;
+
&print_makefile($_);
}
}