Question
I need help with this question and I was wondering if you can help me with it Makefile Requirements Create a makefile that will manage
I need help with this question and I was wondering if you can help me with it
Makefile 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 (This is the C++ compiler from our friends at GNU. It is on the cs.franklin.edu)
Base the makefile on the source files listed below.
The makefile and the source files must be located in $HOME/itec400/homeworkMake sure the permissions on the your itec400 directory are705
Make sure the permissions on your make file and your source files are 705
Source files
Create the following 5 C++ files under your homework directory
: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.shIf you have written your makefile properly, execution of the test_build.sh script should generate the following output:
1.touch everything -everything should build
g++ -c main.cpp
g++ -caddress.cpp
g++ -c employee.cpp
g++ -o myProgram main.o address.oemployee.o
2.touch nothing -nothing should build
make: 'myProgram' is up todate.
3.touch address.h -main and employee should build
g++ -c main.cpp
g++ -c employee.cpp
g++ -o myProgram main.o address.oemployee.o
4.touch main.cpp -only main.o should build
g++ -c main.cpp
g++ -o myProgram main.o address.oemployee.o
5.touch employee.cpp -only employee.o should build
g++ -c employee.cpp
g++ -o myProgram main.o address.oemployee.o
6.touch address.cpp -only address.o should build
g++ -c address.cpp
g++ -o myProgram main.o address.oemployee.o
Remove myProgram and all object files (*.o)
Test Build
#!/bin/ksh
echo " 1. touch everything - everything should build" touch *.cpp *.h make sleep 2
echo " 2. touch nothing - nothing should build" make sleep 2
echo " 3. touch address.h - main and employee should build" touch address.h make sleep 2
echo " 4. touch main.cpp - only main.o should build" touch main.cpp make sleep 2
echo " 5. touch employee.cpp - only employee.o should build" touch employee.cpp make sleep 2
echo " 6. touch address.cpp - only address.o should build" touch address.cpp make
echo "Removing myProgram and all object (.o) files from current directory" # rm myProgram *.o
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started