automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automake Digest, Vol 175, Issue 3


From: Thomas Jahns
Subject: Re: Automake Digest, Vol 175, Issue 3
Date: Thu, 7 Sep 2017 10:22:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hello,

On 09/06/17 00:57, Nick Bowler wrote:
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

Really the only part, where names need to be included verbatim is in so-called automake primaries. Those need the names for the make dist rules. In other words, files that are not distributed don't need to be spelled out, the name can be computed instead. If you want to add or remove the directory part is then more a question of whether the files with or without need to go into the distribution tar.xz.

If you assume a reasonably-POSIXish shell, you can use something like
$${i##*/} to strip directory parts instead (I think this form will fail
on at least Solaris /bin/sh).

That's an argument in favor of adding the directory part since no comparable portability headache applies to

"dir/$$i"

Regards, Thomas

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]