help-make
[Top][All Lists]
Advanced

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

RE: help creating a makefile that shows my current ip address


From: Brown, Michael
Subject: RE: help creating a makefile that shows my current ip address
Date: Wed, 28 Apr 2010 23:25:31 +0200

Wild stab:
SERVERIP=$(shell getent hosts `hostname` | cut -f1)
all:
     @echo -n "set serverip "
     @echo $(SERVERIP)

Notice the lack of spaces surrounding the = sign.  Don't remember if it makes a 
difference with make, or not.
We use the shell command here at work, but don't pipe within the command, so I 
don't know is that is where it is breaking, or not.
MB
 --
You design it, I'll build it
e-mail: address@hidden
desk: 608-288-6969
cell: 608-206-6843


> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On Behalf
> Of address@hidden
> Sent: Wednesday, April 28, 2010 1:30 PM
> To: address@hidden
> Subject: help creating a makefile that shows my current ip address
>
> Hi.
>
> I am a newbie when it comes to make.
>
> I am trying to create a simple Makefile that will echo the IP address as
> part of the line, in order to tell me what command to pass to uBoot
> after
> I compile my program.
>
> I want make to generate output like this:
> > set serverip 192.168.1.171
>
> where "set serverip " is a simple string and the actual IP address is
> returned from a command like the following:
>
> > ifconfig | sed -n '/192\.168\.1\./p' | cut -c -33 |cut -c 21
>
>
> I am using the ubuntu 9.04 included make:
> > make --version
> > GNU Make 3.81
>
> When I tried the above ifconfig command as part of the Makefile I got an
> error.
>
> Initially I used this command:
> ------------- Makefile -------------------------------------------
> severip := $(shell ifconfig | sed -n '/192\.168\.1\./p' | cut -c -33
> |cut
> -c 21)
>
> all:
>     @echo -n "set serverip "
>     @echo $(serverip)
> -------------- Makefile end---------------------------------------
>
> It complained about
> /bin/sh: Syntax error: "(" unexpected
> make: *** [all] Error 2
>
>
> So I have simplified my Makefile to look like this:
>
> ------------- Makefile -------------------------------------------
> severip := $(shell ifconfig)
>
> all:
>     @echo $(serverip)
> -------------- Makefile end---------------------------------------
>
> or this:
>
> ------------- Makefile -------------------------------------------
> severip := $(shell /sbin/ifconfig)
>
> all:
>     @echo $(serverip)
> -------------- Makefile end---------------------------------------
>
>
> I still get this error:
> /bin/sh: Syntax error: "(" unexpected
> make: *** [all] Error 2
>
> I do not know what to do to get passed this.
>
> Any help would be appreciated,
> Thank you,
> Gabi Voiculescu
>
>
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make

The information contained in this message may be confidential and legally 
protected under applicable law. The message is intended solely for the 
addressee(s). If you are not the intended recipient, you are hereby notified 
that any use, forwarding, dissemination, or reproduction of this message is 
strictly prohibited and may be unlawful. If you are not the intended recipient, 
please contact the sender by return e-mail and destroy all copies of the 
original message.




reply via email to

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