The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Makefile help tantric High Level Programming 4 04-13-2007 01:35 AM
Makefile NamrataGurav High Level Programming 7 10-07-2006 02:29 PM
about the makefile ligerdave High Level Programming 2 01-31-2006 01:21 AM
Using cut within makefile wvdeijk UNIX for Dummies Questions & Answers 2 12-14-2005 05:11 PM
makefile ECBROWN UNIX for Dummies Questions & Answers 4 02-17-2005 12:01 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-03-2005
pieter023 pieter023 is offline
Registered User
  
 

Join Date: May 2005
Posts: 3
makefile help

i'd like to execute a particular command if i'm running gcc version 3.2 for instance.

my approach is as follows:
GCC_VERSION := `gcc --version | head -1`

suppose the result of `gcc --version | head -1` was
gcc 3.2

then i'd like to perform the following:
ifeq ($(GCC_VERSION), "gcc 3.2")
...
endif

... i know the result of gcc --version is not as clean and elegant as "gcc 3.2", but just suppose it was -- in fact it's not even gcc that i want to do this for, but again suppose it was ... the ifeq doesn't work for me. any suggestions on how i can achieve what i'm attempting to do?
  #2 (permalink)  
Old 06-06-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
As far as I can understand, you are looking to run some statements if you have gcc 3.2.

On my machine, gcc --version | head -1 gives

Code:
gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-47)
Why dont you extract the 3.2.3 and then carry on with your make.

Your modified code would be

Code:
GCC_VERSION := `gcc --version | head -1 | awk -F" " '{ printf $3 }'`
which will print out

3.2.3

Your ifeq statements looks fine. For more help on ifeq see

http://www.gnu.org/software/make/man...er/make_7.html

You could also checkout findstring option available for makefile to check for the required gcc --version.

vino
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0