COP3353 - 2017 Summer
Assignment 5 "Porting a Makefile"
Due by 11:59pm on Monday, July 24

Porting a Makefile

Your assignment is to "port" a Makefile from an older Debian architecture to a newer one.

Start by putting the tar file Assign05-2017-Summer.tar (hint: wget is ideal for this kind of retrieval) on, and then untar it.

Try a make clean ; make ; ./hello with the initial Makefile. You should see several error messages of the ilk (i.e., similar but not necessarily the same exact error messages):

COP3353_test@cop3353:~/Assign05-2017-Summer$ make clean ; make ; ./hello rm hello.o hello.s rm: cannot remove 'hello.o': No such file or directory rm: cannot remove 'hello.s': No such file or directory Makefile:20: recipe for target 'clean' failed make: *** [clean] Error 1 gcc -S -DUSERNAME='"Sam Smith"' hello.c as -o hello.o hello.s ld -o hello -dynamic-linker /lib/ /usr/lib/x86_64-linux-gnu/crti.o /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crtn.o hello.o -lc bash: ./hello: No such file or directory

[ To repeat: please note that you should see errors, but not necessarily the ones in the example above. Your task is to fix what problems you find in porting this Makefile, and certainly not to replicate the above errors. Look at it this way: when we test your Makefile, we are looking for "correct output", not "correct errors". ]

These are three requirements for this port, all of which are changes to the Makefile, not to the hello.c file:

  1. Correct the location for the dynamic linker on in order to fix the ld "No such file or directory" problem, and change the Makefile accordingly.
  2. Change "Sam Smith" to your own name.
  3. Modify the clean target so that the rm is done silently rather than verbosely, and does not return an error if a file does not exist.

Please verify your changes: when you do make clean && make && ./hello (note the double ampersands rather than the semicolons), you should see something like:

COP3353_test@cop3353:~/Assign05-2017-Summer$ make clean && make && ./hello gcc -S -DUSERNAME='"Randolph Langley"' hello.c as -o hello.o hello.s ld -o hello -dynamic-linker /lib/x86_64-linux-gnu/ /usr/lib/x86_64-linux/crti.o /usr/lib/x86_64-linux/crt1.o /usr/lib/x86_64-linux/crtn.o hello.o -lc Hello, this is from 'Randolph Langley'

Two things to note from above: first, despite the fact that we did a make clean again, we don't see any output from rm as per requirement 3; second, your library paths in the link line will not be those of the above line (those work on a yet different Debian derivative.)

The grader will verify this by doing the above make clean && make && ./hello in your ~/Assign05-2017-Summer subdirectory on