LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Makefile: using targets to declare dependent vars (https://www.linuxquestions.org/questions/linux-software-2/makefile-using-targets-to-declare-dependent-vars-503512/)

blackcat_73 11-21-2006 03:39 AM

Makefile: using targets to declare dependent vars
 
Hi, I need to write a Makefile to change IP address of some PC's

I was trying this approach:

Code:

SUBNET=192.168.0.

all : install

pc1 :
IP=1

pc2 :
IP=2

install :
    ifconfig eth0 $(SUBNET)$(IP)


and then call like this:

Code:

make pc1 install
to change ip address of pc1 to 192.168.0.1

But IP var always get the last value, here =2

Can anyone help me on this?

I also need to read some value like: tux21, tux22, tux23, etc and separate:

tux21 in tux, 2 and 1...
tux22 in tux, 2 and 2...
tux23 in tux, 2 and 3...

Can I use sed to do this? If so, how?

Thanks,
Bruno


All times are GMT -5. The time now is 12:48 AM.