Washington State University HomeWSU AdmissionsWSU CampusesWSU HomeWSU Search Tools*

edge graphic
image001

Home

Syllabus

Notes

Homework

Grades


Homework 4 - Make


Given out Wednesday October 5, 2011

Due via ANGEL on Tuesday, October 11, 2011 at 6pm via ANGEL.

Given the following ridiculous example programming project:

File hello.h

#include <stdio.h>


File main.c

#include "hello.h"
 
main()
{
    printhello();
    credits();
}


File print.c

#include "hello.h"
 
void printhello()
{
    printf ("Hello world!\n");
}


File credits.c

#include "hello.h"
 
void credits()
{
    printf ("\n(This ridiculous example of overkill was created for CptS 224.)\n");
}
  1. (6 points) Write a Makefile that will correctly compile subparts "main.o", "print.o", "credits.o" and both "make helloworld" command and "make" commmand will assemble a program called "helloworld" from those parts. The dependencies should be correct so that if any of the 4 files is updated, the correct pieces will get rebuilt.
  2. (1 point) Your Makefile should be written so that "make clean" command will remove program "helloworld", "*.o" and any other executables which were created.
  3. (1 point) If you update "hello.h" (you can use the touch command to update the modification time of the file) what happens?
  4. (1 point) If you update "print.c" what happens?
  5. (1 point) If you update both "print.c" and "credits.c" what happens?