Can autotools be configured to do a rolling install/uninstall?

219 views Asked by At

Let me be clear what I mean by rolling install.

let us assume I am working on a project where I am installing the lib libmylib.so into /usr/lib.

The process I use to do this is simply type "make install".

Now let us assume that /usr/lib already contains /usr/lib/libmylib.so and /usr/lib/libmylib.so.1 .

I want autotools to generate a makefile that does a

mv /usr/lib/libmylib.so.1 /usr/lib/libmylib.so.2
mv /usr/lib/libmylib.so  /usr/lib/libmylib.so.1
install libmylib.so into /usr/lib

I would also like, for some fixed number N to simply delete /usr/lib/libmylib.so.N instead of moving it.

I would also like a make target uninstall so that when I do "make unstall". The system is restored as well as it can be to befoire I installed it.

1

There are 1 answers

0
Brett Hale On

You can define an install-exec-local and install-data-local rule in Makefile.am, for (example) libmylib.so and mylib.h respectively.

automake supports an uninstall-local rule. The other prefix is -hook, which runs after the corresponding rule.

Your scheme shouldn't be used for any released software, obviously. It breaks the expected behaviour of an autotools package, especially with a hard coding of the /usr prefix. You could use 'proper' libtool versioning, which typically installs a libmylib.la metadata file as well.