Generalized maximum principle for optimal control of generalized state-space systems