Fix getopt() GNUism, build fix

getopt() with "-" is GNUism, not portable.
New Makefile with automatic dependency generation

New example Makefile, automatically taking care of .h dependencies.
Tested on:
 - GNU Make 3.81
 - OS X 10.7 with Clang 4.1 and LLVM-GCC-4.2.1
 - Ubuntu 10.04 with GCC 4.4.3
 - Slowlaris 10 with GCC 3.4.6