Sonoma State University
Department of Computer Science
CS-210: Introduction to Unix
Exercise 10: Building Projects

Objective:

In this exercise, you will work with make and cmake to build compiled applications. Please review the lecture, "Introduction to Make and CMake for more information about make and cmake.

Instructions:

Please ssh (secure shell) into blue.cs.sonoma.edu then follow these steps while logged-in to Blue:

  • cd ~/cs210_exercises/cs210_exercise_10
  • wget https://www.robertjamesbruce.com/programming_exercises/cs210/fall_2024/cs210_exercise_10_v2.tgz
  • tar xzf cs210_exercise_10_v2.tgz

Question 1:

  • cd ./cs210_exercise_10_question_1
  • You should see a series of C-based source programs inside denoted by a ".c" extension. They are editable text files.
  • You should also see a file named "Makefile".
  • View the "Makefile". Notice the hash marks (#) in the Makefile? Those lines beginning with a has mark are comments in a Makefile. The comments provide hints about what to enter on the following lines.
  • Now edit the Makefile to add the filenames for all C programs in the current directory (where question 1 is located). See the lecture slides above if you are unsure how to do this.
  • Next edit the Makefile to define a filename for the output program - the name of your application that will be built. It can be anything you like but don't name it with a ".c" extension otherwise it will overwrite your source files! My suggestion is call the output program "cs210_exercise_10_question_1" (without the quotes).
  • After saving your changes to the Makefile (with your favorite editor), type "make" on the command line. If you edited your Makefile correctly it will compile the C-source code into an application.
  • Run your output program (the one you built). It should prompt you to enter some encrypted text as a series of hex codes. Enter the following encrypted hex codes:
    ef 60 37 4e 27 db f8 46 d7 fd ba 52 fb 4d 64 c8 57 75 d2 61 4b d8 6e 80 f9 ee 46 7e 40 77 14 b3 9b 2a e3 58 d0 68 d1 d4 07 3c af 5f 4f 88 b8 a1 b9 9c c7 68 32 3f 01 b0 0f e0 23 77 98 60 cb 76 99 c0 09 9e 64 d7 29 39 7b 8c 49 12 f3 0a 52 54 89 c0 6f 06 c1 f1 58 11 bf 71 55 0a ab 7e 6b c7 53 6f 09 1d 30 d6 88 ad 6e 0e 2e 35 3e b3 00 bc 35 56 e7 0d 4a d2 87 43 81 67 d5 68 3f 1d a8 60 f6 15 52 30 00 c9 86 f3 fb 50 31 01 00 72 0f a1 a5 c6 bc b9 da 57 61 95 fa 74 30 ab 9e 3c be 70 6a b7 32 1c 8b 64 db 82 5d 74 cb 30 22 33 d0 fa 70 5a a0 00 f7 6d 8e 40 85 50 42 f6 13 f1 4e 4e 69 f3 78 6a 81 aa 89 16 9c d8 15 77 83 e7 1f f7 ad 69 30 3a 5e 1b 0d
  • What does the decoded text say? Save the decoded text to a file called "Q1-decoded_text.txt".
  • Copy your Makefile to "Q1-Makefile.txt".

Question 2:

  • cd ./cs210_exercise_10_question_2
  • You should see a series of C-based source programs inside denoted by a ".c" extension. They are editable text files.
  • You should also see the file named "Makefile".
  • Now edit the Makefile to add the filenames for all C programs in the current directory (where question 2 is located). See the lecture slides above if you are unsure how to do this.
  • Next edit the Makefile to define a filename for the output program - the name of your application that will be built. It can be anything you like but don't name it with a ".c" extension otherwise it will overwrite your source files! My suggestion is call the output program "cs210_exercise_10_question_2" (without the quotes).
  • After saving your changes to the Makefile (with your favorite editor), type "make" on the command line. If you edited your Makefile correctly it will compile the C-source code into an application.
  • Run your output program (the one you built). It should prompt you to enter some encrypted text as a series of hex codes. Enter the following encrypted hex codes:
    69 60 b4 4e 2c b3 94 53 89 d7 1f 92 23 1c b9 a7 c7 24 1d 15 07 42 ec b1 ae be 6a 26 94 0d fd cc 3d cf ac e1 cb 87 fd 9e 12 b1 e0 0e 77 94 c7 f5 a2 f0 ac 11 ee bd 1e 23 9f 82 f1 af d7 bd f2 47 3c 20 3a e4 7a 48 11 78 43 6f 45 91 f9 75 13 ee 13 0d 64 1e 31 15 e5 90 c9 10 bd 73 9b fe 68 29 d0 25 5b 47 07 fc 33 e4 7a 64 6a 0b 3e 20 20 26 d0 61 95 df 5b 32 ac 35 46 02 51 4a a0 a7 b8 74 9b 59 6b 9a 2d af 5a 2b 79
  • What does the decoded text say? Save the decoded text to a file called "Q2-decoded_text.txt".
  • Copy your Makefile to "Q2-Makefile.txt".

Question 3:

  • cd ./cs210_exercise_10_question_3
  • You should see a series of C-based source programs inside denoted by a ".c" extension. They are editable text files.
  • You should also see a file named "CMakeLists.txt". This is a make file for cmake.
  • Type "cmake ."
  • Type "make"
  • If all worked out, you will have successfully compiled the C-source code into an application named "cs210_exercise_10_question_3_v2_decrypt_message"
  • Run "cs210_exercise_10_question_3_v2_decrypt_message". It should prompt you to enter some encrypted text as a series of hex codes. Enter the following encrypted hex codes:
    91 17 72 c3 41 48 59 ee 36 dd 24 fb 62 87 4a c4 a0 c5 68 77 d5 f7 8f b9 28 82 f2 b2 f2 1c 20 3f 72 a1 47 99 23 b9 99 d9 f6 d7 ab 1a e9 19 e3 fe cc dd 5c 87 a9 89 0a d2 78 ea 8a bf 21 ca 59 04 fa a7 52 cd a9 68 5d f2 5c 50 b3 13 40 b4 ff 95 31 e8 9c 2d 81 5d d6 bb 13 3b ed 94 e0 28 98 f5 c8 03 60 42 f3 fa 62 c3 04 5b 8a 62 4f 68 25 19 cc 57 9a b4 f4 9d 78 d2 bc 6c 80 8b 71 a0 5a 84 db bf fa 4a 7c 9a 28 5e d3 95 12 64 47 e8 61 dd 74 b6 8d 7e 52 a0 d0 cb ca 2d 85 af ce 6b 05 19 25 0b 13 64 9c 2b 65 66 6b ee 88 18 2c 28 af 6a 08 11 98 0e c6 f7 16 bb 87 93 80 4b 83 77 76 73 58 a5 9d e2 47 e1 38 bb 34 85 c9 5b 7f 27 e4 8c 32 3c de b1 84 48 b4 1a 6c e5 f6 83 48 45 7f be 44 b1 98 3c a2 96 19 8a f8 06 2d 86 e8 ae 1f 64 bd f5 14 56 13 68 93 fa 32 8e d1 5b 22 7c 7b b4 02 e6 f4 25 d3 c0 75 24 6b f8 c4 34 3b 45 ce
  • What does the decoded text say? Save the decoded text to a file called "Q3-decoded_text.txt".

Submitting your work:

Please upload the following to Canvas (multiple file uploads should work on Canvas or you can tar/gzip or zip the following files together:

  • Q1-decoded_text.txt
  • Q2-decoded_text.txt
  • Q3-decoded_text.txt
  • Q1-Makefile.txt
  • Q2-Makefile.txt

Exercise 10 Rubric

CRITERIA RATINGS POINTS
Question 1: Proficient
1 point

Student correctly decoded the encrypted text for question 1 and provided an edited Makefile that, if entered on Blue with the C-source code, would correctly build the C-source into an executable binary application for question 1.
Satisfactory
0.7 points

The edited Makefile contains one error which prevents it from properly building applications for question 1.
Needs Improvement
0.5 points

The Makefile contains two or more errors which prevent make from successfully building an application for question 1.
Below Expectation
0 points

No answer submitted OR the Makefile for question 1 contains three or more errors.
1 point
Question 2: Proficient
1 point

Student correctly decoded the encrypted text for question 2 and provided an edited Makefile that, if entered on Blue with the C-source code, would correctly build the C-source into an executable binary application for question 2.
Satisfactory
0.7 points

The edited Makefile contains one error which prevents it from properly building applications for question 2.
Needs Improvement
0.5 points

The Makefile contains two or more errors which prevent make from successfully building an application for question 2.
Below Expectation
0 points

No answer submitted OR the Makefile for question 2 contains three or more errors.
1 point
Question 3: Proficient
1 point

Student correctly decoded the encrypted text for question 3.
Below Expectation
0 points

The answer submitted has NOT been properly decoded into the source text; OR no answer submitted.
1 point
Total points: 3