diff options
author | rmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d> | 2010-11-28 22:23:13 +0000 |
---|---|---|
committer | rmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d> | 2010-11-28 22:23:13 +0000 |
commit | 17a95c14fc05fe53f250d627b55ea588321c7129 (patch) | |
tree | 1805772eccde4e46df059ecc2f635525fd140bc2 /jmake | |
parent | ac949fa6c6607bc913ec5ba9515417f89c8348e5 (diff) |
Not all depend targets use $(MKDEP) so added a construct to check whether
a target is being used. Protect the "DO NOT DELETE" line in the jmake
template with a condition on the "depend" target being used.
git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@47 2592e710-e01b-42a5-8df0-11608a6cc53d
Diffstat (limited to 'jmake')
-rwxr-xr-x | jmake/Makefile.SH | 7 | ||||
-rw-r--r-- | jmake/files/Jmake.tmpl | 2 | ||||
-rwxr-xr-x | jmake/jmake.SH | 21 | ||||
-rw-r--r-- | jmake/jmake.man | 37 |
4 files changed, 61 insertions, 6 deletions
diff --git a/jmake/Makefile.SH b/jmake/Makefile.SH index bc67bb9..2af8e44 100755 --- a/jmake/Makefile.SH +++ b/jmake/Makefile.SH @@ -299,6 +299,13 @@ Makefiles:: Makefiles.SH:: +######################################################################## +# Dependencies generated by make depend +# DO NOT DELETE THIS LINE -- make depend relies on it + +# Put nothing here or make depend will gobble it up +.FORCE_DEPEND:: + @echo "You must run 'make depend' in $(TOP) first."; exit 1 !NO!SUBS! chmod 644 Makefile $eunicefix Makefile diff --git a/jmake/files/Jmake.tmpl b/jmake/files/Jmake.tmpl index df1a189..f684048 100644 --- a/jmake/files/Jmake.tmpl +++ b/jmake/files/Jmake.tmpl @@ -241,7 +241,7 @@ Makefiles:: Makefiles.SH:: -skip /* No sub-directories */ -%MKDEP:|skip /* Skip if no depend target */ +%depend%:|skip /* Skip if no depend target */ ;######################################################################## ;# Dependencies generated by make depend ;# DO NOT DELETE THIS LINE -- make depend relies on it diff --git a/jmake/jmake.SH b/jmake/jmake.SH index bbabfa5..3973185 100755 --- a/jmake/jmake.SH +++ b/jmake/jmake.SH @@ -219,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++) { @@ -309,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). @@ -397,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($_); } } diff --git a/jmake/jmake.man b/jmake/jmake.man index 5c837e4..66b306d 100644 --- a/jmake/jmake.man +++ b/jmake/jmake.man @@ -152,6 +152,33 @@ To implement a logical OR, see below. .RE .sp .IP 3) +Makefile target tests: +.sp +.RS +.IP \(bu +?\fItarget\fR?:<text>: keeps <test> iff \fItarget\fR is defined. +.IP \(bu +%\fItarget\fR%:<text>: keeps <test> iff \fItarget\fR is not defined. +.sp +A makefile \fItarget\fR is defined as a standalone target, for instance +the +.B depend.local +target, which would be defined as: +.sp +.in +5 +.nf +depend.local: +.sp +.in -5 +.fi +Also note that it is only valid for targets defined +.I so far +in the generated makefile. It is not a predicate that can be used +to test for targets that will eventually be defined later on in the +generation. +.RE +.sp +.IP 4) Commands: .sp .RS @@ -217,9 +244,9 @@ Here is a way to implement a logical OR: .in -5 .sp Actually, this is ugly, because the text has to appear twice. -Fortunately, I did not use it. :-) +Fortunately, I did not use that construct. :-) .sp -But actually, as you have surely already guessed, the best way to +Indeed, as you have surely already guessed, the best way to implement a logical OR is to use De Morgan's Law: .sp .in +5 @@ -233,7 +260,7 @@ text /* If SYMBOL or not TOKEN */ .sp .in -5 .fi -Who said they didn't care ? ;-) +Who said they didn't care about logic? ;-) .sp .PP Expansion is done with the \fIexpand\fR command. It has been provided to @@ -440,7 +467,7 @@ therefore depend on the configuration options chosen when \fIConfigure\fR was run. .RE .sp -.IP 4) +.IP 5) Initializations: .sp .RS @@ -450,7 +477,7 @@ Initializations: ++SYMBOL <value>: Adds <value> to the SYMBOL macro. .RE .sp -.IP 5) +.IP 6) User-defined variables: .sp The user may define CFLAGS, LDFLAGS or DPFLAGS as additional flags to be used |