UP | HOME

Hello (hello) Project
COP-3402

Table of Contents

1. Overview

In this project you will create a "hello, world!\n" program. That might sound easy, but the catch is you will need to create it using the command-line development workflow shown in class that we'll be using for all projects in the class, including the emacs editor, make build automation, and git version control for submission.

2. git setup

Be sure to complete the vc exercise before attempting this project.

Create a new local repository, following the directions in the vc exercise (including running git push --set-upstream submission master in the last step). Instead of using vc, set the local and remote repository URLs to be the following locations:

Local repository ~/cop3402fall25/hello
Remote repository gitolite3@eustis3.eecs.ucf.edu:cop3402/$USER/hello

2.1. Commands to setup your repo in brief

These steps only setup the repo. They do not submit your code. And they assume you have already completed the vc exercise. Consult that exercise for specifics on validating each step and submitting your code.

mkdir -p ~/cop3402fall25/hello
cd ~/cop3402fall25/hello
git init
echo "hello project" > README.md
git add README.md
git commit README.md
# Enter a commit message in the editor that pops up
git remote add submission gitolite3@eustis3.eecs.ucf.edu:cop3402/$USER/hello
git push --set-upstream submission master

3. Create the "hello, world!\n" program with emacs

Using either emacs in eustis, record yourself using script (see instructions below) writing, compiling, and running a hello world program in C, i.e., a program that uses printf to write "hello, world!\n" to the console.

3.1. Enter your local repository

cd ~/cop3402fall25/hello

If your ~/cop3402fall25 directory does not exist yet, be sure to do git setup first.

3.2. Start recording

script -T hello.timing hello.script

3.3. Use emacs to create a hello world program called hello.c, then compile it and run it

emacs hello.c

Create a C program that prints "hello, world!\n" (remember this is case sensitive and don't forget the \n).

Then save and exit (for emacs, Ctrl-x Ctrl-s then Ctrl-x Ctrl-c).

Make sure your compiles and runs correctly:

gcc -o hello hello.c
./hello

3.4. Stop recording

exit

(or Ctrl-D on the empty command prompt.)

3.5. Verify that your recording works by replaying it yourself

scriptreplay hello.timing hello.script 2

The 2 is optional and will replay it at 2x speed. You can use a higher number as well to replay faster. Use Ctrl-C to stop playback.

4. Creating a Makefile

4.1. Enter your local repository

cd ~/cop3402fall25/hello

If your directory does not exist yet, be sure to do git setup first.

4.2. Edit your Makefile

emacs Makefile

Hand-type the following Makefile. Use tab for indentation (not spaces), or your Makefile will not work.

.PHONY: all clean

all: hello

hello: hello.c
        gcc -o hello hello.c

clean:
        rm -f hello

Then save and exit (for emacs, Ctrl-x Ctrl-s then Ctrl-x Ctrl-c).

Do not use make to run the program (i.e., there should be no ./hello in your build step). The Makefile can include additional targets for testing the program, e.g., make check (though this is not required for this class). See the make documentation for more information about standard targets.

4.3. Test your Makefile

First clean up the compiled binary.

make clean

You should see the following output. (Do not type this into bash; this is what the Makefile will run for you):

rm -f hello

Then use make to automatically compile your program.

make

You should see the following output. (Do not type this into bash; this is what the Makefile will run for you):

gcc -o hello hello.c

If you receive compiler errors, be sure your hello.c is correct. If you receive make errors, double-check the Makefile contents against the previous step and make sure you are using tab not spaces for indentation.

If you have already built your program and not modified hello.c since, then you will see something like

make: Nothing to be done for 'all'.

or something like this

make: 'hello' is up to date.   

5. Submitting your program via git

5.1. Add and commit each file

Enter

git add hello.c
git commit hello.c

Enter an appropriate commit message.

If you encounter errors or do not know how to use the emacs editor, please be sure to complete the vc exercise before proceeding. Then setup this project's git repository.

Then enter

git add hello.timing hello.script
git commit hello.timing hello.script

Enter an appropriate commit message and then do

git add Makefile
git commit Makefile

Enter an appropriate commit message and finally do (if you haven't already done this here)

git add .gitignore
git commit .gitignore

Enter an appropriate commit message.

Double-check that you have no uncommitted or unignored changes in your working tree.

git status

You should see something like this:

On branch master
Your branch is ahead of 'submission/master' by 4 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean

This means you have commits that haven't been pushed to the git server ("Your branch is ahead…") and that your working tree has no differences from your committed code ("nothing to commit…").

You may also see a variation where there are untracked files, e.g., the above message will contain instead

On branch master
Your branch is ahead of 'submission/master' by 3 commits.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Makefile~
        hello

nothing added to commit but untracked files present (use "git add" to track)

We will see how to ignore files that are not meant to be in the git repository in the next section on .gitignore.

5.2. Push the repository

git push

You should see something similar to this:

Enumerating objects: 14, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 264 bytes | 264.00 KiB/s, done.
Total 13 (delta 0), reused 0 (delta 0), pack-reused 0
To eustis3.eecs.ucf.edu:cop3402/NID/hello
   0721d93..886c6f7  master -> master

If you encounter errors, be sure to complete the vc exercise before proceeding. Then setup this project's git repository.

6. Creating a .gitignore file

It's good practice to omit generated, binary files from source version control, such as your hello program binary. Source version control tools are geared towards source code, program binaries dramatically increase the size of the repository, and the program binary should be easily buildable from source, especially if you have good build automation. Other tools, such as package managers, may be more appropriate for distributing program binaries.

6.1. Go to the root of your repo

Be sure you are in the root of your repo, in this case ~/cop3402fall25/hello:

cd ~/cop3402fall25/hello

6.2. Make sure the hello file exists

To illustrate what the .gitignore file does, let's make sure the file hello exists (it may already if you have built your program):

touch hello

(touch creates an empty file or updates the timestamp of an existing file).

6.3. Validate the untracked file

git status

This should output something like this:

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        hello
        Makefile~

nothing added to commit but untracked files present (use "git add" to track)

There may be other content, but be sure that hello is under Untracked files:. This tells you that hello is untracked, i.e., it is in the working tree but not staged or committed. If you don't see this, be sure you are in the root of your repo and that the hello file exists. If it still is not show as untracked, then you may have accidentally added hello to your repo already. Remove it with these instructions.

6.4. Create a .gitignore file

emacs .gitignore

Put the names (or patterns) of files to exclude from the output, one per line:

*~
hello

*~ ignores emacs backup files. hello ignores the hello file.

Save and exit (for emacs, Ctrl-x Ctrl-s then Ctrl-x Ctrl-c).

6.5. Validate that git no longer considers hello untracked

git status

This should output something like this:

On branch master
Your branch is ahead of 'submission/master' by 3 commits.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore

nothing added to commit but untracked files present (use "git add" to track)

Notice that hello is no longer under Untracked files, but now the new file .gitignore is. Add and commit this file so that all users of your repo will see it.

git add .gitignore
git commit .gitignore

Enter a commit message, e.g.,

Add a .gitignore file
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Changes to be committed:
#       new file:   .gitignore
#

Save and exit (for emacs, Ctrl-x Ctrl-s then Ctrl-x Ctrl-c).

6.6. Check git status for a clean working tree

git status

This should output something like:

On branch master
nothing to commit, working tree clean

Notice .gitignore is no longer untrack, because it was committed. But hello is also untracked, not because it was committed, but because you have asked git to ignore it.

6.7. Push the repository

git push

You should see something similar to this:

Enumerating objects: 14, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 264 bytes | 264.00 KiB/s, done.
Total 13 (delta 0), reused 0 (delta 0), pack-reused 0
To eustis3.eecs.ucf.edu:cop3402/NID/hello
   0721d93..886c6f7  master -> master

If you encounter errors, be sure to complete the vc exercise before proceeding. Then setup this project's git repository.

7. Self-check

7.1. Remove the previous self-check

If you have already run the self-check, you can remove it like this

rm -rf ~/tmp/hello_selfcheck

Double-check the path carefully to avoid deleting the wrong directory.

7.2. Make a fresh clone of your project

git clone gitolite3@eustis3.eecs.ucf.edu:cop3402/$USER/hello ~/tmp/hello_selfcheck

You should see something like

Cloning into '/home/net/NID/tmp/hello_selfcheck'...
done.

If you see

fatal: destination path '/home/net/NID/tmp/hello_selfcheck already exists and is not an empty directory.

then remove the previous self-check.

7.3. Enter the fresh clone's directory

cd ~/tmp/hello_selfcheck

7.4. Double-check that the five required files are submitted

ls -a

You should see the five required files (hello.c, hello.script, hello.timing, Makefile, .gitignore), .git, ., .., and (optionally) a README.md file, e.g.,

.
..
.git
README.md
hello.c
hello.script
hello.timing
Makefile
.gitignore

The order does not matter. If you have a README.md, that is okay. If you have hello or any other program binary, remove it with these instructions and rerun the self-check.

You can also validate what files are actually in the repo like this:

git ls-tree --full-tree -r --name-only HEAD

7.5. Be sure that make works correctly

make

This should only create the hello program and do nothing else (not run the program either).

Running ls should show the hello program now in the directory.

7.6. Make sure hello runs correctly

./hello

This should output hello, world! (and exactly this; caps and the newline matter) on its own line, i.e.,

hello, world!

If you see a missing "\n", which will have the command-prompt immediately after the text, e.g.,

hello, world!NID:~/cop3402fall25/hello$ 

or if you see a missing comma, missing exclamation point, any capitalized letters, go back and follow the directions closely.

7.7. Make sure make clean works

make clean

This should remove the hello binary. Confirm that it is gone with ls.

7.8. Make sure make and ./hello still work after clean

make
./hello

You should get the same behavior as before with make and ./hello.

7.9. Make sure your terminal recording works

scriptreplay hello.timing hello.script 2

You should see a recording of yourself opening emacs, entering the hello world program, saving, and exiting.

8. Grading schema

Criterion Points
The git repo exists 1
The repo contains the five required files 1
The repo does not contain hello or any program binaries 2
The replay shows using emacs to code 2
The Makefile works correctly 1
The program runs correctly 1
TOTAL 8

Author: Paul Gazzillo

Created: 2025-08-28 Thu 15:29

Validate