LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2014, 01:37 PM   #1
jyunker
Member
 
Registered: Aug 2009
Posts: 167

Rep: Reputation: 0
Compiling files in another directory


I have some c source files in one directory that I know can compile with a separate script. I now what to make some changes and recompile them.

I moved the script to a second newly created directory and modified the script.

I then thought there is no need to move the source over to the new directory, I can just say in the new script where to locate the c source files in the old directory.

The new directory will have the compiled executable, plus each file translated into some other language such as c to opencl.

Now each c source file could have path in the new script, but there are about 80 files. That seems a lot of uneeded work. Is there away to tell the compiler where to find the files in the old directory without giving a path heading to each file?

Any help appreciated.

I have Centos 6.5, 64 bit.

Thanks.

jyunker
 
Old 02-18-2014, 02:23 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,817

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
Quote:
I moved the script to a second newly created directory and modified the script.
why move the "Makefile" in the first place ?
 
Old 02-18-2014, 02:29 PM   #3
jyunker
Member
 
Registered: Aug 2009
Posts: 167

Original Poster
Rep: Reputation: 0
Why use separate directories

It will generate a lot of extra files in addtion to just the one executable. I want to keep everything separate for my sanity.

I have several rewrites planed and do not want so many rewritten files all in one directory - confusing.

I thought this was a good way to keep things separate. Just do one rewrite per directory.

Thanks

R,

jyunker
 
Old 02-18-2014, 03:31 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,817

Rep: Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408Reputation: 2408
makefiles are all relative $PATH
just use a copy of the folder as a build folder
or
port it to use cmake
cmake defaults to using a build folder in one higher up folder
 
  


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
[SOLVED] Deleting the source directory and build directory after compiling each package ganiz Linux From Scratch 2 11-22-2013 06:59 AM
[SOLVED] compiling a C program with header files in a separate directory emaritza Linux - Newbie 6 06-12-2012 06:47 PM
Copy a directory into another directory while ignoring specific directories or files wh33t Linux - Newbie 14 05-16-2012 09:13 PM
Automatically Copying files from the ftp directory into the html directory swatward Linux - General 3 04-17-2005 11:55 PM


All times are GMT -5. The time now is 08:37 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration