|
Multiple Makefiles. Software installation.
Compilation and installation of software from its source code usually involves 4 steps:
download and untar the archive, configuration, compilation, and installation.
Multiple Makefiles may be involved if the software source is complex.
Exercise
Download the tar archive and extract the files:
Check out the directory tree of Project and the files contained there:
You should notice two Makefiles: one in the root of directory Project
and the other in subdirectory src1.
Configuration:
This sets the environment for the Makefiles.
Compilation:
The command make above processes Makefile in directrory Project:
This Makefile contains phony targets, envoking make in subdirectory src1,
which compiles the source codes, *.c, builds the library, the application
binary and places them into subdirectories lib and bin.
Makefile in directory Project/src1:
After the compilation procedure completes, there will be binary, object files, sources, in the library in the subdirectoies of Project:
Directory |
Files in the directory |
Project/ |
Makefile, configure
|
Project/src1 |
Makefile, main.c, Scalar_Product.c, main.o, Scalar_Product.o, app.x, libScalar_Product.a
|
Project/bin |
app.x |
Project/include |
Scalar_Product.h |
Project/lib |
libScalar_Product.a |
Installation of the binaries into the directories accessible to all users:
This would copy file app.x into the conventional directory for
software binaries, /usr/local/bin and set it executable for
all users on the system.
Try running command
It should fail with error message app.x: command not found.
The PATH environment variable needs to be modified to include /usr/local/bin:
The above can be placed either into individual users's .bashrc or
/etc/profile for all users.
The application now should run find by command
The installation also copies the library into /usr/local/lib.
If the compilation and installation of the code involved shared object libraries, *.so, and MAN pages, they would be
placed into
/usr/local/lib and /usr/local/man, accordingly.
Access to the MAN pages and shared libraries can be set either through
the environment variables
or configuration files /etc/ld.so.conf and /etc/man.config
|
|