LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 09-11-2009, 01:03 AM   #1
lxpwj
LQ Newbie
 
Registered: Sep 2009
Posts: 7

Rep: Reputation: 0
help: makefile how to let it locate c compiler in a relative path?


hello, all,

I have set up a embedded SW project for ARM.
I have my ARM cross-compile tools ready, and the folder structure is like this

--arm compiler-
|[ ][ ][ ][ ][ ]--bin
--linunx kernel
|
|my code--
[][ ][ ][ ]|- folder 1
[][ ][ ][ ]|- folode 2

my makefile will be in folder1, folder2 and my code. How can I let CC point to arm compiler/bin path
I hope that this project can move to any folder and is not sticked to absolute path?
can you suggest it? thank you.

Last edited by lxpwj; 09-11-2009 at 01:07 AM.
 
Old 09-11-2009, 06:51 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by lxpwj View Post
hello, all,

I have set up a embedded SW project for ARM.
I have my ARM cross-compile tools ready, and the folder structure is like this

--arm compiler-
|[ ][ ][ ][ ][ ]--bin
--linunx kernel
|
|my code--
[][ ][ ][ ]|- folder 1
[][ ][ ][ ]|- folode 2

my makefile will be in folder1, folder2 and my code. How can I let CC point to arm compiler/bin path
I hope that this project can move to any folder and is not sticked to absolute path?
can you suggest it? thank you.
I am not a 'make' guru, but your question boils down to "how can assign a value to a variable in Makefile during execution" - which you can (and, I again, I do not remember off the top of my head).

So, at the moment you know the answer to the above, the backticks operator (i.e. `some command`) is your friend.

...

CC may also be an environment variable if it's of any help.

Last edited by Sergei Steshenko; 09-12-2009 at 03:29 AM.
 
Old 09-11-2009, 07:35 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Examples , using cross tools :

export LD_LIBRARY_PATH=/<path-to-cross-compiled-dependecy>/lib
.....

<path-to-cross>/arm-gcc <flags> code.c ......
.....

./configure CC="<path-to-armgcc> -L/<path-to-arm-tools>/lib/"
or
./configure \
CC="<path-to-armgcc> -L/<path-to-arm-/lib>/ -L/<path-to-other-cross-compiled-libs>/lib/"

.. and / or ..
make CC="<path-to-armgcc> -L/<path-to-arm-tools>/lib/"

Similar for includes ( headers) : -I/<path>
.....
Checking all path's : env | grep PATH
.....

Last edited by knudfl; 09-12-2009 at 05:11 AM.
 
Old 09-25-2009, 03:02 AM   #4
lxpwj
LQ Newbie
 
Registered: Sep 2009
Posts: 7

Original Poster
Rep: Reputation: 0
thanks a lot
 
Old 09-25-2009, 03:38 AM   #5
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by lxpwj View Post
hello, all,

I have set up a embedded SW project for ARM.
I have my ARM cross-compile tools ready, and the folder structure is like this

--arm compiler-
|[ ][ ][ ][ ][ ]--bin
--linunx kernel
|
|my code--
[][ ][ ][ ]|- folder 1
[][ ][ ][ ]|- folode 2

my makefile will be in folder1, folder2 and my code. How can I let CC point to arm compiler/bin path
I hope that this project can move to any folder and is not sticked to absolute path?
can you suggest it? thank you.
Code:
$ make CC=(path to compiler)
 
  


Reply



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
java applet not loading image with relative path but loads image with absolute path amolgupta Programming 2 07-20-2009 01:58 PM
Need help in displaying the relative path zacodi Linux - Newbie 2 07-05-2007 04:14 PM
[bash] relative path grezly Programming 1 01-16-2007 02:30 PM
relative to absolute path vishalbutte Programming 4 01-14-2006 03:17 PM
Relative Path? mikeshn Linux - General 3 05-10-2002 04:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:38 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration