Question: Makefile Exersize Requirements Create a makefile that will manage the construction of a program The name of the makefile must be: makefile The make file

Makefile Exersize

Requirements

Create a makefile that will manage the construction of a program

The name of the makefile must be: makefile

The make file must produce an executable file. The name of the executable file must be: myProgram

Use the g++ compiler

Base the makefile on the source files listed below.

Source File 1: main.cpp

#include "employee.h"

#include "address.h"

int main()

{

printf("program works ");

}

Source File 2: employee.cpp

#include "address.h"

Source File 3: address.cpp

#include

Source File 4: employee.h

#ifndef EMPLOYEE_H

#define EMPLOYEE_H

#endif

Source File 5: address.h

#ifndef ADDRESS_H

#define ADDRESS_H

#include

#endif

Testing

The script test_build.sh is utilized to invoke the make command. You can obtain a copy

test_build.sh at the following location:

http://cs.franklin.edu/~dandrear/itec400/Misc/test_build.sh If you have written your makefile properly, execution of the test_build.sh script should generate the following:

Case #1: ./test_build.sh

Sample Output:

1. touch everything - everything should build

g++ -c main.cpp

g++ -c employee.cpp

g++ -c address.cpp

g++ -o myProgram main.o employee.o address.o

2. touch nothing - nothing should build

make: `myProgram' is up to date.

3. touch address.h - main and employee should build

g++ -c main.cpp

g++ -c employee.cpp

g++ -o myProgram main.o employee.o address.o

4. touch main.cpp - only main.o should build

g++ -c main.cpp

g++ -o myProgram main.o employee.o address.o

5. touch employee.cpp - only employee.o should build

g++ -c employee.cpp

g++ -o myProgram main.o employee.o address.o

6. touch address.cpp - only address.o should build

g++ -c address.cpp

g++ -o myProgram main.o employee.o address.o

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!