This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Compiler/linker options and search parths (drives me crazy)


Hello all,

I have a problem which drives me crazy, perhaps someone can show me how to
solve this simple(?) thing.

I will try to be short. So we have the following folders and files.

 ./shared
 ./shared/shared1.h
 ./shared/shared1.cpp

 ./target1
 ./target1/target1.cpp
 ./target1/Makefile

 ./target2
 ./target2/target1.cpp
 ./target2/Makefile

 ...

I order to avoid writing each Makefile for the targets manually, I wanted to
have something like

 DIR = /root/test

 all : main

 main : target1.cpp
         gcc -I$(DIR) -c target1.cpp
         gcc -I$(DIR) shared/shared1.o target1.o -o target1


or for the 2nd target

 ...

 main : target12.cpp
         gcc -I$(DIR) -c target2.cpp
         gcc -I$(DIR) shared/shared1.o target2.o -o target2

This does not work because gcc will not find shared/shared1.o. Okay, I could
write ../shared/shared1.o but this will bring
me into other trouble.

So my question is: Is there a compiler option which causes the gcc to search
for .o files also in other directories? I have
already tried -B and -L but without any help.

Thanks
Manuel





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]