tags:

views:

76

answers:

3

You usually invoke the following commands to build a ./configured product:

make
make install

Okay, the product is in the system now. Then you change some source code files and invoke only make install. The question is, does the conventional implementation of install target requires the executables to be recompiled, or just the old ones should be copied to the appropriate system path?

+3  A: 

make deals with this by design if your dependencies are correctly set up.

If ̀make build a binary named helloworld. You will probably write your install target so it copies this helloworld binary from your source directory to /usr/bin.

It means that the install target should depend on helloworld binary which also mean that if the binary helloworld is not up-to-date it will be recompiled. Thous when you type make install make implicitly call make (default target here).

Ben
eee .. I just figure out that your question is actually about what the install target should depend on right ?
Ben
+2  A: 

It depends on whose conventional you like, of course. Here's the GNU convention:

install
Compile the program and copy the executables, libraries, and so on to the file names where they should reside for actual use.

And this seems like the sensible convention: having make install install out-of-date executables would mostly lead only to confusion.

John Marshall
+2  A: 

Yes, a well-written makefile will have install depend on the executable being installed (or on all), so it will ensure that the executable is up-to-date before installing it.

There are several reasons for the split. Conventionally, the default target is all and that doesn't install the files, only build them. For developers, this means that they can build the sources in their working environment easily without affecting the rest of their system. For end users, it means that they can run the build as a regular user, then only run make install as root.

It does mean that technically, the make stage of make; make install is redundant.

Andrew Aylett