www.digitalmars.com         C & C++   DMDScript  

c++.command-line - Smake comparisions

reply "Rajiv Bhagwat" <brajiv giasbm01.vsnl.net.in> writes:
The following makefile is indicating that the smake is goofing up. Or am I?
-------------
all:
    echo "$*"
!if "$*" == "all"
    echo Target is "$*"
!else
    echo But target is "$*"
!endif
-------------
It prints "But...". So does 'maker' and even 'nmake' after complaining about
$*. Saying 'smake all' produces exactly the same result. What goes?
Sep 07 2001
parent reply "Walter" <walter digitalmars.com> writes:
Rajiv Bhagwat wrote in message <9nb7nk$1oii$1 digitaldaemon.com>...
The following makefile is indicating that the smake is goofing up. Or am I?
-------------
all:
    echo "$*"
!if "$*" == "all"
    echo Target is "$*"
!else
    echo But target is "$*"
!endif
-------------
It prints "But...". So does 'maker' and even 'nmake' after complaining

$*. Saying 'smake all' produces exactly the same result. What goes?

The $* is only valid for lines that start with whitespace. A line not starting with whitespace breaks the expansion, as your !if does.
Sep 07 2001
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
Well, that explains it. Any logic behind it?
We need to practice more 'modeless' programming to avoid such confusions.
-- Rajiv

Walter <walter digitalmars.com> wrote in message
news:9nc5sg$2933$1 digitaldaemon.com...
 Rajiv Bhagwat wrote in message <9nb7nk$1oii$1 digitaldaemon.com>...
The following makefile is indicating that the smake is goofing up. Or am


-------------
all:
    echo "$*"
!if "$*" == "all"
    echo Target is "$*"
!else
    echo But target is "$*"
!endif
-------------
It prints "But...". So does 'maker' and even 'nmake' after complaining

$*. Saying 'smake all' produces exactly the same result. What goes?

The $* is only valid for lines that start with whitespace. A line not starting with whitespace breaks the expansion, as your !if does.

Sep 08 2001
parent "Walter" <walter digitalmars.com> writes:
Makefiles are collections of random ad-hoc rules that conflict with each
other.

Rajiv Bhagwat wrote in message <9ncqpp$2n35$1 digitaldaemon.com>...
Well, that explains it. Any logic behind it?
We need to practice more 'modeless' programming to avoid such confusions.
-- Rajiv

Walter <walter digitalmars.com> wrote in message
news:9nc5sg$2933$1 digitaldaemon.com...
 Rajiv Bhagwat wrote in message <9nb7nk$1oii$1 digitaldaemon.com>...
The following makefile is indicating that the smake is goofing up. Or am


-------------
all:
    echo "$*"
!if "$*" == "all"
    echo Target is "$*"
!else
    echo But target is "$*"
!endif
-------------
It prints "But...". So does 'maker' and even 'nmake' after complaining

$*. Saying 'smake all' produces exactly the same result. What goes?

The $* is only valid for lines that start with whitespace. A line not starting with whitespace breaks the expansion, as your !if does.


Sep 08 2001