LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-11-2005, 10:56 AM   #1
dand
LQ Newbie
 
Registered: Dec 2004
Posts: 18

Rep: Reputation: 0
makefile targets


I am trying to set an environment variable just before in a makefile target, just before I attempt to compile.

ie.

target: MYVAR=-DSOMETHING; ./exe_name

./exe_name: $(CPP_SOURCES:cpp=o)
gcc -o ./exe_name ..........

$(CPP_SOURCES:cpp=o): $(CPP_SOURCES)
gcc -o $*.o -c $*.cpp $(MYVAR)

So that the define can be picked up at compile time. it will be a different define for each target i am trying to build.

Is it possible to do this at all?

Cheers, Dan.
 
Old 07-11-2005, 03:28 PM   #2
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 46
when posting code--especially whitespace-sensitive code (such as makefiles and python scripts)--please put the code in `code tags' ([ code ] <your code goes here> [ /code ] -- but without the spaces near brackets).

In fact, I would recommend code tags for any files contents or program I/O--it mostly acts like the HTML <pre> tag.

(Of course, if it's PHP, use [ php ] instead )

In that way, people can more easily understand what you're trying to say, and help you better.

--Jonas
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
tinkering with dkms: make error no targets. Makefile issue? Emmanuel_uk Linux - Newbie 1 06-03-2005 01:26 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM
"no targets specified and no makefile found" liljhand Linux - Software 9 01-01-2005 12:54 PM
generate Makefile from Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 12:23 PM
[makefile] Do header files need to be set targets? chuanyung Programming 2 03-11-2004 09:22 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration