On 2017-09-05, Kip Warner <address@hidden> wrote:
[...]
Hey Thomas. Good question. It could well be that no hackery at all is
required with this. Here is my Makefile.am:
https://github.com/cartesiantheatre/narayan-designer/blob/master/Source/Makefile.am
See parser_clobbered_source_full_paths as an example. This variant
containing the full path is used in BUILT_SOURCES, nodist_..._SOURCES,
CLEANFILES, and as a target.
The parser_clobbered_source_files_only variant containing the file
names only is used on line 150 as a workaround for where bisonc++(1)
emits its files.
If you can see a more elegant way of solving the same problem I'm
trying to, I'm all ears.
If your only uses of the directoryless-filenames are in rules, then
just write the names including directories in the make variables,
then strip off the directory components inside the rule. In rules
you can use the much more powerful shell constructs.
Example:
% cat >Makefile <<'EOF'
FOO = a b/c d/e/f
my_rule:
for i in $(FOO); do \
case $$i in */*) i=`expr "$$i" : '.*/\(.*\)'`; esac; \
printf '%s\n' "$$i"; \
done
EOF
% make my_rule
a
c
f