help-make
[Top][All Lists]
Advanced

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

RE: need help with the Makefile


From: ravi_murdeshwar
Subject: RE: need help with the Makefile
Date: Thu, 8 Sep 2005 17:47:18 -0600

Hi John,

#2 is taken care.

I need help with #1. current project involves compiling linux embedded software 
code which can be compiled by pointing to different linux kernel versions and 
target OS/platform (such as Vxworks)

Make system should support some of the following
1. able to build it for linux kernel 2.4 and 2.6
2. able to build with GCC and cross-compile tools.

What is the best way to achive it
a. should I ask user to pass some env variable such as KVER=2.4 or KVER=2.6 at 
the make command line and then check the $(KVER) and setup the flags 
accordingly.


Also is it possible to check for empty variable and exist with some error msg 
like following

check_ver:
        ifeq ($(strip $(KVER)),)
          @echo "Error: Please set KVER"
        Endif

I get following error msg.

ifeq (,)
/bin/sh: -c: line 1: syntax error near unexpected token `,'
/bin/sh: -c: line 1: `ifeq (,)'
make: *** [check_ver] Error 2


Thanks ..
-- 
Raviraj Murdeshwar.
408.553.4318

> -----Original Message-----
> From: John Graham-Cumming [mailto:address@hidden
> Sent: Thursday, September 08, 2005 11:51 AM
> To: address@hidden
> Cc: address@hidden
> Subject: Re: need help with the Makefile
> 
> address@hidden wrote:
> > Did anybody got the chance to take a look at following request ?
> 
> Not so far.  I'll try to answer your questions but they are a little
> hard to understand.
> 
> >    1. in common.mk, how do I set variables for different platforms and
> >       different OS versions(for the same platform)
> 
> You should do something to determine what platform you are on and then
> use a conditional such as ifeq to decide which variables to set.  You
> might like to take a look at the article I wrote for DDJ on Cross
> Plaforms Builds (a copy of it can be found on this page:
> http://www.electric-cloud.com/resources/)
> 
> >    2. is there any way to set target specific
> >       variables(CFLAGS/LDFLAGS/INCLUDE) instead of passing them at the
> >       command line to $(MAKE). As CFLAGS list is long.
> 
> I think we'll be able to answer this if you define what you mean by a
> target.  If you mean target in the GNU Make sense (e.g. name of file to
> the left of :) then the answer is yes.  So have FOO have value bar for
> the target targ you would write:
> 
> targ: FOO=bar
> 
> John.






reply via email to

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