commit - 0a03edcc6fe538f35b9724e03d3bfc65cbf88e7b
commit + 3b83966cbf7a7699863a002b2f5ccd781fe6d607
blob - c52619858262af4e19a93002894418c2e2736ccb
blob + 95576f1bd287e6522fb76582eff4dc68bf994474
--- make/make.c
+++ make/make.c
* ${name:U} convert all characters to uppercase
* ${name:L} convert all characters to lowercase
* ${name:F} try searching for files in either ${.OBJDIR} or source directory
+ * ${name:E} replace every word by it's file suffix
+ * ${name:e} strip the file suffix for each word
* ${name:m1:m2...} multiple modifiers can be combined
*/
subst2 (out, sc, prefix, s, ctx)
extern subst ();
struct macro *m;
struct filetime ft;
- char *v, *orig = *s, *t, *w;
+ char *orig = *s, *t, *u, *v, *w;
str_t name, old, new;
/* parse macro name */
write_objdir (&new, sc);
str_putc (&new, '/');
}
+ str_puts (&new, w);
+ str_putc (&new, ' ');
+ }
+ str_pop (&new);
+
+ free (v);
+ v = str_release (&new);
+ } else if (strcmp (str_get (&old), "E") == 0) {
+ str_new (&new);
+
+ for (t = v; (w = strsep (&t, " \t")) != NULL; ) {
+ if (*w == '\0')
+ continue;
+
+ u = strrchr (w, '.');
+ if (u == NULL || strchr (u, '/') != NULL)
+ continue;
+
str_puts (&new, w);
str_putc (&new, ' ');
}
+
str_pop (&new);
+ free (v);
+ v = str_release (&new);
+ } else if (strcmp (str_get (&old), "e") == 0) {
+ str_new (&new);
+ for (t = v; (w = strsep (&t, " \t")) != NULL; ) {
+ if (*w == '\0')
+ continue;
+
+ u = strrchr (w, '.');
+ if (u != NULL && strchr (u, '/') == NULL)
+ *u = '\0';
+
+ str_puts (&new, w);
+ str_putc (&new, ' ');
+ }
+
+ str_pop (&new);
free (v);
v = str_release (&new);
} else {