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]

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


>
> 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
>
> I order to avoid writing each Makefile for the targets manually, I wanted to
> have something like
>

   SHRDIR = <dir where the "shared" is located>

>  DIR = /root/test
>
>  all : main
>
>  main : target1.cpp
>          gcc -I$(DIR) -c target1.cpp
>          gcc -I$(DIR) shared/shared1.o target1.o -o target1
>

gcc -I$(DIR) $(SHRDIR)/shared/shared1.o target1.o -o target1

>
> 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.

The above should work and may be acceptable for you? :)




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