Create a Makefile That Will Manage the Construction of a Program

Create a Makefile That Will Manage the Construction of a Program

<p> Makefile Exercise</p><p>Makefile (50 points) 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 Einstein)  Base the makefile on the source files listed below.  The makefile and the source files must be located in $HOME/itec400/homework  Your instructor will test this lab assignment in your “homework” directory.</p><p>Source files</p><p> Create the following 5 files exactly the way they are listed under your “homework” directory and make the file permissions 705:</p><p>Source File 1: main.cpp #include "employee.h" #include "address.h" int main() { printf("program works\n"); }</p><p>Source File 2: employee.cpp #include "address.h"</p><p>Source File 3: address.cpp #include <string></p><p>Source File 4: employee.h #ifndef EMPLOYEE_H #define EMPLOYEE_H #endif</p><p>Source File 5: address.h #ifndef ADDRESS_H #define ADDRESS_H #include <stdio.h> #endif</p><p>Testing Makefile Exercise</p><p>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: </p><p>Case #1: ./test_build.sh </p><p>Sample Output:</p><p>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</p><p>2. touch nothing - nothing should build make: `myProgram' is up to date.</p><p>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</p><p>4. touch main.cpp - only main.o should build g++ -c main.cpp g++ -o myProgram main.o employee.o address.o</p><p>5. touch employee.cpp - only employee.o should build g++ -c employee.cpp g++ -o myProgram main.o employee.o address.o</p><p>6. touch address.cpp - only address.o should build g++ -c address.cpp g++ -o myProgram main.o employee.o address.o</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us