:-) For a horrible moment, the title of this thread made me think you were trying to compile the actual header. But it turned out you were just wanting to sort out your dependencies!
While your solution will work for your specific case, it's actually missing a level of dependency. The .o files depends on the .cpp file, and the .cpp files depend on the header files.
If main.cpp includes whatever.h and whatever1.h, and other.cpp includes whatever.h and other.h, the following makefile ensures that changes to whatever.h triggers a full rebuild, but changes to whatever1.h or other.h just trigger the rebuild of a single .cpp file plus a relink. Not a big deal for two files, but with bigger projects...
The -MD flag calculates all of the dependencies you need and stores them in the dependency files. Including the dependency files gives you all the lines like main.cpp : whatever.h whatever1.h automatically