[Top][All Lists]

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

Re: Complex pattern rules broken in win32-make (MINGW).

From: Eli Zaretskii
Subject: Re: Complex pattern rules broken in win32-make (MINGW).
Date: Tue, 02 Jan 2007 23:48:13 +0200

> Date: Tue, 2 Jan 2007 18:25:23 +0100
> From: "Peter Dons Tychsen" <address@hidden>
> However, i am not sure i like the solution where i have to use "/"
> instead of "\".
> This solution can lead to other errors.
> Consider the following example:
> obj/%.o: src/%.c
>   some_odd_win_compiler -c -o $@ $<
> Now the compiler will be called with (for src.o target):
> # some_odd_win_compiler -c -o obj/src.o obj/src.c
> This will not work for many dos/win tools, as they might puke on the "/"
> in the path.

Not if you enclose $@ and $< in double quotes -- which you should do
anyway, since you can never know when the actual file name will have
embedded spaces.

> All of these scenarios fail:
> 1) obj\%.o: src\%.c     - I understand why this will never work (See
> Eli/Pauls remarks).
>                           Is consistent with the way a DOS path is
> expressed in C ("c:\\some\\path").
> 2) obj/%.o: src/%.c     - This should work, as DOS/WIN make accepts "/"
> as "\" for paths.
> 3) obj\\%.o: src\\%.c   - This should work, as the double "\" should
> undo the effect a single "\" has on a "%".
>                           (like other escaped sequences - escaped left
> to right, with no recursive parsing).
> 2) & 3) probably fails due to the way (or maybe the order) in which the
> rules and prequisite lines are parsed.
> If i wanted to fix this, where should i start?

Please start by showing us the minimal Makefile that can be used to
reproduce the problem, and the error message(s) you see on your
machine with variants 2) and 3).

FWIW, I use variant 2) in all my Makefiles, and I have yet to see a
single case where it fails.


reply via email to

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