[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help creating a makefile that shows my current ip address
From: |
gabi |
Subject: |
help creating a makefile that shows my current ip address |
Date: |
Wed, 28 Apr 2010 11:29:39 -0700 (PDT) |
User-agent: |
SquirrelMail/1.4.17 |
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 creating a makefile that shows my current ip address,
gabi <=