Java EE Development of various types of resources download list, the history of the most complete IT resources, personal collection summary.
After a long time studying and studying the Linux GNU make project manager, now share the learning experience with you and hope this article will teach you something useful.
Make tool is a tool that all users who want to program on the Linux/unix system need and must master. If you write a program that does not use make tools, it means that the program you are writing is just a personal practice program, not a practical program, so we must learn, master and use it flexibly.
In a Linux/unix system, it is customary to use a makefile or Makfile file as the make command target file. The most important and basic function of make tools is to describe the interdependencies between source programs through makefile files and to automate the maintenance of compilation work. The makefile file needs to be written in a syntax that explains how to compile each source file and connect to build the executable file, and requires that you define dependencies between the source files.
The overall structure of multi-file compilation
As shown in the following illustration, this example includes float type addition, addition header function, int type addition, main main function, float type subtraction, subtraction header function, int type subtraction
Main function
[CPP] View plain copy print? #include "Add.h" #include "sub.h" #include <stdio.h> int main () { int x, y; float a, b; x=5; y=2; a=5.5; b=2.2; printf ("%d + %d = %d/n ", x, y, add_int (x, y)); printf ("%3.1f + %3.1f = %3.1f/n", a, b, add_float (a, b)); printf ("%d - %d = %d/n ", x, y, sub_int (x, y)); printf ("%3.1f - %3.1f = %3.1f/n", a, b, sub_float (a, b)); return 0; }
addition head function
[CPP] view plain copy print? /* Add.h/* #ifndef _add_h_ #define _ADD_H_ extern int add_int (int x, int y); extern float add_float (float x, float y); #endif
int type addition
[CPP] view plain copy print? /* ADD_INT.C */int add_int (int x, int y) {return x+y; }
Float Type addition
[CPP] View plain copy print/* add_float.c */<