* Generally, the software installed by yourself is stored in/usr/local/software name, and the source file is stored in/usr/local/src.
* Add man path search to the man page of software installed in a separate directory:
If the software you installed is stored in/usr/local/software/, you may need
40 ~ in/etc/man. config ~ At around 50 rows, write the following line:
Manpath/usr/local/software/man
In this way, man can be used to query online files of the software!
* Tarball software: It is packaged with tar and then compressed. Usually there are:
- Source code
- Detection program file (name may be configue or config)
- Install and readme)
The basic process for installing a tarball Software: Download->Unbind the tarball->GCC source code compilation (generate the object file of the target file)->Use GCC to link function libraries, primary programs, and subprograms to form major binary files->Execute binary files
A. Compilation and link
- Compile: gcc-c a. c B. C and then generate a. o and B. O (A. C and B. C still exist)
- Link: gcc-o x a. o B. O generates the binary file X (. O and. C are linked together ). The. o file is the target file)
- If C or O parameters are not added for GCC compilation, A. Out binary file is generated by default.
B. Add the function library during compilation
- Gcc a. C-lm-L/lib-L/usr/lib-L indicates that the addition of a function library-m is the libm. So function library, and the extension is omitted.
- -L the path followed by the header file (by default, the system function library Linux is placed in/lib and/usr/lib)
1. Make and makefile (use the make tool to omit the above installation process)
- First, edit the makefile rule file. The content must contain the main execution file.
- After makefile is created, input the make command to compile the relevant files based on the content in the makefile.
2. Basic syntax and variables of makefile
- Makefile has two targets: Main and clean. If you want to create main, enter make main. If you want to clear some of them, enter make clean! If you want to clear the target file and then compile the main program, you can input: Make clean main.
[[Email protected] ~] # Vi makefilemain: Main. O Haha. O sin_value.o cos_value.o gcc-O main. O Haha. O sin_value.o cos_value.o-LM
# Create a new rule. The standard name of this rule is clean: Rm-F Main main. O Haha. O sin_value.o cos_value.
After execution is
[[email protected] ~]# make clean mainrm -rf main main.o haha.o sin_value.o cos_value.occ -c -o main.o main.ccc -c -o haha.o haha.ccc -c -o sin_value.o sin_value.ccc -c -o cos_value.o cos_value.cgcc -o main main.o haha.o sin_value.o cos_value.o -lm
[[email protected] ~]# vi makefileLIBS = -lmOBJS = main.o haha.o sin_value.o cos_value.omain: ${OBJS} gcc -o main ${OBJS} ${LIBS}clean: rm -f main ${OBJS}
The variable learned by shell script to simplify makefile
3.tar ball installation instructions
1>./configure
This step is to create the MAKEFILE file! Generally, the program developer will write a scripts to check your Linux
System, related software attributes, etc. This step is very important, because your installation information will be completed in this step in the future.
Of! For more information about this step, see readme or install related files in this directory!
2> make clean
Make reads the Dirty Clean job in makefile. This step may certainly exist, but I want to execute it because
He can remove the target file! No one is sure whether the source code contains the target file (*. O) compiled last time)
Yes, so it is more appropriate to clear it. At least wait until the newly compiled execution file is used.
Compiled by your machine!
3> make
Make will work on the compile row compilation behavior based on the pre-commit in makefile! The main task of compilation is to compile the source line GCC
Code can be compiled into object files that can be executed, but these object files usually require some libraries, such
Link to generate a complete execution file! Using make is to compile the original code into executable
File, and the executable file will be placed under the current directory, has not been installed into the pre-installation directory;
4> make install
This is usually the final installation step. Make will close the installation project in the MAKEFILE file and
The data compiled in one step is installed in the specified directory!
1. Detailed description of the tarball software make and makefile (additional information is required)