LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Compiling files in another directory (https://www.linuxquestions.org/questions/linux-newbie-8/compiling-files-in-another-directory-4175495397/)

jyunker 02-18-2014 12:37 PM

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

John VV 02-18-2014 01:23 PM

Quote:

I moved the script to a second newly created directory and modified the script.
why move the "Makefile" in the first place ?

jyunker 02-18-2014 01:29 PM

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

John VV 02-18-2014 02:31 PM

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


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