Building an ISO

Is there any way to programmatically build a normal Linux ISO? I want to be able to build an ISO to flash to a drive and install directly on some hardware.