5.4. MakeThe make utility sorts out dependency relations between files, automatically determines which pieces need to be recompiled, and issues commands to recompile them. It is the biggest contribution to the UNIX development environment dating back to System V enabling easy management of large program projects. Over the years, make has been changed and enhanced. AIX still uses a version of the UNIX System V make, which is not compatible in Linux. To build code in Linux, you must use the GNU Make (gmake), which is part of the FSF GNU GCC (GNU Compiler Collection). The GNU Make includes enhanced features that are not included in the traditional make. 5.4.1. gmake Condition StatementsOne of the most useful features that gmake has and regular make does not is the use of conditional statements. Example 5-1 examines this useful feature. Example 5-1. GNU Makefile
The traditional AIX make generates the following errors: /: > make "Makefile", line 22: make: 1254-055 Dependency line needs colon or double colon operator. "Makefile", line 24: make: 1254-055 Dependency line needs colon or double colon operator. "Makefile", line 26: make: 1254-055 Dependency line needs colon or double colon operator. make: 1254-058 Fatal errors encountered -- cannot continue. The same makefile builds fine with GNU Make. For a list of other enhancements, visit the official GNU home page (at the time of this writing www.gnu.org/software/make/manual/make.html). |