Double dots in middle of file path inside Makefile???

Jul 2, 2009 at 10:43pm
Hi,

I am working on CBC library and C++. I got an example of make-file along with the library. In the file, there are lines (like the following) having "double dot" inside file path, like 'cat /xxx/yyy/../zzz'.
What does this "double dots" mean? Also, what does the word "cat" do in this case?

Thanks

LIBS = -L$(COINLIBDIR) -lCbcSolver -lCbc -lCgl -lOsiClp -lOsiCbc -lOsi -lClp -lCoinUtils \
-lm \
`cat /home/XXXX/Cbc-2.3.0/build/lib/../share/doc/coin/Cgl/cgl_addlibs.txt` \
`cat /home/XXXX/Cbc-2.3.0/build/lib/../share/doc/coin/Osi/osi_addlibs.txt` \
`cat /home/XXXX/Cbc-2.3.0/build/lib/../share/doc/coin/Clp/clp_addlibs.txt` \
`cat /home/XXXX/Cbc-2.3.0/build/lib/../share/doc/coin/CoinUtils/coinutils_addlibs.txt`
Jul 2, 2009 at 10:55pm
".." denotes the parent directory. Like a "go back one directory" indicator.

Therefore: build/lib/../share/
is the same as: build/share/

"cat" usually means "concatenate" -- which means to append one string onto the end of another. What is means in this context I have no idea, I never understood makefiles.
Jul 2, 2009 at 11:16pm
Oh I see. Thank you for your fast reply.

I went to look on those files "cgl_addlibs.txt", "osi_addlibs.txt", "clp_addlibs.txt" and "coinutils_addlibs.txt". They all have only one command option "-lm".
So, in this case, there will be 4 -lm as part of LIBS variable?
Jul 3, 2009 at 12:02am
cat is a Unix command to display files.
http://linux.die.net/man/1/cat

The grave accent-delimited string is a bash command idiom to replace the line with the result of the command.

Hence, that line uses a cheap trick to place the contents of those various .txt files into the LIBS variable. If you look at those files, they all contain just a single line with more -llibrary specifications, like
-lCgl_extra
--anything extra that the compile process may need to link the files. As already noted, they only contain a link to the C math library (-lm), which is fine... (repeating libs shouldn't cause problem with a good linker)

However, the idea of adding libraries into the link process that way personally bothers me...
Last edited on Jul 3, 2009 at 12:02am
Jul 3, 2009 at 11:06pm
That clears all my questions! Thank you very much Duoas and Disch!
Topic archived. No new replies allowed.