Hello,

We've found it useful to have this substitution variable which basically
turns something like "src/foo.c" into "src/foo". It's been used where we
have e.g. an input and output subdir containing source files with the
same names which are part of the same lib/exe.

I've called it %F to match up with the %b/%B subs.

Cheers.

-- 
Alex

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/tup/parser.c b/src/tup/parser.c
index 3f21fb0..d10dc23 100644
--- a/src/tup/parser.c
+++ b/src/tup/parser.c
@@ -3399,6 +3399,19 @@ static char *tup_printf(struct tupfile *tf, const char *cmd, int cmd_len,
 				}
 				first = 0;
 			}
+		} else if(*next == 'F') {
+			int first = 1;
+			if(nl->num_entries == 0) {
+				fprintf(tf->f, "tup error: %%F used in rule pattern and no input files were specified.\n");
+				return NULL;
+			}
+			TAILQ_FOREACH(nle, &nl->entries, list) {
+				if(!first) {
+					estring_append(&e, " ", 1);
+				}
+				estring_append(&e, nle->path, nle->len - (nle->baselen - nle->extlessbaselen));
+				first = 0;
+			}
 		} else if(*next == 'b') {
 			int first = 1;
 			if(nl->num_entries == 0) {
diff --git a/tup.1 b/tup.1
index 80b88b9..0497c17 100644
--- a/tup.1
+++ b/tup.1
@@ -436,6 +436,9 @@ Within a command string or output string, the following %-flags may also be used
 .B %f
 The filename from the "inputs" section. This includes the path and extension. This is most useful in a command, since it lists each input file name with the path relative to the current directory. For example, "src/foo.c" would be copied exactly as "src/foo.c"
 .TP
+.B %F
+Like %f, but strips the extension. For example, "src/foo.c" would become "src/foo"
+.TP
 .B %b
 Like %f, but is just the basename of the file. The directory part is stripped off. For example, "src/foo.c" would become "foo.c"
 .TP

Reply via email to