Description: WSU Admissions


Description: image001

Homework 4 - Make


Given out Friday, October 4, 2019.

Due via Blackboard on Tuesday, October 8 at1159pm. As always, please have it reasonably formatted in a pdf for ease of grading. Unless, um, you don’t want the grader to give you the benefit of the doubt in things that are not 100% clear to him! (Think that one through, my young padwans!)

Given the following ridiculous example programming project:

File HastaLaVistaBaby.h

#include <stdio.h>
#define NUM 256


File main.c

#include "HastaLaVistaBaby.h"
 
main()
{
    printHastaLaVistaBaby();
    credits(NUM);
}


File print.c

#include "HastaLaVistaBaby.h"
 
void printHastaLaVistaBaby()
{
    printf ("HastaLaVistaBaby cruel world!\n");
}


File credits.c

#include "HastaLaVistaBaby.h"
 
void credits(int count)
{
    printf ("\n(This ridiculous example of overkill was created for CptS 224, 
             with meaningless parameter %d)\n", count);
}
  1. (60 points) Write a Makefile that will correctly compile subparts "main.o", "print.o", "credits.o" and both "make HastaLaVistaBabyworld" command and "make" commmand will assemble a program called "HastaLaVistaBabyworld" 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 "HastaLaVistaBabyworld", "*.o" and any other executables which were created.
  3. (10 points) If you update "HastaLaVistaBaby.h" (you can use the touch command to update the modification time of the file) what happens if you type make?
  4. (10 points) If you update "print.c" what happens if you type make?
  5. (10 points) If you update both "print.c" and "credits.c" what happens if you type make?