Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.unix.programmer > #16297

Re: Long filenames in DOS/Windows and Unix/Linux

From Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups comp.unix.programmer
Subject Re: Long filenames in DOS/Windows and Unix/Linux
Date 2024-09-04 14:30 +0000
Organization A noiseless patient Spider
Message-ID <20240904071628.892@kylheku.com> (permalink)
References (11 earlier) <87seug1iyj.fsf@nosuchdomain.example.com> <20240903155649.659@kylheku.com> <87jzfs1f6p.fsf@nosuchdomain.example.com> <vb87o7$3h6uk$2@dont-email.me> <87frqg1da2.fsf@nosuchdomain.example.com>

Show all headers | View raw


On 2024-09-04, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>> On Tue, 03 Sep 2024 16:38:06 -0700, Keith Thompson wrote:
>>>> The make utility has no support for paths with spaces.
>>> 
>>> Looks like you're right.
>>
>> I have some Makefiles with spaces in the dependency names, of the form:
>>
>>     target\ name\ with\ space : source\ name\ with\ space
>
> I'd be interested in knowing how you do that.
>
> $ cat Makefile
> foo\ bar: foo\ bar.c
> $ make
> cc     foo bar.c   -o foo bar
> cc: fatal error: input file ‘foo’ is the same as output file
> compilation terminated.
> make: *** [<builtin>: foo bar] Error 1

If you write your own rule in which $@ is quoted as '$@', it will
work, provided it doesn't contain ' characters.

It looks like there is limited support in GNU Make for backslash
escapes: they can be used on the prerequisite and target names
in a rule.

Elsewhere, other than backslash-newline continuations, backslashes
are literal.

So we can do:

  FOOBAR := foo\ bar   # literal backslash here

  $(FOOBAR) : ...   # backslash from variable interpolates here

Once the backslash is interpolated into the rule head, it becomes
active, so a single target "foo bar" is specified.

  (Unfortunately, what GNU Make should be arguably be doing here is not
  just treating foo\ bar as the single target foo bar but also
  preserving the backslash so that the item is foo\ bar. Then it would
  be possible for the implicit rule to work, because $@ would produce
  foo\ bar which would be passed on to the shell, where the backslash
  would do its job. One slight problem with that, though, is that the
  interpreter for processing recipes is configurable; it doesn't have
  to be a POSIX-like shell.)

Anyway, the FOOBAR variable is understood to contain two words, {foo\}
and {bar}. If we do a patsubst on it, it will match separately against
the two. Or foreach will iterate over two items.  None of the text
processing stuff in GNU Make will recognize the backslash escape
as preventing word splitting.

Nontrivial Makefiles almost always work with lists, like at the
very least OBJS, SRCS and whatnot.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Back to comp.unix.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2024-08-31 05:57 +0000
  Re: Long filenames in DOS/Windows and Unix/Linux Richard Kettlewell <invalid@invalid.invalid> - 2024-08-31 09:27 +0100
    Re: Long filenames in DOS/Windows and Unix/Linux Muttley@dastardlyhq.com - 2024-08-31 08:39 +0000
    Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-08-31 23:34 +0000
      Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-01 07:03 +0000
        Re: Long filenames in DOS/Windows and Unix/Linux Nuno Silva <nunojsilva@invalid.invalid> - 2024-09-01 09:10 +0100
        Re: Long filenames in DOS/Windows and Unix/Linux Helmut Waitzmann <nn.throttle@xoxy.net> - 2024-09-01 19:51 +0200
        Putting arbitrary characters into the shell command line (was: Long filenames in DOS/Windows and Unix/Linux) Helmut Waitzmann <nn.throttle@xoxy.net> - 2024-09-01 21:07 +0200
        Re: Long filenames in DOS/Windows and Unix/Linux Wayne <wayne@nospam.invalid> - 2024-09-03 13:56 -0400
          Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-03 21:54 +0000
        Re: Long filenames in DOS/Windows and Unix/Linux Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-09-08 07:24 +0200
      Arbitrary characters in filenames (was: Long filenames in DOS/Windows and Unix/Linux) Helmut Waitzmann <nn.throttle@xoxy.net> - 2024-09-01 20:06 +0200
  Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) Muttley@dastardlyhq.com - 2024-08-31 08:37 +0000
    Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) John Ames <commodorejohn@gmail.com> - 2024-09-03 08:44 -0700
      Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) scott@slp53.sl.home (Scott Lurndal) - 2024-09-03 15:47 +0000
        Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-09-03 15:54 +0000
      Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2024-09-03 16:10 +0000
        Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to Muttley@dastardlyhq.com - 2024-09-04 07:27 +0000
          User surveys (Was: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to) gazelle@shell.xmission.com (Kenny McCormack) - 2024-09-04 11:27 +0000
            Re: User surveys (Was: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to) Muttley@dastardlyhq.com - 2024-09-04 13:12 +0000
      Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) Kaz Kylheku <643-408-1753@kylheku.com> - 2024-09-03 17:37 +0000
        Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) John Ames <commodorejohn@gmail.com> - 2024-09-03 11:39 -0700
          Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) Kaz Kylheku <643-408-1753@kylheku.com> - 2024-09-03 20:11 +0000
            Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) John Ames <commodorejohn@gmail.com> - 2024-09-03 13:25 -0700
              Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) scott@slp53.sl.home (Scott Lurndal) - 2024-09-03 20:34 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-03 21:52 +0000
              Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-03 15:16 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-03 22:18 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux scott@slp53.sl.home (Scott Lurndal) - 2024-09-03 22:59 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-03 16:10 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-03 23:54 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-03 17:27 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-04 00:44 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-03 21:36 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-04 07:05 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Ralf Fassel <ralfixx@gmx.de> - 2024-09-04 11:47 +0200
                Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-04 03:44 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Nuno Silva <nunojsilva@invalid.invalid> - 2024-09-04 13:33 +0100
                Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux) gazelle@shell.xmission.com (Kenny McCormack) - 2024-09-04 13:04 +0000
                Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux) Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-09-04 13:17 +0000
                Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux) Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-04 21:35 +0000
                Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux) Kaz Kylheku <643-408-1753@kylheku.com> - 2024-09-05 02:29 +0000
                Re: Always use "--" (Was: Long filenames in DOS/Windows and Unix/Linux) Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-09-05 14:48 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-09-03 17:35 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Kaz Kylheku <643-408-1753@kylheku.com> - 2024-09-03 23:15 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-03 16:38 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-03 23:56 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-03 17:19 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-04 00:41 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-03 21:29 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-04 06:49 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Nuno Silva <nunojsilva@invalid.invalid> - 2024-09-04 10:16 +0100
                Re: Long filenames in DOS/Windows and Unix/Linux Kaz Kylheku <643-408-1753@kylheku.com> - 2024-09-04 14:30 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux John Ames <commodorejohn@gmail.com> - 2024-09-04 08:41 -0700
                Re: Long filenames in DOS/Windows and Unix/Linux Muttley@dastardlyhq.com - 2024-09-04 15:57 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Richard Kettlewell <invalid@invalid.invalid> - 2024-09-04 18:03 +0100
                Re: Long filenames in DOS/Windows and Unix/Linux Ralf Fassel <ralfixx@gmx.de> - 2024-09-05 11:29 +0200
                Re: Long filenames in DOS/Windows and Unix/Linux Richard Kettlewell <invalid@invalid.invalid> - 2024-09-05 18:21 +0100
                Re: Long filenames in DOS/Windows and Unix/Linux candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2024-09-07 18:20 +0000
                Word splitting oddities (Was: Long filenames in DOS/Windows and Unix/Linux) gazelle@shell.xmission.com (Kenny McCormack) - 2024-09-07 21:51 +0000
                Re: Long filenames in DOS/Windows and Unix/Linux Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-09-10 07:17 +0200
          Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-09-10 06:51 +0200
      Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to Muttley@dastardlyhq.com - 2024-09-04 07:31 +0000
  Re: Long filenames in DOS/Windows and Unix/Linux (Was: Piping to stdin) Marcel Mueller <news.5.maazl@spamgourmet.org> - 2024-09-01 11:44 +0200

csiph-web