automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Automatic dependecy based compilation targets


From: Dizzy
Subject: Automatic dependecy based compilation targets
Date: Wed, 31 Jan 2007 13:44:39 +0200
User-agent: KMail/1.9.5

Hi there

I would like to somehow describe a Makefile.am file as:

libsocket_a_SOURCES=Socket.cpp Socket.hpp

libconnection_a_SOURCES=Connection.cpp Connection.hpp
libconnection_a_LIBADD=libsocket.a

And then, if I have a sbin_PROGRAMS like
sbin_PROGRAMS=prog1

prog1_SOURCES=...
prog1_LDADD=libconnection.a

automake should generate a makefile that has targets for libsocket.a and 
libconnection.a ONLY as needed. I mean this because if prog1 with it's LDADD 
will be compiled or not depends on automake conditionals and when it will be 
compiled the automake should automatically also create noinst_LIBRARIES for 
libconnection.a (because prog1 depends on that) and then on libsocket.a 
(because libconnection.a depends on that) but it SHOULD NOT try to build 
libconnection.a and/or libsocket.a if there is no need for them. Currently 
this could probably be implemented with additional conditionals like this:

noinst_LIBRARIES=
sbin_PROGRAMS=

if BUILD_PROG1
sbin_PROGRAMS += prog1
prog1_SOURCES=...
prog1_LDADD=libconnection.a
need_libconnection=1
endif

if need_libconnection
noinst_LIBRARIES += libconnection.a
libconnection_a_SOURCES=Connection.cpp Connection.hpp
libconnection_a_LIBADD=libsocket.a
need_libsocket=1
endif

if need_libsocket
noinst_LIBRARIES += libsocket.a
libsocket_a_SOURCES=Socket.cpp Socket.hpp
endif

But this is very complex (and redundant as one has to specify dependencies in 
2 places one with LIBADD/LDADD and the other with those variables to trigger 
the dependency targets), imagine that there are hundreds of small noinst 
libraries each with it's own dependency, thus one would need to make hundreds 
of conditionals like that. I would like to know if automake can do it 
automatically somehow (or maybe if someone knows of another build system that 
can).

Thank you!

-- 
Mihai RUSU                                      Email: address@hidden
GPG : http://dizzy.roedu.net/dizzy-gpg.txt      WWW: http://dizzy.roedu.net
                        "Linux is obsolete" -- AST




reply via email to

[Prev in Thread] Current Thread [Next in Thread]