Setting/Modifying variable specific to target in Makefile

Hi,

I have a small piece of Makefile script which throw's error on Sun Sparc machine, but works fine with Sun Optron, Linux, AIX machines.

FOO=Naveen
test1:FOO=Dhilip

test1:
@echo FOO is ${FOO}

test2:
@echo Me is ${FOO}

Output on Sun Sparc -

ukhml-v890new-~/test: make test1
make: *** No rule to make target `FOO=Dhilip', needed by `test1'. Stop.

Output on Sun Optron -

ukhml-helios-~/shivtest: make test1
FOO is Dhilip

Anyone has an idea, why this syntax error thrown on Sun Sparc ?

Regards.,
Naveen Sriram.

which version of make are you using on the two sun boxes ?
Also what version of O/S ? (Any patches installed that affect make ?)

Hi,

Thanks for taking a look on this.
Below details regarding Makefile version and OS details -

Optron -

ukhml-helios-~/shivtest: make -v
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
ukhml-helios-~/shivtest: uname -r
5.10
ukhml-helios-~/shivtest: cat /etc/release
                        Solaris 10 5/09 s10x_u7wos_08 X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                             Assembled 30 March 2009
ukhml-helios-~/shivtest: uname -X
System = SunOS
Node = ukhml-helios
Release = 5.10
KernelID = Generic_141445-09
Machine = i86pc
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 4

=========================================================

Sparc

ukhml-v890new-~/test: make -v
GNU Make version 3.75, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96
        Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

Report bugs to <bug-gnu-utils@prep.ai.mit.edu>.

ukhml-v890new-~/test: uname -r
5.10
ukhml-v890new-~/test: cat /etc/release
                     Solaris 10 3/05 HW1 s10s_wos_74L2a SPARC
           Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                             Assembled 14 July 2005
ukhml-v890new-~/test: uname -X
System = SunOS
Node = ukhml-v890new
Release = 5.10
KernelID = Generic_118833-03
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 8

ukhml-v890new-~/test:

======================================================

Is there any command through which I could figure out what are the patches been installed (non-root) which effect make ?

looks like the gnu make is different - might be worth dowloading 3.80 from Sunfreeware - Free and Open Source Software (FOSS) for Sun Microsystem's Solaris or the like...

Hmm...looks like...I will speak with my admin regarding upgrading version...will keep you informed once I am done with that.

Thanks a lot for your support.

I verified with version 3.81 and this syntax does work. Thanks a lot for your support.