Section 2 - Maketiles Hakefiles are a simple way to organize code compilation. The goal of this to show you a starters guide so that you can quickly and easily create your own makefiles for small to medium-sized projects. Download from D2L the files hellomake .c, hellofunc. c, and hellofunc. h. Normally, you would compile this collection of code by executing the following command: gce o hellomake hellomake. c hellofunc.c I. gee will look in the current directory (.) for the include file hellomake.h. Without a makefile, the typical approach to the test/modify/debug cycle is to use the up arrow in a terminal to go back to your last compile command so you don't have to type it each time, especially once you've added a few more .c files to the mix. Unfortunately, this approach to compilation has two downfalls. First, if you lose the compile command or switch computer you have to retype it from seratch, which is inefficient at best. Second, if you are only making chamrges to one . c file, recompiling all of them every time is also time-consuming and inefficient. So, it's time to see what we can do with a makefile. The simplest makef ile you could create would look something like: hellomake: helloake, c hellofunc.c gec -o hellomake hellomake. c hellofunc.c -I. If you put this rule into a file called Makef ile or makef ile and then type make on the command line: it will execute the compile command as you have written it in the makefile. Note that make with no arguments executes the fint rule in the file. Furthermore, by putting the list of files on which the command depends on the first line after the :. make knows that the rule hellomake needs to be: executed if any of those files change. Immediately, you have solverl problem \#1 and ean avoid 1xing the up arrow repeatedly, looking for your last compile command. However, the system is still not being efficient in terms of compiling only the latest changes. One very important thing to note is that there is a tab before the gec command in the makefile. There must be a tab at the beginning of any command. In order to be a bit more efficient, let's try the following: CCmgCc CFLAGS*-I. hellomake: hellonake, o hellof une. 0 8(CC)-o hellomake hellomake . o hollofunc.0 So now we've defined some constants CC and CFLAGS. It tirns out these are sperial contants that communicate to make how we wint to compile the files bellomake. e and hellof une. e. In particular. the macro CC is the C compiler to use, and CFLAGS is the list of thigs to pas to the compilation comtand. By putting the object files-he1loaake , 0 and hollof unc. 0 - in the dependency list and in 2 the rule, make knows it must frst complle the e versions individually, and then build the executable hellomake. Using this form of makefile is sufficient for most small scale projects. However, there is one thing missing: dependency on the inelude files. If you were to make a change to hellomake h, for example, make would not recompile the .e files, even thotigh they needed to be. In order to fix this, we need to tell make that all e files depend on certan h files. We can do this by writing a simple rule and adding it to the makefile. CC=gcc CFLAGS--I. DEPS = hellomake h %.0:%.c$ (DEPS) $(CC)c0$0$5$ (CFLAGS) hellomake: hellomake. o hellofunc. 0 $(CC)0 hellomake hellomake o hellofune. 0 This addition first ereates the macro DEPS. which is the set of h fites on which the ef files depend. Then we define at rule that applies to all files ending in the o suffix. The rule says that the o file depends upon the x version of the file and the hiles included in the DSPS macro. The rule then says that to generate the o fle, innke neeck to compile the ec file using the compiler defined in the CC macro. The -e Hag says to generate the objcct file. the 0.54 says to pat the ontput of the compilation in tho file named on the left side of the s. the 8 s is the first item in the dependencies list, and the CFLAGS macro is defined as atwave. As a final simplification. let s tse the spectal macros $4 and $ s. which are thr left and right sides of the s respectively, to uake the qrerall compilation mie more general. In the example below. all of the incluie tils should be linted as part of the macero DEPS, and all of the object files should be listed as part of the macro DBJ. call otice rules. Fipiliente all the steps un the given coules