Compiler/linker options and search parths (drives me crazy)
Muthukumar Ratty
muthu@iqmail.net
Sun Apr 6 19:18:00 GMT 2003
>
> 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? :)
More information about the Gcc-help
mailing list