Course Info / Syllabus

Labs

Lecture Topics

Exam Reviews

Source Code & Other Resources


Operating Systems Concepts & Design

Lab 10 - Compiling, Makefiles, and git Branching

Lab Procedure

Make sure to return to the AWS Learner Lab page (link in Pilot if you forgot to bookmark it) and hit “Start Lab” to turn on your sandbox / AWS instance.

Use ssh to connect to your AWS Ubuntu instance.

Go to the folder that contains your repository (likely named ceg2350-yourgithubusername).

Create a new directory, Lab10.

Create a file named README.md in the Lab10 folder. The Lab 10 Template can be copied from this link:

You may refer to additional resources outside of the recommended resources provided.

Any resource that you use that contributes to your understanding of exercises in this lab should be cited in the Citations section of your lab answers. To add citations, provide the site and a summary of what it assisted you with. If generative AI was used, include which generative AI system was used and what prompt(s) you fed it.

If you make mistakes with commands in the lab, note them! Writing down what went wrong and what the correction was will significantly help your learning journey. If you cannot find a correction, it will help the TAs or myself understand what point you reached and determine some potential solutions.

Part 0 - Issues & Branches

Useful git commands: branch, switch, commit, push, merge

  1. To begin, create and add the Lab Template to your main branch in your Lab10 folder
  2. In your GitHub repository, go to the Issues tab. Create an Issue for each part of this lab - you may do this all at once or as you start each part.
  3. Through this lab, you will create one branch for each issue.
  4. Merge the branch with the main branch as your complete each part. You may then mark your issue as complete.
  5. If you make adjustments after merging you need to create an Issue describing what needs correcting, then resolve the issue.

One merge must be completed via a Pull Request - all others should be done via branch merging on the command line.

Let’s practice!

  1. Create an Issue - title it git guide - Part 0.
  2. Create a branch - on the branch, open your lab template file, fill in the git guide below. Make commits on the branch.
  3. push your changes to your branch - GitHub won’t know what branch you are talking about - read the output, it will help you do the next step to push your branch to GitHub!
  4. Verify that you like the way the markdown turned out now that it’s been pushed to GitHub (make sure you are viewing the right branch!)
  5. merge your change from your branch to main.
  6. Mark your issue as resolved! Optionally, you may close the branch.

Fill out the git guide table so you have a resource of useful commands you can refer to throughout the lab! The Notes column should have any “notes to self” you want to leave behind - easy oopsies to make, double check something, etc.

Task Command(s) / Steps Notes
Create a branch    
Change to branch    
Add branch to remote if created locally (GitHub)    
Steps to merge changes to another branch (main)    
Steps to resolve a merge conflict    

Resources

Part 1 - Compilers

Reminder - create an Issue for this part -> create a branch to work on this issue -> make your commits to this branch -> verify your changes (no broken markdown, good spelling) -> merge to main

Fill out the following charts regarding the three most commonly used languages - C/C++, Java, and Python. The bonus is you’ll make a guide for yourself on how to install these or how to check if they are already available. I’m going to give you the answers for C / C++ - you’ll need to complete the chart for Java and Python.

Installing the compiler for different OSes

Language Compiler Linux (Ubuntu/Debian) macOS Windows  
C / C++ GCC / G++ sudo apt install build-essential xcode-select --install Install MinGW via MSYS2
pacman -S mingw-w64-x86_64-gcc
 
Java OpenJDK        
Python Python        

Verifying install location & verison

Language OS Confirm Installation Command Check Version Command Expected Output Example
C (GCC) Linux which gcc gcc --version gcc (Ubuntu 13.2.0) 13.2.0
  macOS which gcc gcc --version Apple clang version 15.0.0 (clang-1500.0.40.1)
  Windows (MSYS2/MinGW) where gcc gcc --version gcc.exe (Rev10, Built by MSYS2 project) 13.2.0
C++ (G++) Linux which g++ g++ --version g++ (Ubuntu 13.2.0) 13.2.0
  macOS which clang++ clang++ --version Apple clang version 15.0.0
  Windows where g++ g++ --version g++.exe (Rev10, Built by MSYS2 project) 13.2.0
Java (JDK) Linux      
  macOS      
  Windows      
Python 3 Linux      
  macOS      
  Windows      

Part 2 - Compiling

Reminder - create an Issue for this part -> create a branch to work on this issue -> make your commits to this branch -> verify your changes (no broken markdown, good spelling) -> merge to main

Useful Commands: gcc, g++, wget

  1. Select from either TODO-C or TODO-CPP. Download the files in the folder to the Lab10 folder in your repository folder. add, commit and push the source code files.
  2. Install the C / C++ compiler on your AWS instance.
  3. Verify the installation of the C / C++ compiler on your AWS instance.
    • It is recommended to query for the version of the program to validate installation.
  4. Using your AWS instance, compile the source code into an executable program.
  5. Using your AWS instance, run the executable program.
  6. Add the program source code file - .c or .cpp files - to your repository. Do not add the compiled executable for tracking.

Resources:

Part 3 - Ignore That

Reminder - create an Issue for this part -> create a branch to work on this issue -> make your commits to this branch -> verify your changes (no broken markdown, good spelling) -> merge to main

In the root folder of your GitHub repository, create a .gitignore file and prevent tracking of your executable programs.

If you already added your executable for tracking, remove it from future tracking with git rm --cached <file_name>, then commit & push the change.

Resources:

Part 4 - Document

Reminder - create an Issue for this part -> create a branch to work on this issue -> make your commits to this branch -> verify your changes (no broken markdown, good spelling) -> merge to main

Using the source code you downloaded and the program you compiled in Part 2:

  1. Fill in the User Guide section with a user guide for the program. Provide clear and concise instructions on what the program is (its purpose), how to build and run it, and how to use the program.
  2. For all functions in the .c or .cpp files, add a comment block that includes the following:
    • What function does
    • What its parameter values are
    • what values it returns (if a function returns one type of value usually, and another value to indicate an error, your comment should describe both of these types of return values).

Example of best practice formatting - do this for each function in your .c or .cpp files:

/*
 * Function:  approx_pi 
 * --------------------
 * computes an approximation of pi using:
 *    pi/6 = 1/2 + (1/2 x 3/4) 1/5 (1/2)^3  + (1/2 x 3/4 x 5/6) 1/7 (1/2)^5 +
 *
 *  n: number of terms in the series to sum
 *
 *  returns: the approximate value of pi obtained by suming the first n terms
 *           in the above series
 *           returns zero on error (if n is non-positive)
 */

double approx_pi(int n) {
  ...
}
  1. Test that the program still compiles and the resulting executable still works as expected.

Part 5 - makey makey

Reminder - create an Issue for this part -> create a branch to work on this issue -> make your commits to this branch -> verify your changes (no broken markdown, good spelling) -> merge to main

Useful commands: make

Write a Makefile for the source code file you downloaded in Part 2.

Make a commit after creating (and testing the operation of) each target

At minimum, craft the following targets:

Test the targets in your Makefile.

Create a set of instructions for using your Makefile to perform its different taskings.

Resources:

Extra Credit - git tools

Reminder - create an Issue for this part -> create a branch to work on this issue -> make your commits to this branch -> verify your changes (no broken markdown, good spelling) -> merge to main

Choose one of the below CLI git tools:

Install it to your CLI / enable it in a tool, than add instructions to your Lab Template and show proof of what it can do!

Submission

The TAs will be checking your repository for Issues (open & closed), branches (open and closed), and commit history.

  1. Verify that your GitHub repo has a Lab10 folder with at minimum:

    • README.md
    • source code files
    • Makefile
    • .gitignore file in the root directory of your repository
  2. In the Pilot Dropbox, paste the URL to the Lab10 folder in your GitHub repo

    • URL should look like: https://github.com/WSU-kduncan/ceg2350-YOURGITHUBUSERNAME/tree/main/Lab10

Rubric

Your files should be cleanly presented in your GitHub repository. Citations should be included as needed. Include which generative AI system was used and what prompts were used if generative AI was used.

Rubric