Re: [A-a-p-user] Linking a program with a directory??
Brought to you by:
vimboss
From: Magnus T. <ma...@th...> - 2004-07-23 16:10:44
|
On Fri, Jul 23, 2004 at 01:06:43PM +0200, Bram Moolenaar wrote: > >Magnus Therning wrote: > >> I am feeling really stupid here, but I simply can't get it to work! >>=20 >> Files: >>=20 >> foo.c >> foo.h >> main.c >>=20 >> main.aap: >>=20 >> :dll foo : foo.c >>=20 >> :program bar { add_LIBS =3D -lfoo } : main.c >>=20 >> Result: >>=20 >> Aap: cc -MM foo.c > build-Linux2_6_7_1_k7/foo.c.aap >> Aap: cc -O2 -fPIC -c -o build-Linux2_6_7_1_k7/foo.sho foo.c >> Aap: ld -shared -o libfoo.so build-Linux2_6_7_1_k7/foo.sho >> Aap: cc -MM main.c > build-Linux2_6_7_1_k7/main.c.aap >> Aap: cc -O2 -c -o build-Linux2_6_7_1_k7/main.o main.c >> Aap: cc -O2 -o bar build-Linux2_6_7_1_k7/main.o -lfoo >> /usr/bin/ld: cannot find -lfoo >> collect2: ld returned 1 exit status >> Aap: Error in recipe "/home/magnus/prog/tst/aap_03/main.aap" line 3: Err= or executing commands for build default: Error in recipe "/usr/lib/aap/defa= ult.aap" line 414: Shell command returned 1 >>=20 >> I'd really like to get a '-L.' onto that last command, but how? > >Using add_LDFLAGS should work: > > :program bar {add_LDFLAGS =3D -L. }{ add_LIBS =3D -lfoo } : main.c > >Putting -L. in add_LIBS will also work. I'm not sure what is "cleaner". > >Another mechanism is to refer to the library directly instead of with >"-l": > > :program bar { add_LIBS =3D $(DLLPRE)foo$DLLSUF } : main.c > >That can also be used when the library is in another directory or >produced by a child recipe. That looks like an elegant way to me :-) Of course I had to try out the hierarchical build as well. Again I got stuck though :-( main.aap: :child foo/main.aap :child bar/main.aap foo/main.aap: :dll foo : foo.c bar/main.aap: :program { add_LIBS =3D $(DLLPRE)foo$(DLLSUF) } : main.c What I am stuck on that main.c needs foo/foo.h to compile. So, I'd like to add '-I../foo' when gcc compiles main.c. But I am at a loss! add_INCLUDE, INCLUDE, add_CPPFLAGS, CPPFLAGS... neither has any effect. How do I do it? I have to say that the documentation seems to miss some really essential parts here, doesn't it? A-A-P is a build tool, right? Why not have some examples of what people do with build tools? - Linking to libraries, both in and outside of the build. - Hierarchical builds, with dependencies between targets in different directories (make is considered harmful because of its poor support for this, I hope AAP is better) /M --=20 Magnus Therning (OpenPGP: 0xAB4DFBA4) ma...@th... http://magnus.therning.org/ Copyright today is a system inflicted on the public, not a system that benfits the public. -- Richard Stallman |