I believe you use -I to indicate include directories, -L to indicate library directories, -D to define macros, and -l for each individual library. I have no idea how to control static vs dynamic linking from the command line.
You should go read the gcc docs/man page or a tutorial. These are all very basic features for any command line compiler so it should be easy to find the information you need.