Print something after successful creation in Makefile.am

I am new to autotools and managed to create at the moment, satisfying configure.ac. Now I would like to indicate somewhere (configure.ac, Makefile.am or anywhere else) that after a successful "make" a short note is printed. Something like "Make sure you also provide the correct path in LD_LIBRARY_PATH."

However, when I specify it in Makefile.in, executing "automake" overwrites this file (as expected). Therefore, I did not find how to extend, for example. Makefile.am include "echo Make sure you also include the correct path in you LD_LIBRARY_PATH" after completing the compilation of one of the targets. ATM I have only one target (bin_PROGRAMS = myprog). In addition, compilation, etc. It works great. But as information for a potential "inexperienced" user, I really would like to give the final advice.

Is there any way to achieve this?

Thanks and best regards.

PS I know about cmake and have not used it yet, and at the moment I want to work with autotools and automake.

+3
source share
2 answers

---- install-exec-hook , 100% ----

Makefile, "install:" Makefile.am

"Makefile.am" :

install: install-am
        echo "Don't forget to set your LD_LIBRARY_PATH"

, Makefile Makefile.am. , , .

, Makefile. , Makefile.am, , automake Makefile.in Makefile, , .

, "" . , , "" automake.

, "make install-exec", . "make install-exec",

  • "make install" ( ).
  • "make install-exec "( ).
  • install-am .

// note the lack of install: override int Makefile.am
install-exec: install-exec-am
        echo "Be sure to update your LD_LIBRARY_PATH"

install-am: all-am
    @${MAKE} $(AM_MAKEFLAGS) install-data install-exec

---- ----

. autotools, install-data install-exec. "exec".

makefile.am -exec-hook

:

install-exec-hook:
        echo "Be sure to set your LD_LIBRARY_PATH!"

install-data, install-exec, uninstall, dist distcheck -hook.

, , . Make/Automake , , .

+7

Makefile.am:

all-local:
        @echo 'Make sure...'
+4

Source: https://habr.com/ru/post/1792029/


All Articles