reorder library links, change fn defs
no conditional in head section
nicer generation of subdir.mk
properly build debug/release
explicit debug/release targets