automake
[Top][All Lists]
Advanced

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

Re: Multiple install targets


From: Ralf Wildenhues
Subject: Re: Multiple install targets
Date: Tue, 13 Dec 2005 10:43:50 +0100
User-agent: Mutt/1.5.11

Hi Marwan,

* Marwan Badawi wrote on Tue, Dec 13, 2005 at 10:09:56AM CET:
> 
> I was wondering if it were possible to make multiple install targets 
> using automake. I have a project for building a library and a small 
> binary executable with some test data as an example of how to use the 
> library. What I would like to do is give the user the choice to install 
> either the entire package or just the library. Something in the lines of:
> 1 - make install to install the library, the executable and the data.
> 2 - make install-libonly to install the library only.
> 
> The default make install should install everything, which is why I can't 
> use the install-data and install-exec rules (as far as I understand how 
> they work, at least).

Two ways I could think of:
- with a hack (using nonpublished internal Automake details):

  install-libonly: install-libLTLIBRARIES

(if the library is not created with libtool, I guess that would be
install-libLIBRARIES).  This may fail with any future Automake version
(or older, FWIW, tested only with 1.9.6).


- without a hack: by replicating the rule Automake generates:

install-libonly: $(lib_LTLIBRARIES)
        @$(NORMAL_INSTALL)
        test -z "$(libdir)" || $(mkinstalldirs) "$(DESTDIR)$(libdir)"
        @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=`echo $$p | sed -e 's|^.*/||'`; \
            echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) 
'$$p' '$(DESTDIR)$(libdir)/$$f'"; \
            $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) "$$p" 
"$(DESTDIR)$(libdir)/$$f"; \
          else :; fi; \
        done

with modifications should your library not be created with libtool or
have a different directory prefix (the `lib' in lib_LTLIBRARIES,
corresponding to `libdir').

Should you use a recursive Makefile structure, you'd need to write the
necessary recursion targets as well, unfortunately.

Cheers,
Ralf




reply via email to

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