Description: Washington State University HomeDescription: WSU AdmissionsDescription: WSU CampusesDescription: WSU HomeDescription: WSU Search ToolsDescription: *

Description: edge graphic
Description: image001

size=2 width="100%" align=center>

Homework 4 - Make


Given out Tuesday October 2, 2012

Due via ANGEL on Tuesday, October 9, 2012 at 6pm

Given the following ridiculous example programming project:

File hello.h

#include <stdio.h>
#define NUM 100


File main.c

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


File print.c

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


File credits.c

#include "hello.h"
 
void credits(int count)
{
    printf ("\n(This ridiculous example of overkill was created for CptS 224, with useless parameter %d)\n", count);
}
  1. (60 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. (10 point) Your Makefile should be written so that "make clean" command will remove program "helloworld", "*.o" and any other executables which were created.
  3. (10 point) If you update "hello.h" (you can use the touch command to update the modification time of the file) what happens?
  4. (10 point) If you update "print.c" what happens?
  5. (10 point) If you update both "print.c" and "credits.c" what happens?