Linux.com: Getting Started with Make - Part 3: DirectivesNov 23, 2000, 14:06 (0 Talkback[s])
(Other stories by Derek Barber)
"Directives are commands which you can put in your Makefiles to provide some neat enhancements. A very useful directive, called the include directive, allows you to include the contents of other files in your makefile. This can be very handy for organizing a large makefile into several files, among other things. There are also directives that provide the ability of conditional inclusion -- they decide whether to include or skip certain parts of a makefile based upon the value of variables. Finally, there is also a directive that enhances the handling of variables: the define directive."
"First, let's look at the include directive. The include directive is used to include the contents of a specified file into your makefile at a specified place. This is very useful for many things, especially with the organization of data and with the reusability of common makefile data. Before we get into an example, let's look at the general syntax of the include directive:
include filenames...Please note that you can include shell wildcard characters in the filenames parameter."
"Conditional directives are used when you would like to execute or ignore certain parts of a makefile depending upon the values of variables. This can be very useful when deciding to set certain compilation parameters based upon the installed libraries or the locations of files. The syntax of a simple conditional directive is as follows:
conditional-directive commands executed if conditional is true else commands executed if conditional is false endifIn the above syntax, the conditional-directive parameter can be one of several conditional directives."