This page is currently work in progress, but will contain information on building Samba for embedded devices.
So far neither Samba 3 nor Samba4 are optimized for embedded systems.
This is a loose collection of work items that will make Samba easier to run on embedded systems.
It should be possible to only build required parts of Samba at compile time. This will be a major pice of work, likely multiple man months.
I have not tried this yet.