I think that there are 2 issues with requiring the makefile to have only 1 target that compiles and links all of the .cpp and .h files:
1) It seems that every time we run make, it will compile all of the .cpp files instead of only the .cpp files that have changed since make was last run. This is almost equivalent to running clang++ middleearth.cpp traveling.cpp (which compiles and links both files regardless of any changes made), and so it seems that having only 1 target would defeat the purpose of a makefile.
2) The makefile will look a bit disorganized. It's more readable if the first target only links the .o files, and if the other targets create these .o files by compiling the necessary .cpp files.
Thus, I've changed the in-lab makefile requirements to match those of the pre-lab (whose makefile does not require only 1 target).
I think that there are 2 issues with requiring the makefile to have only 1 target that compiles and links all of the .cpp and .h files:
1) It seems that every time we run
make
, it will compile all of the .cpp files instead of only the .cpp files that have changed sincemake
was last run. This is almost equivalent to runningclang++ middleearth.cpp traveling.cpp
(which compiles and links both files regardless of any changes made), and so it seems that having only 1 target would defeat the purpose of a makefile.2) The makefile will look a bit disorganized. It's more readable if the first target only links the .o files, and if the other targets create these .o files by compiling the necessary .cpp files.
Thus, I've changed the in-lab makefile requirements to match those of the pre-lab (whose makefile does not require only 1 target).