Assignment 1

make and Makefiles

Due Date: Friday, Jan. 27, 2017 at class time

Required for submitting:

Grade Sheet Print this sheet and bring it to class the day the program is due.

Purpose: The purpose of this assignment is for you to familiarize yourself with the make facility on UNIX. You will be generating larger C++ programming projects this semester than you might be used to. In order to make the process of compiling, linking, etc. faster and more efficient, you will include with each of your programs a description file you will call "makefile" or "Makefile". The make command will then use that makefile to build your projects' executables. After our discussion in class, you will have the ability to generate a simple makefile capable of doing what you need. Also, I have several examples linked. A secondary purpose to this assignment is to give you additional exposure to the Unix operating system. A third reason to give you this assignment is to keep you off the streets and out of trouble. A fourth reason is that I like to keep people busy.

Resources:

  • Unix help

    • Source Code: Use the code in here

    • The examples of makefile's to accomplish various tasks.

    • man make The man pages are full of info. Be sure to check them when you have a question.

Makefile Requirements:

For this assignment, I have particular requirements regarding the form and function of the makefiles. In the future, you can take full advantage of the implicit rules, wildcards, etc. For this assignment, you should include the following:

    1. Two makefiles named makefile1.txt and makefile2.txt.

    2. A comment block in each identifying the basic information of author, date, course, purpose for doing, etc.

    3. For makefile1, there should be an explicit target for each object file with the dependencies listed. This should follow the form of the first example linked on the 5201 page. (A quick way to determine dependencies is the -MM option for the g++ compiler. For instance, try g++ -MM scanner.cpp (for the second example project) and see what you get.) makefile is to build the first project in directory linked above.

    4. For makefile 2, you will use suffix rules and macros to make it look much like the second makefile example I have posted. makefile2 is to build the project in the second example linked above.

    5. For each of your makefiles, there should be a clean target that removes the executable, the object files, and core dumps (not a chance!). This you can discover how to do from the second makefile example listed.

    6. Also for each, there should be an all target that creates an executable called driver. In fact, name your main 'driver' in all your work for the semester.

Program Specifications:

There is no C++ coding for this assignment; the code for this assignment is provided. Your job is to do the UNIX programming involved in the makefile.

Deliverables:

Makefiles: We will test that your makefiles do indeed work. You will run the submit script according to: Submission procedure. You must understand that the script will pick up files in your current directory and deposit them in a directory we have access to for grading. But the script will only pick up files with certain extensions: .cpp, .hpp, .h, .txt, .dat, and others, along with makefiles. To make this work since you have two makefiles, name your two makefiles makefile1.txt and makefile2.txt. The grader will rename them when he runs them. The grader has the code to test your makefiles, so DON'T include any code in your submission; only the makefiles.

Git submissions should have the two makefiles at the top level of their repository. Do not include any of the provided code samples. If you wish to include dotfiles to configure your repository, those are fine and will be ignored.