Question: 1.Create a directory ~/UnixCourse/makeAsst . Within that directory, create a pair of subdirectories, project1 and project2 Copy the .h and .cpp files from your earlier
1.Create a directory ~/UnixCourse/makeAsst. Within that directory, create a pair of subdirectories, project1 and project2
Copy the .h and .cpp files from your earlier Compilation assignment (should be in ~/UnixCourse/compileAsst) into your project1 directory. (~/UnixCourse/compileAsst/guess.cpp ~/UnixCourse/compileAsst/yesno.h ~/UnixCourse/compileAsst/yesno.cpp)
Copy all files in the ~cs252/Assignments/cookie/ directory into your project2 directory. (~cs252/Assignments/cookie/chompt.adt ~cs252/Assignments/cookie/mainProg.cpp)
2.In project1, create a makefile that will compile guess.cpp and yesno.cpp to produce the files guess.o and yesno.o, and will link those two .o files to produce an executable program named guess.
This should occur in 3 discrete steps (compiling guess.cpp, compiling yesno.cpp, and linking the results).
You may produce your makefile from scratch or as a modification of my self-updating makefile for single-program projects.
Verify for yourself that the make command (with no arguments) does produce the desired program. (You can do this by issuing the make command directly at the command line, or via emacs M-x compile command.)
Once you have successfully got make to build the project, run it again. Note that make realizes that the project is already up-to-date and does not rerun any of the compilation commands.
One big reason that we use make is because, on large projects consisting of many, many files, we want to avoing recompiling everything after changing just one or two files. make looks at what files have changed (by checking their modification dates - the dates you see when you do a ls -l command) and figures out the minimal number of steps required to rebuild the project based upon what has actually changed.
Now make a trivial change to either guess.cpp or yesno.cpp, but not both. For example, add a blank line at the beginning or end of the file. Then run make again and verify that your makefile really does recompile only the changed file.
You can simulate a change to a file without actually changing its contents via the touch command, which alters a files modification date without altering the contents of the file. For example, if you do
touch guess.cpp
and then run make again, it should recompile guess.cpp, but not yesno.cpp.
3.The code in project2 is for a program that plays a simple game called Chomp.
The programmers of this project have opted to package some of their code in a module called chomp.adt, from which the related files cookie.h and cookie.cpp files can be generated.
The steps necessary to produce this program are:
A. Run the command : csplit chomp.adt "/Split Here/"
and copy the resulting file xx00 to cookie.h
B. Run the command: csplit chomp.adt "/Split Here/"
and copy the resulting file xx001 to cookie.cpp
C.Compile cookie.cpp to produce cookie.o.
D.Compile mainProg.cpp to produce mainProg.o
E.Link the the .o files to produce an executable program named playChomp
Write a makefile that will carry out these steps. Your makefile should result in only the minimum required amount of steps when any input file to this process is changed. (Note: you will probably not be able to base this makefile upon my self-updating makefile as in the earlier part of the assignment. Instead, you will probably find it necessary to write this one from scratch.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
